2 * Realtek RTL2830 DVB-T demodulator driver
4 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #include "rtl2830_priv.h"
20 /* Our regmap is bypassing I2C adapter lock, thus we do it! */
21 static int rtl2830_bulk_write(struct i2c_client
*client
, unsigned int reg
,
22 const void *val
, size_t val_count
)
24 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
27 i2c_lock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
28 ret
= regmap_bulk_write(dev
->regmap
, reg
, val
, val_count
);
29 i2c_unlock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
33 static int rtl2830_update_bits(struct i2c_client
*client
, unsigned int reg
,
34 unsigned int mask
, unsigned int val
)
36 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
39 i2c_lock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
40 ret
= regmap_update_bits(dev
->regmap
, reg
, mask
, val
);
41 i2c_unlock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
45 static int rtl2830_bulk_read(struct i2c_client
*client
, unsigned int reg
,
46 void *val
, size_t val_count
)
48 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
51 i2c_lock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
52 ret
= regmap_bulk_read(dev
->regmap
, reg
, val
, val_count
);
53 i2c_unlock_bus(client
->adapter
, I2C_LOCK_SEGMENT
);
57 static int rtl2830_init(struct dvb_frontend
*fe
)
59 struct i2c_client
*client
= fe
->demodulator_priv
;
60 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
61 struct dtv_frontend_properties
*c
= &dev
->fe
.dtv_property_cache
;
63 struct rtl2830_reg_val_mask tab
[] = {
82 {0x106, dev
->pdata
->vtop
, 0x3f},
83 {0x107, dev
->pdata
->krf
, 0x3f},
85 {0x103, dev
->pdata
->agc_targ_val
, 0xff},
93 {0x115, dev
->pdata
->spec_inv
, 0x01},
102 for (i
= 0; i
< ARRAY_SIZE(tab
); i
++) {
103 ret
= rtl2830_update_bits(client
, tab
[i
].reg
, tab
[i
].mask
,
109 ret
= rtl2830_bulk_write(client
, 0x18f, "\x28\x00", 2);
113 ret
= rtl2830_bulk_write(client
, 0x195,
114 "\x04\x06\x0a\x12\x0a\x12\x1e\x28", 8);
118 /* TODO: spec init */
121 ret
= rtl2830_update_bits(client
, 0x101, 0x04, 0x04);
125 ret
= rtl2830_update_bits(client
, 0x101, 0x04, 0x00);
129 /* init stats here in order signal app which stats are supported */
131 c
->strength
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
133 c
->cnr
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
134 c
->post_bit_error
.len
= 1;
135 c
->post_bit_error
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
136 c
->post_bit_count
.len
= 1;
137 c
->post_bit_count
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
139 dev
->sleeping
= false;
143 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
147 static int rtl2830_sleep(struct dvb_frontend
*fe
)
149 struct i2c_client
*client
= fe
->demodulator_priv
;
150 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
152 dev
->sleeping
= true;
158 static int rtl2830_get_tune_settings(struct dvb_frontend
*fe
,
159 struct dvb_frontend_tune_settings
*s
)
161 s
->min_delay_ms
= 500;
162 s
->step_size
= fe
->ops
.info
.frequency_stepsize_hz
* 2;
163 s
->max_drift
= (fe
->ops
.info
.frequency_stepsize_hz
* 2) + 1;
168 static int rtl2830_set_frontend(struct dvb_frontend
*fe
)
170 struct i2c_client
*client
= fe
->demodulator_priv
;
171 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
172 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
176 u32 if_ctl
, if_frequency
;
177 static const u8 bw_params1
[3][34] = {
179 0x1f, 0xf0, 0x1f, 0xf0, 0x1f, 0xfa, 0x00, 0x17, 0x00, 0x41,
180 0x00, 0x64, 0x00, 0x67, 0x00, 0x38, 0x1f, 0xde, 0x1f, 0x7a,
181 0x1f, 0x47, 0x1f, 0x7c, 0x00, 0x30, 0x01, 0x4b, 0x02, 0x82,
182 0x03, 0x73, 0x03, 0xcf, /* 6 MHz */
184 0x1f, 0xfa, 0x1f, 0xda, 0x1f, 0xc1, 0x1f, 0xb3, 0x1f, 0xca,
185 0x00, 0x07, 0x00, 0x4d, 0x00, 0x6d, 0x00, 0x40, 0x1f, 0xca,
186 0x1f, 0x4d, 0x1f, 0x2a, 0x1f, 0xb2, 0x00, 0xec, 0x02, 0x7e,
187 0x03, 0xd0, 0x04, 0x53, /* 7 MHz */
189 0x00, 0x10, 0x00, 0x0e, 0x1f, 0xf7, 0x1f, 0xc9, 0x1f, 0xa0,
190 0x1f, 0xa6, 0x1f, 0xec, 0x00, 0x4e, 0x00, 0x7d, 0x00, 0x3a,
191 0x1f, 0x98, 0x1f, 0x10, 0x1f, 0x40, 0x00, 0x75, 0x02, 0x5f,
192 0x04, 0x24, 0x04, 0xdb, /* 8 MHz */
195 static const u8 bw_params2
[3][6] = {
196 {0xc3, 0x0c, 0x44, 0x33, 0x33, 0x30}, /* 6 MHz */
197 {0xb8, 0xe3, 0x93, 0x99, 0x99, 0x98}, /* 7 MHz */
198 {0xae, 0xba, 0xf3, 0x26, 0x66, 0x64}, /* 8 MHz */
201 dev_dbg(&client
->dev
, "frequency=%u bandwidth_hz=%u inversion=%u\n",
202 c
->frequency
, c
->bandwidth_hz
, c
->inversion
);
205 if (fe
->ops
.tuner_ops
.set_params
)
206 fe
->ops
.tuner_ops
.set_params(fe
);
208 switch (c
->bandwidth_hz
) {
219 dev_err(&client
->dev
, "invalid bandwidth_hz %u\n",
224 ret
= rtl2830_update_bits(client
, 0x008, 0x06, i
<< 1);
228 /* program if frequency */
229 if (fe
->ops
.tuner_ops
.get_if_frequency
)
230 ret
= fe
->ops
.tuner_ops
.get_if_frequency(fe
, &if_frequency
);
236 num
= if_frequency
% dev
->pdata
->clk
;
238 num
= div_u64(num
, dev
->pdata
->clk
);
240 if_ctl
= num
& 0x3fffff;
241 dev_dbg(&client
->dev
, "if_frequency=%d if_ctl=%08x\n",
242 if_frequency
, if_ctl
);
244 buf
[0] = (if_ctl
>> 16) & 0x3f;
245 buf
[1] = (if_ctl
>> 8) & 0xff;
246 buf
[2] = (if_ctl
>> 0) & 0xff;
248 ret
= rtl2830_bulk_read(client
, 0x119, &u8tmp
, 1);
252 buf
[0] |= u8tmp
& 0xc0; /* [7:6] */
254 ret
= rtl2830_bulk_write(client
, 0x119, buf
, 3);
258 /* 1/2 split I2C write */
259 ret
= rtl2830_bulk_write(client
, 0x11c, &bw_params1
[i
][0], 17);
263 /* 2/2 split I2C write */
264 ret
= rtl2830_bulk_write(client
, 0x12d, &bw_params1
[i
][17], 17);
268 ret
= rtl2830_bulk_write(client
, 0x19d, bw_params2
[i
], 6);
274 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
278 static int rtl2830_get_frontend(struct dvb_frontend
*fe
,
279 struct dtv_frontend_properties
*c
)
281 struct i2c_client
*client
= fe
->demodulator_priv
;
282 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
289 ret
= rtl2830_bulk_read(client
, 0x33c, buf
, 2);
293 ret
= rtl2830_bulk_read(client
, 0x351, &buf
[2], 1);
297 dev_dbg(&client
->dev
, "TPS=%*ph\n", 3, buf
);
299 switch ((buf
[0] >> 2) & 3) {
301 c
->modulation
= QPSK
;
304 c
->modulation
= QAM_16
;
307 c
->modulation
= QAM_64
;
311 switch ((buf
[2] >> 2) & 1) {
313 c
->transmission_mode
= TRANSMISSION_MODE_2K
;
316 c
->transmission_mode
= TRANSMISSION_MODE_8K
;
319 switch ((buf
[2] >> 0) & 3) {
321 c
->guard_interval
= GUARD_INTERVAL_1_32
;
324 c
->guard_interval
= GUARD_INTERVAL_1_16
;
327 c
->guard_interval
= GUARD_INTERVAL_1_8
;
330 c
->guard_interval
= GUARD_INTERVAL_1_4
;
334 switch ((buf
[0] >> 4) & 7) {
336 c
->hierarchy
= HIERARCHY_NONE
;
339 c
->hierarchy
= HIERARCHY_1
;
342 c
->hierarchy
= HIERARCHY_2
;
345 c
->hierarchy
= HIERARCHY_4
;
349 switch ((buf
[1] >> 3) & 7) {
351 c
->code_rate_HP
= FEC_1_2
;
354 c
->code_rate_HP
= FEC_2_3
;
357 c
->code_rate_HP
= FEC_3_4
;
360 c
->code_rate_HP
= FEC_5_6
;
363 c
->code_rate_HP
= FEC_7_8
;
367 switch ((buf
[1] >> 0) & 7) {
369 c
->code_rate_LP
= FEC_1_2
;
372 c
->code_rate_LP
= FEC_2_3
;
375 c
->code_rate_LP
= FEC_3_4
;
378 c
->code_rate_LP
= FEC_5_6
;
381 c
->code_rate_LP
= FEC_7_8
;
387 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
391 static int rtl2830_read_status(struct dvb_frontend
*fe
, enum fe_status
*status
)
393 struct i2c_client
*client
= fe
->demodulator_priv
;
394 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
395 struct dtv_frontend_properties
*c
= &dev
->fe
.dtv_property_cache
;
405 ret
= rtl2830_bulk_read(client
, 0x351, &u8tmp
, 1);
409 u8tmp
= (u8tmp
>> 3) & 0x0f; /* [6:3] */
411 *status
|= FE_HAS_SIGNAL
| FE_HAS_CARRIER
|
412 FE_HAS_VITERBI
| FE_HAS_SYNC
| FE_HAS_LOCK
;
413 } else if (u8tmp
== 10) {
414 *status
|= FE_HAS_SIGNAL
| FE_HAS_CARRIER
|
418 dev
->fe_status
= *status
;
420 /* Signal strength */
421 if (dev
->fe_status
& FE_HAS_SIGNAL
) {
423 ret
= rtl2830_bulk_read(client
, 0x359, buf
, 2);
427 stmp
= buf
[0] << 8 | buf
[1] << 0;
428 stmp
= sign_extend32(stmp
, 13);
429 utmp
= clamp_val(-4 * stmp
+ 32767, 0x0000, 0xffff);
431 dev_dbg(&client
->dev
, "IF AGC=%d\n", stmp
);
433 c
->strength
.stat
[0].scale
= FE_SCALE_RELATIVE
;
434 c
->strength
.stat
[0].uvalue
= utmp
;
436 c
->strength
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
440 if (dev
->fe_status
& FE_HAS_VITERBI
) {
441 unsigned int hierarchy
, constellation
;
442 #define CONSTELLATION_NUM 3
443 #define HIERARCHY_NUM 4
444 static const u32 constant
[CONSTELLATION_NUM
][HIERARCHY_NUM
] = {
445 {70705899, 70705899, 70705899, 70705899},
446 {82433173, 82433173, 87483115, 94445660},
447 {92888734, 92888734, 95487525, 99770748},
450 ret
= rtl2830_bulk_read(client
, 0x33c, &u8tmp
, 1);
454 constellation
= (u8tmp
>> 2) & 0x03; /* [3:2] */
455 if (constellation
> CONSTELLATION_NUM
- 1)
458 hierarchy
= (u8tmp
>> 4) & 0x07; /* [6:4] */
459 if (hierarchy
> HIERARCHY_NUM
- 1)
462 ret
= rtl2830_bulk_read(client
, 0x40c, buf
, 2);
466 utmp
= buf
[0] << 8 | buf
[1] << 0;
468 stmp
= (constant
[constellation
][hierarchy
] -
469 intlog10(utmp
)) / ((1 << 24) / 10000);
473 dev_dbg(&client
->dev
, "CNR raw=%u\n", utmp
);
475 c
->cnr
.stat
[0].scale
= FE_SCALE_DECIBEL
;
476 c
->cnr
.stat
[0].svalue
= stmp
;
478 c
->cnr
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
482 if (dev
->fe_status
& FE_HAS_LOCK
) {
483 ret
= rtl2830_bulk_read(client
, 0x34e, buf
, 2);
487 utmp
= buf
[0] << 8 | buf
[1] << 0;
488 dev
->post_bit_error
+= utmp
;
489 dev
->post_bit_count
+= 1000000;
491 dev_dbg(&client
->dev
, "BER errors=%u total=1000000\n", utmp
);
493 c
->post_bit_error
.stat
[0].scale
= FE_SCALE_COUNTER
;
494 c
->post_bit_error
.stat
[0].uvalue
= dev
->post_bit_error
;
495 c
->post_bit_count
.stat
[0].scale
= FE_SCALE_COUNTER
;
496 c
->post_bit_count
.stat
[0].uvalue
= dev
->post_bit_count
;
498 c
->post_bit_error
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
499 c
->post_bit_count
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
505 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
509 static int rtl2830_read_snr(struct dvb_frontend
*fe
, u16
*snr
)
511 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
513 if (c
->cnr
.stat
[0].scale
== FE_SCALE_DECIBEL
)
514 *snr
= div_s64(c
->cnr
.stat
[0].svalue
, 100);
521 static int rtl2830_read_ber(struct dvb_frontend
*fe
, u32
*ber
)
523 struct i2c_client
*client
= fe
->demodulator_priv
;
524 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
526 *ber
= (dev
->post_bit_error
- dev
->post_bit_error_prev
);
527 dev
->post_bit_error_prev
= dev
->post_bit_error
;
532 static int rtl2830_read_ucblocks(struct dvb_frontend
*fe
, u32
*ucblocks
)
539 static int rtl2830_read_signal_strength(struct dvb_frontend
*fe
, u16
*strength
)
541 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
543 if (c
->strength
.stat
[0].scale
== FE_SCALE_RELATIVE
)
544 *strength
= c
->strength
.stat
[0].uvalue
;
551 static const struct dvb_frontend_ops rtl2830_ops
= {
552 .delsys
= {SYS_DVBT
},
554 .name
= "Realtek RTL2830 (DVB-T)",
555 .caps
= FE_CAN_FEC_1_2
|
565 FE_CAN_TRANSMISSION_MODE_AUTO
|
566 FE_CAN_GUARD_INTERVAL_AUTO
|
567 FE_CAN_HIERARCHY_AUTO
|
572 .init
= rtl2830_init
,
573 .sleep
= rtl2830_sleep
,
575 .get_tune_settings
= rtl2830_get_tune_settings
,
577 .set_frontend
= rtl2830_set_frontend
,
578 .get_frontend
= rtl2830_get_frontend
,
580 .read_status
= rtl2830_read_status
,
581 .read_snr
= rtl2830_read_snr
,
582 .read_ber
= rtl2830_read_ber
,
583 .read_ucblocks
= rtl2830_read_ucblocks
,
584 .read_signal_strength
= rtl2830_read_signal_strength
,
587 static int rtl2830_pid_filter_ctrl(struct dvb_frontend
*fe
, int onoff
)
589 struct i2c_client
*client
= fe
->demodulator_priv
;
593 dev_dbg(&client
->dev
, "onoff=%d\n", onoff
);
595 /* enable / disable PID filter */
601 ret
= rtl2830_update_bits(client
, 0x061, 0x80, u8tmp
);
607 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
611 static int rtl2830_pid_filter(struct dvb_frontend
*fe
, u8 index
, u16 pid
, int onoff
)
613 struct i2c_client
*client
= fe
->demodulator_priv
;
614 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
618 dev_dbg(&client
->dev
, "index=%d pid=%04x onoff=%d\n",
621 /* skip invalid PIDs (0x2000) */
622 if (pid
> 0x1fff || index
> 32)
626 set_bit(index
, &dev
->filters
);
628 clear_bit(index
, &dev
->filters
);
630 /* enable / disable PIDs */
631 buf
[0] = (dev
->filters
>> 0) & 0xff;
632 buf
[1] = (dev
->filters
>> 8) & 0xff;
633 buf
[2] = (dev
->filters
>> 16) & 0xff;
634 buf
[3] = (dev
->filters
>> 24) & 0xff;
635 ret
= rtl2830_bulk_write(client
, 0x062, buf
, 4);
640 buf
[0] = (pid
>> 8) & 0xff;
641 buf
[1] = (pid
>> 0) & 0xff;
642 ret
= rtl2830_bulk_write(client
, 0x066 + 2 * index
, buf
, 2);
648 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
653 * I2C gate/mux/repeater logic
654 * We must use unlocked __i2c_transfer() here (through regmap) because of I2C
655 * adapter lock is already taken by tuner driver.
656 * Gate is closed automatically after single I2C transfer.
658 static int rtl2830_select(struct i2c_mux_core
*muxc
, u32 chan_id
)
660 struct i2c_client
*client
= i2c_mux_priv(muxc
);
661 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
664 dev_dbg(&client
->dev
, "\n");
666 /* open I2C repeater for 1 transfer, closes automatically */
667 /* XXX: regmap_update_bits() does not lock I2C adapter */
668 ret
= regmap_update_bits(dev
->regmap
, 0x101, 0x08, 0x08);
674 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
678 static struct dvb_frontend
*rtl2830_get_dvb_frontend(struct i2c_client
*client
)
680 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
682 dev_dbg(&client
->dev
, "\n");
687 static struct i2c_adapter
*rtl2830_get_i2c_adapter(struct i2c_client
*client
)
689 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
691 dev_dbg(&client
->dev
, "\n");
693 return dev
->muxc
->adapter
[0];
697 * We implement own I2C access routines for regmap in order to get manual access
698 * to I2C adapter lock, which is needed for I2C mux adapter.
700 static int rtl2830_regmap_read(void *context
, const void *reg_buf
,
701 size_t reg_size
, void *val_buf
, size_t val_size
)
703 struct i2c_client
*client
= context
;
705 struct i2c_msg msg
[2] = {
707 .addr
= client
->addr
,
710 .buf
= (u8
*)reg_buf
,
712 .addr
= client
->addr
,
719 ret
= __i2c_transfer(client
->adapter
, msg
, 2);
721 dev_warn(&client
->dev
, "i2c reg read failed %d\n", ret
);
729 static int rtl2830_regmap_write(void *context
, const void *data
, size_t count
)
731 struct i2c_client
*client
= context
;
733 struct i2c_msg msg
[1] = {
735 .addr
= client
->addr
,
742 ret
= __i2c_transfer(client
->adapter
, msg
, 1);
744 dev_warn(&client
->dev
, "i2c reg write failed %d\n", ret
);
752 static int rtl2830_regmap_gather_write(void *context
, const void *reg
,
753 size_t reg_len
, const void *val
,
756 struct i2c_client
*client
= context
;
759 struct i2c_msg msg
[1] = {
761 .addr
= client
->addr
,
768 buf
[0] = *(u8
const *)reg
;
769 memcpy(&buf
[1], val
, val_len
);
771 ret
= __i2c_transfer(client
->adapter
, msg
, 1);
773 dev_warn(&client
->dev
, "i2c reg write failed %d\n", ret
);
781 static int rtl2830_probe(struct i2c_client
*client
,
782 const struct i2c_device_id
*id
)
784 struct rtl2830_platform_data
*pdata
= client
->dev
.platform_data
;
785 struct rtl2830_dev
*dev
;
788 static const struct regmap_bus regmap_bus
= {
789 .read
= rtl2830_regmap_read
,
790 .write
= rtl2830_regmap_write
,
791 .gather_write
= rtl2830_regmap_gather_write
,
792 .val_format_endian_default
= REGMAP_ENDIAN_NATIVE
,
794 static const struct regmap_range_cfg regmap_range_cfg
[] = {
796 .selector_reg
= 0x00,
797 .selector_mask
= 0xff,
801 .range_min
= 0 * 0x100,
802 .range_max
= 5 * 0x100,
805 static const struct regmap_config regmap_config
= {
808 .max_register
= 5 * 0x100,
809 .ranges
= regmap_range_cfg
,
810 .num_ranges
= ARRAY_SIZE(regmap_range_cfg
),
813 dev_dbg(&client
->dev
, "\n");
820 /* allocate memory for the internal state */
821 dev
= kzalloc(sizeof(*dev
), GFP_KERNEL
);
827 /* setup the state */
828 i2c_set_clientdata(client
, dev
);
829 dev
->client
= client
;
830 dev
->pdata
= client
->dev
.platform_data
;
831 dev
->sleeping
= true;
832 dev
->regmap
= regmap_init(&client
->dev
, ®map_bus
, client
,
834 if (IS_ERR(dev
->regmap
)) {
835 ret
= PTR_ERR(dev
->regmap
);
839 /* check if the demod is there */
840 ret
= rtl2830_bulk_read(client
, 0x000, &u8tmp
, 1);
842 goto err_regmap_exit
;
844 /* create muxed i2c adapter for tuner */
845 dev
->muxc
= i2c_mux_alloc(client
->adapter
, &client
->dev
, 1, 0, 0,
846 rtl2830_select
, NULL
);
849 goto err_regmap_exit
;
851 dev
->muxc
->priv
= client
;
852 ret
= i2c_mux_add_adapter(dev
->muxc
, 0, 0, 0);
854 goto err_regmap_exit
;
856 /* create dvb frontend */
857 memcpy(&dev
->fe
.ops
, &rtl2830_ops
, sizeof(dev
->fe
.ops
));
858 dev
->fe
.demodulator_priv
= client
;
860 /* setup callbacks */
861 pdata
->get_dvb_frontend
= rtl2830_get_dvb_frontend
;
862 pdata
->get_i2c_adapter
= rtl2830_get_i2c_adapter
;
863 pdata
->pid_filter
= rtl2830_pid_filter
;
864 pdata
->pid_filter_ctrl
= rtl2830_pid_filter_ctrl
;
866 dev_info(&client
->dev
, "Realtek RTL2830 successfully attached\n");
870 regmap_exit(dev
->regmap
);
874 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
878 static int rtl2830_remove(struct i2c_client
*client
)
880 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
882 dev_dbg(&client
->dev
, "\n");
884 i2c_mux_del_adapters(dev
->muxc
);
885 regmap_exit(dev
->regmap
);
891 static const struct i2c_device_id rtl2830_id_table
[] = {
895 MODULE_DEVICE_TABLE(i2c
, rtl2830_id_table
);
897 static struct i2c_driver rtl2830_driver
= {
900 .suppress_bind_attrs
= true,
902 .probe
= rtl2830_probe
,
903 .remove
= rtl2830_remove
,
904 .id_table
= rtl2830_id_table
,
907 module_i2c_driver(rtl2830_driver
);
909 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
910 MODULE_DESCRIPTION("Realtek RTL2830 DVB-T demodulator driver");
911 MODULE_LICENSE("GPL");