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 /* Max transfer size done by I2C transfer functions */
21 #define MAX_XFER_SIZE 64
23 /* write multiple hardware registers */
24 static int rtl2830_wr(struct i2c_client
*client
, u8 reg
, const u8
*val
, int len
)
27 u8 buf
[MAX_XFER_SIZE
];
28 struct i2c_msg msg
[1] = {
37 if (1 + len
> sizeof(buf
)) {
38 dev_warn(&client
->dev
, "i2c wr reg=%04x: len=%d is too big!\n",
44 memcpy(&buf
[1], val
, len
);
46 ret
= i2c_transfer(client
->adapter
, msg
, 1);
50 dev_warn(&client
->dev
, "i2c wr failed=%d reg=%02x len=%d\n",
58 /* read multiple hardware registers */
59 static int rtl2830_rd(struct i2c_client
*client
, u8 reg
, u8
*val
, int len
)
62 struct i2c_msg msg
[2] = {
76 ret
= i2c_transfer(client
->adapter
, msg
, 2);
80 dev_warn(&client
->dev
, "i2c rd failed=%d reg=%02x len=%d\n",
88 /* write multiple registers */
89 static int rtl2830_wr_regs(struct i2c_client
*client
, u16 reg
, const u8
*val
, int len
)
91 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
93 u8 reg2
= (reg
>> 0) & 0xff;
94 u8 page
= (reg
>> 8) & 0xff;
96 /* switch bank if needed */
97 if (page
!= dev
->page
) {
98 ret
= rtl2830_wr(client
, 0x00, &page
, 1);
105 return rtl2830_wr(client
, reg2
, val
, len
);
108 /* read multiple registers */
109 static int rtl2830_rd_regs(struct i2c_client
*client
, u16 reg
, u8
*val
, int len
)
111 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
113 u8 reg2
= (reg
>> 0) & 0xff;
114 u8 page
= (reg
>> 8) & 0xff;
116 /* switch bank if needed */
117 if (page
!= dev
->page
) {
118 ret
= rtl2830_wr(client
, 0x00, &page
, 1);
125 return rtl2830_rd(client
, reg2
, val
, len
);
128 /* read single register */
129 static int rtl2830_rd_reg(struct i2c_client
*client
, u16 reg
, u8
*val
)
131 return rtl2830_rd_regs(client
, reg
, val
, 1);
134 /* write single register with mask */
135 static int rtl2830_wr_reg_mask(struct i2c_client
*client
, u16 reg
, u8 val
, u8 mask
)
140 /* no need for read if whole reg is written */
142 ret
= rtl2830_rd_regs(client
, reg
, &tmp
, 1);
151 return rtl2830_wr_regs(client
, reg
, &val
, 1);
154 /* read single register with mask */
155 static int rtl2830_rd_reg_mask(struct i2c_client
*client
, u16 reg
, u8
*val
, u8 mask
)
160 ret
= rtl2830_rd_regs(client
, reg
, &tmp
, 1);
166 /* find position of the first bit */
167 for (i
= 0; i
< 8; i
++) {
168 if ((mask
>> i
) & 0x01)
176 static int rtl2830_init(struct dvb_frontend
*fe
)
178 struct i2c_client
*client
= fe
->demodulator_priv
;
179 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
180 struct dtv_frontend_properties
*c
= &dev
->fe
.dtv_property_cache
;
182 struct rtl2830_reg_val_mask tab
[] = {
201 {0x106, dev
->pdata
->vtop
, 0x3f},
202 {0x107, dev
->pdata
->krf
, 0x3f},
204 {0x103, dev
->pdata
->agc_targ_val
, 0xff},
212 {0x115, dev
->pdata
->spec_inv
, 0x01},
221 for (i
= 0; i
< ARRAY_SIZE(tab
); i
++) {
222 ret
= rtl2830_wr_reg_mask(client
, tab
[i
].reg
, tab
[i
].val
,
228 ret
= rtl2830_wr_regs(client
, 0x18f, "\x28\x00", 2);
232 ret
= rtl2830_wr_regs(client
, 0x195,
233 "\x04\x06\x0a\x12\x0a\x12\x1e\x28", 8);
237 /* TODO: spec init */
240 ret
= rtl2830_wr_reg_mask(client
, 0x101, 0x04, 0x04);
244 ret
= rtl2830_wr_reg_mask(client
, 0x101, 0x00, 0x04);
248 /* init stats here in order signal app which stats are supported */
250 c
->strength
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
252 c
->cnr
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
253 c
->post_bit_error
.len
= 1;
254 c
->post_bit_error
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
255 c
->post_bit_count
.len
= 1;
256 c
->post_bit_count
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
257 /* start statistics polling */
258 schedule_delayed_work(&dev
->stat_work
, msecs_to_jiffies(2000));
260 dev
->sleeping
= false;
264 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
268 static int rtl2830_sleep(struct dvb_frontend
*fe
)
270 struct i2c_client
*client
= fe
->demodulator_priv
;
271 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
273 dev
->sleeping
= true;
274 /* stop statistics polling */
275 cancel_delayed_work_sync(&dev
->stat_work
);
281 static int rtl2830_get_tune_settings(struct dvb_frontend
*fe
,
282 struct dvb_frontend_tune_settings
*s
)
284 s
->min_delay_ms
= 500;
285 s
->step_size
= fe
->ops
.info
.frequency_stepsize
* 2;
286 s
->max_drift
= (fe
->ops
.info
.frequency_stepsize
* 2) + 1;
291 static int rtl2830_set_frontend(struct dvb_frontend
*fe
)
293 struct i2c_client
*client
= fe
->demodulator_priv
;
294 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
295 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
299 u32 if_ctl
, if_frequency
;
300 static const u8 bw_params1
[3][34] = {
302 0x1f, 0xf0, 0x1f, 0xf0, 0x1f, 0xfa, 0x00, 0x17, 0x00, 0x41,
303 0x00, 0x64, 0x00, 0x67, 0x00, 0x38, 0x1f, 0xde, 0x1f, 0x7a,
304 0x1f, 0x47, 0x1f, 0x7c, 0x00, 0x30, 0x01, 0x4b, 0x02, 0x82,
305 0x03, 0x73, 0x03, 0xcf, /* 6 MHz */
307 0x1f, 0xfa, 0x1f, 0xda, 0x1f, 0xc1, 0x1f, 0xb3, 0x1f, 0xca,
308 0x00, 0x07, 0x00, 0x4d, 0x00, 0x6d, 0x00, 0x40, 0x1f, 0xca,
309 0x1f, 0x4d, 0x1f, 0x2a, 0x1f, 0xb2, 0x00, 0xec, 0x02, 0x7e,
310 0x03, 0xd0, 0x04, 0x53, /* 7 MHz */
312 0x00, 0x10, 0x00, 0x0e, 0x1f, 0xf7, 0x1f, 0xc9, 0x1f, 0xa0,
313 0x1f, 0xa6, 0x1f, 0xec, 0x00, 0x4e, 0x00, 0x7d, 0x00, 0x3a,
314 0x1f, 0x98, 0x1f, 0x10, 0x1f, 0x40, 0x00, 0x75, 0x02, 0x5f,
315 0x04, 0x24, 0x04, 0xdb, /* 8 MHz */
318 static const u8 bw_params2
[3][6] = {
319 {0xc3, 0x0c, 0x44, 0x33, 0x33, 0x30}, /* 6 MHz */
320 {0xb8, 0xe3, 0x93, 0x99, 0x99, 0x98}, /* 7 MHz */
321 {0xae, 0xba, 0xf3, 0x26, 0x66, 0x64}, /* 8 MHz */
324 dev_dbg(&client
->dev
, "frequency=%u bandwidth_hz=%u inversion=%u\n",
325 c
->frequency
, c
->bandwidth_hz
, c
->inversion
);
328 if (fe
->ops
.tuner_ops
.set_params
)
329 fe
->ops
.tuner_ops
.set_params(fe
);
331 switch (c
->bandwidth_hz
) {
342 dev_err(&client
->dev
, "invalid bandwidth_hz %u\n",
347 ret
= rtl2830_wr_reg_mask(client
, 0x008, i
<< 1, 0x06);
351 /* program if frequency */
352 if (fe
->ops
.tuner_ops
.get_if_frequency
)
353 ret
= fe
->ops
.tuner_ops
.get_if_frequency(fe
, &if_frequency
);
359 num
= if_frequency
% dev
->pdata
->clk
;
361 num
= div_u64(num
, dev
->pdata
->clk
);
363 if_ctl
= num
& 0x3fffff;
364 dev_dbg(&client
->dev
, "if_frequency=%d if_ctl=%08x\n",
365 if_frequency
, if_ctl
);
367 ret
= rtl2830_rd_reg_mask(client
, 0x119, &tmp
, 0xc0); /* b[7:6] */
372 buf
[0] |= (if_ctl
>> 16) & 0x3f;
373 buf
[1] = (if_ctl
>> 8) & 0xff;
374 buf
[2] = (if_ctl
>> 0) & 0xff;
376 ret
= rtl2830_wr_regs(client
, 0x119, buf
, 3);
380 /* 1/2 split I2C write */
381 ret
= rtl2830_wr_regs(client
, 0x11c, &bw_params1
[i
][0], 17);
385 /* 2/2 split I2C write */
386 ret
= rtl2830_wr_regs(client
, 0x12d, &bw_params1
[i
][17], 17);
390 ret
= rtl2830_wr_regs(client
, 0x19d, bw_params2
[i
], 6);
396 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
400 static int rtl2830_get_frontend(struct dvb_frontend
*fe
)
402 struct i2c_client
*client
= fe
->demodulator_priv
;
403 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
404 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
411 ret
= rtl2830_rd_regs(client
, 0x33c, buf
, 2);
415 ret
= rtl2830_rd_reg(client
, 0x351, &buf
[2]);
419 dev_dbg(&client
->dev
, "TPS=%*ph\n", 3, buf
);
421 switch ((buf
[0] >> 2) & 3) {
423 c
->modulation
= QPSK
;
426 c
->modulation
= QAM_16
;
429 c
->modulation
= QAM_64
;
433 switch ((buf
[2] >> 2) & 1) {
435 c
->transmission_mode
= TRANSMISSION_MODE_2K
;
438 c
->transmission_mode
= TRANSMISSION_MODE_8K
;
441 switch ((buf
[2] >> 0) & 3) {
443 c
->guard_interval
= GUARD_INTERVAL_1_32
;
446 c
->guard_interval
= GUARD_INTERVAL_1_16
;
449 c
->guard_interval
= GUARD_INTERVAL_1_8
;
452 c
->guard_interval
= GUARD_INTERVAL_1_4
;
456 switch ((buf
[0] >> 4) & 7) {
458 c
->hierarchy
= HIERARCHY_NONE
;
461 c
->hierarchy
= HIERARCHY_1
;
464 c
->hierarchy
= HIERARCHY_2
;
467 c
->hierarchy
= HIERARCHY_4
;
471 switch ((buf
[1] >> 3) & 7) {
473 c
->code_rate_HP
= FEC_1_2
;
476 c
->code_rate_HP
= FEC_2_3
;
479 c
->code_rate_HP
= FEC_3_4
;
482 c
->code_rate_HP
= FEC_5_6
;
485 c
->code_rate_HP
= FEC_7_8
;
489 switch ((buf
[1] >> 0) & 7) {
491 c
->code_rate_LP
= FEC_1_2
;
494 c
->code_rate_LP
= FEC_2_3
;
497 c
->code_rate_LP
= FEC_3_4
;
500 c
->code_rate_LP
= FEC_5_6
;
503 c
->code_rate_LP
= FEC_7_8
;
509 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
513 static int rtl2830_read_status(struct dvb_frontend
*fe
, fe_status_t
*status
)
515 struct i2c_client
*client
= fe
->demodulator_priv
;
516 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
525 ret
= rtl2830_rd_reg_mask(client
, 0x351, &tmp
, 0x78); /* [6:3] */
530 *status
|= FE_HAS_SIGNAL
| FE_HAS_CARRIER
|
531 FE_HAS_VITERBI
| FE_HAS_SYNC
| FE_HAS_LOCK
;
532 } else if (tmp
== 10) {
533 *status
|= FE_HAS_SIGNAL
| FE_HAS_CARRIER
|
537 dev
->fe_status
= *status
;
541 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
545 static int rtl2830_read_snr(struct dvb_frontend
*fe
, u16
*snr
)
547 struct i2c_client
*client
= fe
->demodulator_priv
;
548 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
549 int ret
, hierarchy
, constellation
;
552 #define CONSTELLATION_NUM 3
553 #define HIERARCHY_NUM 4
554 static const u32 snr_constant
[CONSTELLATION_NUM
][HIERARCHY_NUM
] = {
555 {70705899, 70705899, 70705899, 70705899},
556 {82433173, 82433173, 87483115, 94445660},
557 {92888734, 92888734, 95487525, 99770748},
563 /* reports SNR in resolution of 0.1 dB */
565 ret
= rtl2830_rd_reg(client
, 0x33c, &tmp
);
569 constellation
= (tmp
>> 2) & 0x03; /* [3:2] */
570 if (constellation
> CONSTELLATION_NUM
- 1)
573 hierarchy
= (tmp
>> 4) & 0x07; /* [6:4] */
574 if (hierarchy
> HIERARCHY_NUM
- 1)
577 ret
= rtl2830_rd_regs(client
, 0x40c, buf
, 2);
581 tmp16
= buf
[0] << 8 | buf
[1];
584 *snr
= (snr_constant
[constellation
][hierarchy
] -
585 intlog10(tmp16
)) / ((1 << 24) / 100);
591 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
595 static int rtl2830_read_ber(struct dvb_frontend
*fe
, u32
*ber
)
597 struct i2c_client
*client
= fe
->demodulator_priv
;
598 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
605 ret
= rtl2830_rd_regs(client
, 0x34e, buf
, 2);
609 *ber
= buf
[0] << 8 | buf
[1];
613 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
617 static int rtl2830_read_ucblocks(struct dvb_frontend
*fe
, u32
*ucblocks
)
624 static int rtl2830_read_signal_strength(struct dvb_frontend
*fe
, u16
*strength
)
626 struct i2c_client
*client
= fe
->demodulator_priv
;
627 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
630 u16 if_agc_raw
, if_agc
;
635 ret
= rtl2830_rd_regs(client
, 0x359, buf
, 2);
639 if_agc_raw
= (buf
[0] << 8 | buf
[1]) & 0x3fff;
641 if (if_agc_raw
& (1 << 9))
642 if_agc
= -(~(if_agc_raw
- 1) & 0x1ff);
646 *strength
= (u8
)(55 - if_agc
/ 182);
647 *strength
|= *strength
<< 8;
651 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
655 static struct dvb_frontend_ops rtl2830_ops
= {
656 .delsys
= {SYS_DVBT
},
658 .name
= "Realtek RTL2830 (DVB-T)",
659 .caps
= FE_CAN_FEC_1_2
|
669 FE_CAN_TRANSMISSION_MODE_AUTO
|
670 FE_CAN_GUARD_INTERVAL_AUTO
|
671 FE_CAN_HIERARCHY_AUTO
|
676 .init
= rtl2830_init
,
677 .sleep
= rtl2830_sleep
,
679 .get_tune_settings
= rtl2830_get_tune_settings
,
681 .set_frontend
= rtl2830_set_frontend
,
682 .get_frontend
= rtl2830_get_frontend
,
684 .read_status
= rtl2830_read_status
,
685 .read_snr
= rtl2830_read_snr
,
686 .read_ber
= rtl2830_read_ber
,
687 .read_ucblocks
= rtl2830_read_ucblocks
,
688 .read_signal_strength
= rtl2830_read_signal_strength
,
691 static void rtl2830_stat_work(struct work_struct
*work
)
693 struct rtl2830_dev
*dev
= container_of(work
, struct rtl2830_dev
, stat_work
.work
);
694 struct i2c_client
*client
= dev
->client
;
695 struct dtv_frontend_properties
*c
= &dev
->fe
.dtv_property_cache
;
700 dev_dbg(&client
->dev
, "\n");
702 /* signal strength */
703 if (dev
->fe_status
& FE_HAS_SIGNAL
) {
704 struct {signed int x
:14; } s
;
707 ret
= rtl2830_rd_regs(client
, 0x359, buf
, 2);
711 u16tmp
= buf
[0] << 8 | buf
[1] << 0;
712 u16tmp
&= 0x3fff; /* [13:0] */
713 tmp
= s
.x
= u16tmp
; /* 14-bit bin to 2 complement */
714 u16tmp
= clamp_val(-4 * tmp
+ 32767, 0x0000, 0xffff);
716 dev_dbg(&client
->dev
, "IF AGC=%d\n", tmp
);
718 c
->strength
.stat
[0].scale
= FE_SCALE_RELATIVE
;
719 c
->strength
.stat
[0].uvalue
= u16tmp
;
721 c
->strength
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
725 if (dev
->fe_status
& FE_HAS_VITERBI
) {
726 unsigned hierarchy
, constellation
;
727 #define CONSTELLATION_NUM 3
728 #define HIERARCHY_NUM 4
729 static const u32 constant
[CONSTELLATION_NUM
][HIERARCHY_NUM
] = {
730 {70705899, 70705899, 70705899, 70705899},
731 {82433173, 82433173, 87483115, 94445660},
732 {92888734, 92888734, 95487525, 99770748},
735 ret
= rtl2830_rd_reg(client
, 0x33c, &u8tmp
);
739 constellation
= (u8tmp
>> 2) & 0x03; /* [3:2] */
740 if (constellation
> CONSTELLATION_NUM
- 1)
741 goto err_schedule_delayed_work
;
743 hierarchy
= (u8tmp
>> 4) & 0x07; /* [6:4] */
744 if (hierarchy
> HIERARCHY_NUM
- 1)
745 goto err_schedule_delayed_work
;
747 ret
= rtl2830_rd_regs(client
, 0x40c, buf
, 2);
751 u16tmp
= buf
[0] << 8 | buf
[1] << 0;
753 tmp
= (constant
[constellation
][hierarchy
] -
754 intlog10(u16tmp
)) / ((1 << 24) / 10000);
758 dev_dbg(&client
->dev
, "CNR raw=%u\n", u16tmp
);
760 c
->cnr
.stat
[0].scale
= FE_SCALE_DECIBEL
;
761 c
->cnr
.stat
[0].svalue
= tmp
;
763 c
->cnr
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
767 if (dev
->fe_status
& FE_HAS_LOCK
) {
768 ret
= rtl2830_rd_regs(client
, 0x34e, buf
, 2);
772 u16tmp
= buf
[0] << 8 | buf
[1] << 0;
773 dev
->post_bit_error
+= u16tmp
;
774 dev
->post_bit_count
+= 1000000;
776 dev_dbg(&client
->dev
, "BER errors=%u total=1000000\n", u16tmp
);
778 c
->post_bit_error
.stat
[0].scale
= FE_SCALE_COUNTER
;
779 c
->post_bit_error
.stat
[0].uvalue
= dev
->post_bit_error
;
780 c
->post_bit_count
.stat
[0].scale
= FE_SCALE_COUNTER
;
781 c
->post_bit_count
.stat
[0].uvalue
= dev
->post_bit_count
;
783 c
->post_bit_error
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
784 c
->post_bit_count
.stat
[0].scale
= FE_SCALE_NOT_AVAILABLE
;
787 err_schedule_delayed_work
:
788 schedule_delayed_work(&dev
->stat_work
, msecs_to_jiffies(2000));
791 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
795 * I2C gate/repeater logic
796 * We must use unlocked i2c_transfer() here because I2C lock is already taken
797 * by tuner driver. Gate is closed automatically after single I2C xfer.
799 static int rtl2830_select(struct i2c_adapter
*adap
, void *mux_priv
, u32 chan_id
)
801 struct i2c_client
*client
= mux_priv
;
802 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
803 struct i2c_msg select_reg_page_msg
[1] = {
805 .addr
= client
->addr
,
811 struct i2c_msg gate_open_msg
[1] = {
813 .addr
= client
->addr
,
821 /* select register page */
822 ret
= __i2c_transfer(client
->adapter
, select_reg_page_msg
, 1);
824 dev_warn(&client
->dev
, "i2c write failed %d\n", ret
);
832 /* open tuner I2C repeater for 1 xfer, closes automatically */
833 ret
= __i2c_transfer(client
->adapter
, gate_open_msg
, 1);
835 dev_warn(&client
->dev
, "i2c write failed %d\n", ret
);
843 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
847 static struct dvb_frontend
*rtl2830_get_dvb_frontend(struct i2c_client
*client
)
849 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
851 dev_dbg(&client
->dev
, "\n");
856 static struct i2c_adapter
*rtl2830_get_i2c_adapter(struct i2c_client
*client
)
858 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
860 dev_dbg(&client
->dev
, "\n");
865 static int rtl2830_probe(struct i2c_client
*client
,
866 const struct i2c_device_id
*id
)
868 struct rtl2830_platform_data
*pdata
= client
->dev
.platform_data
;
869 struct rtl2830_dev
*dev
;
873 dev_dbg(&client
->dev
, "\n");
880 /* allocate memory for the internal state */
881 dev
= kzalloc(sizeof(*dev
), GFP_KERNEL
);
887 /* setup the state */
888 i2c_set_clientdata(client
, dev
);
889 dev
->client
= client
;
890 dev
->pdata
= client
->dev
.platform_data
;
891 dev
->sleeping
= true;
892 INIT_DELAYED_WORK(&dev
->stat_work
, rtl2830_stat_work
);
894 /* check if the demod is there */
895 ret
= rtl2830_rd_reg(client
, 0x000, &u8tmp
);
899 /* create muxed i2c adapter for tuner */
900 dev
->adapter
= i2c_add_mux_adapter(client
->adapter
, &client
->dev
,
901 client
, 0, 0, 0, rtl2830_select
, NULL
);
902 if (dev
->adapter
== NULL
) {
907 /* create dvb frontend */
908 memcpy(&dev
->fe
.ops
, &rtl2830_ops
, sizeof(dev
->fe
.ops
));
909 dev
->fe
.demodulator_priv
= client
;
911 /* setup callbacks */
912 pdata
->get_dvb_frontend
= rtl2830_get_dvb_frontend
;
913 pdata
->get_i2c_adapter
= rtl2830_get_i2c_adapter
;
915 dev_info(&client
->dev
, "Realtek RTL2830 successfully attached\n");
921 dev_dbg(&client
->dev
, "failed=%d\n", ret
);
925 static int rtl2830_remove(struct i2c_client
*client
)
927 struct rtl2830_dev
*dev
= i2c_get_clientdata(client
);
929 dev_dbg(&client
->dev
, "\n");
931 i2c_del_mux_adapter(dev
->adapter
);
937 static const struct i2c_device_id rtl2830_id_table
[] = {
941 MODULE_DEVICE_TABLE(i2c
, rtl2830_id_table
);
943 static struct i2c_driver rtl2830_driver
= {
945 .owner
= THIS_MODULE
,
948 .probe
= rtl2830_probe
,
949 .remove
= rtl2830_remove
,
950 .id_table
= rtl2830_id_table
,
953 module_i2c_driver(rtl2830_driver
);
955 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
956 MODULE_DESCRIPTION("Realtek RTL2830 DVB-T demodulator driver");
957 MODULE_LICENSE("GPL");