1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Realtek RTL2830 DVB-T demodulator driver
5 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
8 #include "rtl2830_priv.h"
10 /* Our regmap is bypassing I2C adapter lock, thus we do it! */
11 static int rtl2830_bulk_write(struct i2c_client
*client
, unsigned int reg
,
12 const void *val
, size_t val_count
)
14 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
17 i2c_lock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
18 ret
= regmap_bulk_write(dev
->regmap
, reg
, val
, val_count
);
19 i2c_unlock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
23 static int rtl2830_update_bits(struct i2c_client
*client
, unsigned int reg
,
24 unsigned int mask
, unsigned int val
)
26 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
29 i2c_lock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
30 ret
= regmap_update_bits(dev
->regmap
, reg
, mask
, val
);
31 i2c_unlock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
35 static int rtl2830_bulk_read(struct i2c_client
*client
, unsigned int reg
,
36 void *val
, size_t val_count
)
38 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
41 i2c_lock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
42 ret
= regmap_bulk_read(dev
->regmap
, reg
, val
, val_count
);
43 i2c_unlock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
47 static int rtl2830_init(struct dvb_frontend
*fe
)
49 struct i2c_client
*client
= fe
->demodulator_priv
;
50 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
51 struct dtv_frontend_properties
*c
= &dev
->fe
.dtv_property_cache
;
53 struct rtl2830_reg_val_mask tab
[] = {
72 {0x106, dev
->pdata
->vtop
, 0x3f},
73 {0x107, dev
->pdata
->krf
, 0x3f},
75 {0x103, dev
->pdata
->agc_targ_val
, 0xff},
83 {0x115, dev
->pdata
->spec_inv
, 0x01},
92 for (i
= 0; i
< ARRAY_SIZE(tab
); i
++) {
93 ret
= rtl2830_update_bits(client
, tab
[i
].reg
, tab
[i
].mask
,
99 ret
= rtl2830_bulk_write(client
, 0x18f, "\x28\x00", 2);
103 ret
= rtl2830_bulk_write(client
, 0x195,
104 "\x04\x06\x0a\x12\x0a\x12\x1e\x28", 8);
108 /* TODO: spec init */
111 ret
= rtl2830_update_bits(client
, 0x101, 0x04, 0x04);
115 ret
= rtl2830_update_bits(client
, 0x101, 0x04, 0x00);
119 /* init stats here in order signal app which stats are supported */
121 c
->strength
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
123 c
->cnr
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
124 c
->post_bit_error
.len
= 1;
125 c
->post_bit_error
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
126 c
->post_bit_count
.len
= 1;
127 c
->post_bit_count
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
129 dev
->sleeping
= false;
133 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
137 static int rtl2830_sleep(struct dvb_frontend
*fe
)
139 struct i2c_client
*client
= fe
->demodulator_priv
;
140 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
142 dev
->sleeping
= true;
148 static int rtl2830_get_tune_settings(struct dvb_frontend
*fe
,
149 struct dvb_frontend_tune_settings
*s
)
151 s
->min_delay_ms
= 500;
152 s
->step_size
= fe
->ops
.info
.frequency_stepsize_hz
* 2;
153 s
->max_drift
= (fe
->ops
.info
.frequency_stepsize_hz
* 2) + 1;
158 static int rtl2830_set_frontend(struct dvb_frontend
*fe
)
160 struct i2c_client
*client
= fe
->demodulator_priv
;
161 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
162 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
166 u32 if_ctl
, if_frequency
;
167 static const u8 bw_params1
[3][34] = {
169 0x1f, 0xf0, 0x1f, 0xf0, 0x1f, 0xfa, 0x00, 0x17, 0x00, 0x41,
170 0x00, 0x64, 0x00, 0x67, 0x00, 0x38, 0x1f, 0xde, 0x1f, 0x7a,
171 0x1f, 0x47, 0x1f, 0x7c, 0x00, 0x30, 0x01, 0x4b, 0x02, 0x82,
172 0x03, 0x73, 0x03, 0xcf, /* 6 MHz */
174 0x1f, 0xfa, 0x1f, 0xda, 0x1f, 0xc1, 0x1f, 0xb3, 0x1f, 0xca,
175 0x00, 0x07, 0x00, 0x4d, 0x00, 0x6d, 0x00, 0x40, 0x1f, 0xca,
176 0x1f, 0x4d, 0x1f, 0x2a, 0x1f, 0xb2, 0x00, 0xec, 0x02, 0x7e,
177 0x03, 0xd0, 0x04, 0x53, /* 7 MHz */
179 0x00, 0x10, 0x00, 0x0e, 0x1f, 0xf7, 0x1f, 0xc9, 0x1f, 0xa0,
180 0x1f, 0xa6, 0x1f, 0xec, 0x00, 0x4e, 0x00, 0x7d, 0x00, 0x3a,
181 0x1f, 0x98, 0x1f, 0x10, 0x1f, 0x40, 0x00, 0x75, 0x02, 0x5f,
182 0x04, 0x24, 0x04, 0xdb, /* 8 MHz */
185 static const u8 bw_params2
[3][6] = {
186 {0xc3, 0x0c, 0x44, 0x33, 0x33, 0x30}, /* 6 MHz */
187 {0xb8, 0xe3, 0x93, 0x99, 0x99, 0x98}, /* 7 MHz */
188 {0xae, 0xba, 0xf3, 0x26, 0x66, 0x64}, /* 8 MHz */
191 dev_dbg(&client
->dev
, "frequency=%u bandwidth_hz=%u inversion=%u\n",
192 c
->frequency
, c
->bandwidth_hz
, c
->inversion
);
195 if (fe
->ops
.tuner_ops
.set_params
)
196 fe
->ops
.tuner_ops
.set_params(fe
);
198 switch (c
->bandwidth_hz
) {
209 dev_err(&client
->dev
, "invalid bandwidth_hz %u\n",
214 ret
= rtl2830_update_bits(client
, 0x008, 0x06, i
<< 1);
218 /* program if frequency */
219 if (fe
->ops
.tuner_ops
.get_if_frequency
)
220 ret
= fe
->ops
.tuner_ops
.get_if_frequency(fe
, &if_frequency
);
226 num
= if_frequency
% dev
->pdata
->clk
;
228 num
= div_u64(num
, dev
->pdata
->clk
);
230 if_ctl
= num
& 0x3fffff;
231 dev_dbg(&client
->dev
, "if_frequency=%d if_ctl=%08x\n",
232 if_frequency
, if_ctl
);
234 buf
[0] = (if_ctl
>> 16) & 0x3f;
235 buf
[1] = (if_ctl
>> 8) & 0xff;
236 buf
[2] = (if_ctl
>> 0) & 0xff;
238 ret
= rtl2830_bulk_read(client
, 0x119, &u8tmp
, 1);
242 buf
[0] |= u8tmp
& 0xc0; /* [7:6] */
244 ret
= rtl2830_bulk_write(client
, 0x119, buf
, 3);
248 /* 1/2 split I2C write */
249 ret
= rtl2830_bulk_write(client
, 0x11c, &bw_params1
[i
][0], 17);
253 /* 2/2 split I2C write */
254 ret
= rtl2830_bulk_write(client
, 0x12d, &bw_params1
[i
][17], 17);
258 ret
= rtl2830_bulk_write(client
, 0x19d, bw_params2
[i
], 6);
264 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
268 static int rtl2830_get_frontend(struct dvb_frontend
*fe
,
269 struct dtv_frontend_properties
*c
)
271 struct i2c_client
*client
= fe
->demodulator_priv
;
272 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
279 ret
= rtl2830_bulk_read(client
, 0x33c, buf
, 2);
283 ret
= rtl2830_bulk_read(client
, 0x351, &buf
[2], 1);
287 dev_dbg(&client
->dev
, "TPS=%*ph\n", 3, buf
);
289 switch ((buf
[0] >> 2) & 3) {
291 c
->modulation
= QPSK
;
294 c
->modulation
= QAM_16
;
297 c
->modulation
= QAM_64
;
301 switch ((buf
[2] >> 2) & 1) {
303 c
->transmission_mode
= TRANSMISSION_MODE_2K
;
306 c
->transmission_mode
= TRANSMISSION_MODE_8K
;
309 switch ((buf
[2] >> 0) & 3) {
311 c
->guard_interval
= GUARD_INTERVAL_1_32
;
314 c
->guard_interval
= GUARD_INTERVAL_1_16
;
317 c
->guard_interval
= GUARD_INTERVAL_1_8
;
320 c
->guard_interval
= GUARD_INTERVAL_1_4
;
324 switch ((buf
[0] >> 4) & 7) {
326 c
->hierarchy
= HIERARCHY_NONE
;
329 c
->hierarchy
= HIERARCHY_1
;
332 c
->hierarchy
= HIERARCHY_2
;
335 c
->hierarchy
= HIERARCHY_4
;
339 switch ((buf
[1] >> 3) & 7) {
341 c
->code_rate_HP
= FEC_1_2
;
344 c
->code_rate_HP
= FEC_2_3
;
347 c
->code_rate_HP
= FEC_3_4
;
350 c
->code_rate_HP
= FEC_5_6
;
353 c
->code_rate_HP
= FEC_7_8
;
357 switch ((buf
[1] >> 0) & 7) {
359 c
->code_rate_LP
= FEC_1_2
;
362 c
->code_rate_LP
= FEC_2_3
;
365 c
->code_rate_LP
= FEC_3_4
;
368 c
->code_rate_LP
= FEC_5_6
;
371 c
->code_rate_LP
= FEC_7_8
;
377 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
381 static int rtl2830_read_status(struct dvb_frontend
*fe
, enum fe_status
*status
)
383 struct i2c_client
*client
= fe
->demodulator_priv
;
384 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
385 struct dtv_frontend_properties
*c
= &dev
->fe
.dtv_property_cache
;
395 ret
= rtl2830_bulk_read(client
, 0x351, &u8tmp
, 1);
399 u8tmp
= (u8tmp
>> 3) & 0x0f; /* [6:3] */
401 *status
|= FE_HAS_SIGNAL
| FE_HAS_CARRIER
|
402 FE_HAS_VITERBI
| FE_HAS_SYNC
| FE_HAS_LOCK
;
403 } else if (u8tmp
== 10) {
404 *status
|= FE_HAS_SIGNAL
| FE_HAS_CARRIER
|
408 dev
->fe_status
= *status
;
410 /* Signal strength */
411 if (dev
->fe_status
& FE_HAS_SIGNAL
) {
413 ret
= rtl2830_bulk_read(client
, 0x359, buf
, 2);
417 stmp
= buf
[0] << 8 | buf
[1] << 0;
418 stmp
= sign_extend32(stmp
, 13);
419 utmp
= clamp_val(-4 * stmp
+ 32767, 0x0000, 0xffff);
421 dev_dbg(&client
->dev
, "IF AGC=%d\n", stmp
);
423 c
->strength
.stat
[0].scale
= FE_SCALE_RELATIVE
;
424 c
->strength
.stat
[0].uvalue
= utmp
;
426 c
->strength
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
430 if (dev
->fe_status
& FE_HAS_VITERBI
) {
431 unsigned int hierarchy
, constellation
;
432 #define CONSTELLATION_NUM 3
433 #define HIERARCHY_NUM 4
434 static const u32 constant
[CONSTELLATION_NUM
][HIERARCHY_NUM
] = {
435 {70705899, 70705899, 70705899, 70705899},
436 {82433173, 82433173, 87483115, 94445660},
437 {92888734, 92888734, 95487525, 99770748},
440 ret
= rtl2830_bulk_read(client
, 0x33c, &u8tmp
, 1);
444 constellation
= (u8tmp
>> 2) & 0x03; /* [3:2] */
445 if (constellation
> CONSTELLATION_NUM
- 1)
448 hierarchy
= (u8tmp
>> 4) & 0x07; /* [6:4] */
449 if (hierarchy
> HIERARCHY_NUM
- 1)
452 ret
= rtl2830_bulk_read(client
, 0x40c, buf
, 2);
456 utmp
= buf
[0] << 8 | buf
[1] << 0;
458 stmp
= (constant
[constellation
][hierarchy
] -
459 intlog10(utmp
)) / ((1 << 24) / 10000);
463 dev_dbg(&client
->dev
, "CNR raw=%u\n", utmp
);
465 c
->cnr
.stat
[0].scale
= FE_SCALE_DECIBEL
;
466 c
->cnr
.stat
[0].svalue
= stmp
;
468 c
->cnr
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
472 if (dev
->fe_status
& FE_HAS_LOCK
) {
473 ret
= rtl2830_bulk_read(client
, 0x34e, buf
, 2);
477 utmp
= buf
[0] << 8 | buf
[1] << 0;
478 dev
->post_bit_error
+= utmp
;
479 dev
->post_bit_count
+= 1000000;
481 dev_dbg(&client
->dev
, "BER errors=%u total=1000000\n", utmp
);
483 c
->post_bit_error
.stat
[0].scale
= FE_SCALE_COUNTER
;
484 c
->post_bit_error
.stat
[0].uvalue
= dev
->post_bit_error
;
485 c
->post_bit_count
.stat
[0].scale
= FE_SCALE_COUNTER
;
486 c
->post_bit_count
.stat
[0].uvalue
= dev
->post_bit_count
;
488 c
->post_bit_error
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
489 c
->post_bit_count
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
495 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
499 static int rtl2830_read_snr(struct dvb_frontend
*fe
, u16
*snr
)
501 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
503 if (c
->cnr
.stat
[0].scale
== FE_SCALE_DECIBEL
)
504 *snr
= div_s64(c
->cnr
.stat
[0].svalue
, 100);
511 static int rtl2830_read_ber(struct dvb_frontend
*fe
, u32
*ber
)
513 struct i2c_client
*client
= fe
->demodulator_priv
;
514 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
516 *ber
= (dev
->post_bit_error
- dev
->post_bit_error_prev
);
517 dev
->post_bit_error_prev
= dev
->post_bit_error
;
522 static int rtl2830_read_ucblocks(struct dvb_frontend
*fe
, u32
*ucblocks
)
529 static int rtl2830_read_signal_strength(struct dvb_frontend
*fe
, u16
*strength
)
531 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
533 if (c
->strength
.stat
[0].scale
== FE_SCALE_RELATIVE
)
534 *strength
= c
->strength
.stat
[0].uvalue
;
541 static const struct dvb_frontend_ops rtl2830_ops
= {
542 .delsys
= {SYS_DVBT
},
544 .name
= "Realtek RTL2830 (DVB-T)",
545 .caps
= FE_CAN_FEC_1_2
|
555 FE_CAN_TRANSMISSION_MODE_AUTO
|
556 FE_CAN_GUARD_INTERVAL_AUTO
|
557 FE_CAN_HIERARCHY_AUTO
|
562 .init
= rtl2830_init
,
563 .sleep
= rtl2830_sleep
,
565 .get_tune_settings
= rtl2830_get_tune_settings
,
567 .set_frontend
= rtl2830_set_frontend
,
568 .get_frontend
= rtl2830_get_frontend
,
570 .read_status
= rtl2830_read_status
,
571 .read_snr
= rtl2830_read_snr
,
572 .read_ber
= rtl2830_read_ber
,
573 .read_ucblocks
= rtl2830_read_ucblocks
,
574 .read_signal_strength
= rtl2830_read_signal_strength
,
577 static int rtl2830_pid_filter_ctrl(struct dvb_frontend
*fe
, int onoff
)
579 struct i2c_client
*client
= fe
->demodulator_priv
;
583 dev_dbg(&client
->dev
, "onoff=%d\n", onoff
);
585 /* enable / disable PID filter */
591 ret
= rtl2830_update_bits(client
, 0x061, 0x80, u8tmp
);
597 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
601 static int rtl2830_pid_filter(struct dvb_frontend
*fe
, u8 index
, u16 pid
, int onoff
)
603 struct i2c_client
*client
= fe
->demodulator_priv
;
604 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
608 dev_dbg(&client
->dev
, "index=%d pid=%04x onoff=%d\n",
611 /* skip invalid PIDs (0x2000) */
612 if (pid
> 0x1fff || index
> 32)
616 set_bit(index
, &dev
->filters
);
618 clear_bit(index
, &dev
->filters
);
620 /* enable / disable PIDs */
621 buf
[0] = (dev
->filters
>> 0) & 0xff;
622 buf
[1] = (dev
->filters
>> 8) & 0xff;
623 buf
[2] = (dev
->filters
>> 16) & 0xff;
624 buf
[3] = (dev
->filters
>> 24) & 0xff;
625 ret
= rtl2830_bulk_write(client
, 0x062, buf
, 4);
630 buf
[0] = (pid
>> 8) & 0xff;
631 buf
[1] = (pid
>> 0) & 0xff;
632 ret
= rtl2830_bulk_write(client
, 0x066 + 2 * index
, buf
, 2);
638 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
643 * I2C gate/mux/repeater logic
644 * We must use unlocked __i2c_transfer() here (through regmap) because of I2C
645 * adapter lock is already taken by tuner driver.
646 * Gate is closed automatically after single I2C transfer.
648 static int rtl2830_select(struct i2c_mux_core
*muxc
, u32 chan_id
)
650 struct i2c_client
*client
= i2c_mux_priv(muxc
);
651 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
654 dev_dbg(&client
->dev
, "\n");
656 /* open I2C repeater for 1 transfer, closes automatically */
657 /* XXX: regmap_update_bits() does not lock I2C adapter */
658 ret
= regmap_update_bits(dev
->regmap
, 0x101, 0x08, 0x08);
664 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
668 static struct dvb_frontend
*rtl2830_get_dvb_frontend(struct i2c_client
*client
)
670 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
672 dev_dbg(&client
->dev
, "\n");
677 static struct i2c_adapter
*rtl2830_get_i2c_adapter(struct i2c_client
*client
)
679 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
681 dev_dbg(&client
->dev
, "\n");
683 return dev
->muxc
->adapter
[0];
687 * We implement own I2C access routines for regmap in order to get manual access
688 * to I2C adapter lock, which is needed for I2C mux adapter.
690 static int rtl2830_regmap_read(void *context
, const void *reg_buf
,
691 size_t reg_size
, void *val_buf
, size_t val_size
)
693 struct i2c_client
*client
= context
;
695 struct i2c_msg msg
[2] = {
697 .addr
= client
->addr
,
700 .buf
= (u8
*)reg_buf
,
702 .addr
= client
->addr
,
709 ret
= __i2c_transfer(client
->adapter
, msg
, 2);
711 dev_warn(&client
->dev
, "i2c reg read failed %d\n", ret
);
719 static int rtl2830_regmap_write(void *context
, const void *data
, size_t count
)
721 struct i2c_client
*client
= context
;
723 struct i2c_msg msg
[1] = {
725 .addr
= client
->addr
,
732 ret
= __i2c_transfer(client
->adapter
, msg
, 1);
734 dev_warn(&client
->dev
, "i2c reg write failed %d\n", ret
);
742 static int rtl2830_regmap_gather_write(void *context
, const void *reg
,
743 size_t reg_len
, const void *val
,
746 struct i2c_client
*client
= context
;
749 struct i2c_msg msg
[1] = {
751 .addr
= client
->addr
,
758 buf
[0] = *(u8
const *)reg
;
759 memcpy(&buf
[1], val
, val_len
);
761 ret
= __i2c_transfer(client
->adapter
, msg
, 1);
763 dev_warn(&client
->dev
, "i2c reg write failed %d\n", ret
);
771 static int rtl2830_probe(struct i2c_client
*client
,
772 const struct i2c_device_id
*id
)
774 struct rtl2830_platform_data
*pdata
= client
->dev
.platform_data
;
775 struct rtl2830_dev
*dev
;
778 static const struct regmap_bus regmap_bus
= {
779 .read
= rtl2830_regmap_read
,
780 .write
= rtl2830_regmap_write
,
781 .gather_write
= rtl2830_regmap_gather_write
,
782 .val_format_endian_default
= REGMAP_ENDIAN_NATIVE
,
784 static const struct regmap_range_cfg regmap_range_cfg
[] = {
786 .selector_reg
= 0x00,
787 .selector_mask
= 0xff,
791 .range_min
= 0 * 0x100,
792 .range_max
= 5 * 0x100,
795 static const struct regmap_config regmap_config
= {
798 .max_register
= 5 * 0x100,
799 .ranges
= regmap_range_cfg
,
800 .num_ranges
= ARRAY_SIZE(regmap_range_cfg
),
803 dev_dbg(&client
->dev
, "\n");
810 /* allocate memory for the internal state */
811 dev
= kzalloc(sizeof(*dev
), GFP_KERNEL
);
817 /* setup the state */
818 i2c_set_clientdata(client
, dev
);
819 dev
->client
= client
;
820 dev
->pdata
= client
->dev
.platform_data
;
821 dev
->sleeping
= true;
822 dev
->regmap
= regmap_init(&client
->dev
, ®map_bus
, client
,
824 if (IS_ERR(dev
->regmap
)) {
825 ret
= PTR_ERR(dev
->regmap
);
829 /* check if the demod is there */
830 ret
= rtl2830_bulk_read(client
, 0x000, &u8tmp
, 1);
832 goto err_regmap_exit
;
834 /* create muxed i2c adapter for tuner */
835 dev
->muxc
= i2c_mux_alloc(client
->adapter
, &client
->dev
, 1, 0, 0,
836 rtl2830_select
, NULL
);
839 goto err_regmap_exit
;
841 dev
->muxc
->priv
= client
;
842 ret
= i2c_mux_add_adapter(dev
->muxc
, 0, 0, 0);
844 goto err_regmap_exit
;
846 /* create dvb frontend */
847 memcpy(&dev
->fe
.ops
, &rtl2830_ops
, sizeof(dev
->fe
.ops
));
848 dev
->fe
.demodulator_priv
= client
;
850 /* setup callbacks */
851 pdata
->get_dvb_frontend
= rtl2830_get_dvb_frontend
;
852 pdata
->get_i2c_adapter
= rtl2830_get_i2c_adapter
;
853 pdata
->pid_filter
= rtl2830_pid_filter
;
854 pdata
->pid_filter_ctrl
= rtl2830_pid_filter_ctrl
;
856 dev_info(&client
->dev
, "Realtek RTL2830 successfully attached\n");
860 regmap_exit(dev
->regmap
);
864 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
868 static int rtl2830_remove(struct i2c_client
*client
)
870 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
872 dev_dbg(&client
->dev
, "\n");
874 i2c_mux_del_adapters(dev
->muxc
);
875 regmap_exit(dev
->regmap
);
881 static const struct i2c_device_id rtl2830_id_table
[] = {
885 MODULE_DEVICE_TABLE(i2c
, rtl2830_id_table
);
887 static struct i2c_driver rtl2830_driver
= {
890 .suppress_bind_attrs
= true,
892 .probe
= rtl2830_probe
,
893 .remove
= rtl2830_remove
,
894 .id_table
= rtl2830_id_table
,
897 module_i2c_driver(rtl2830_driver
);
899 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
900 MODULE_DESCRIPTION("Realtek RTL2830 DVB-T demodulator driver");
901 MODULE_LICENSE("GPL");