2 * Realtek RTL28xxU DVB USB driver
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
5 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
6 * Copyright (C) 2012 Thomas Mair <thomas.mair86@googlemail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "rtl2832_sdr.h"
39 static int rtl28xxu_disable_rc;
40 module_param_named(disable_rc, rtl28xxu_disable_rc, int, 0644);
41 MODULE_PARM_DESC(disable_rc, "disable RTL2832U remote controller");
42 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
44 static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req)
51 buf = kmalloc(req->size, GFP_KERNEL);
57 if (req->index & CMD_WR_FLAG) {
59 memcpy(buf, req->data, req->size);
60 requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT);
61 pipe = usb_sndctrlpipe(d->udev, 0);
64 requesttype = (USB_TYPE_VENDOR | USB_DIR_IN);
65 pipe = usb_rcvctrlpipe(d->udev, 0);
68 ret = usb_control_msg(d->udev, pipe, 0, requesttype, req->value,
69 req->index, buf, req->size, 1000);
71 dvb_usb_dbg_usb_control_msg(d->udev, 0, requesttype, req->value,
72 req->index, buf, req->size);
77 /* read request, copy returned data to return buf */
78 if (!ret && requesttype == (USB_TYPE_VENDOR | USB_DIR_IN))
79 memcpy(req->data, buf, req->size);
88 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
92 static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
94 struct rtl28xxu_req req;
97 req.index = CMD_USB_WR;
98 else if (reg < 0x4000)
99 req.index = CMD_SYS_WR;
101 req.index = CMD_IR_WR;
107 return rtl28xxu_ctrl_msg(d, &req);
110 static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
112 struct rtl28xxu_req req;
115 req.index = CMD_USB_RD;
116 else if (reg < 0x4000)
117 req.index = CMD_SYS_RD;
119 req.index = CMD_IR_RD;
125 return rtl28xxu_ctrl_msg(d, &req);
128 static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
130 return rtl28xx_wr_regs(d, reg, &val, 1);
133 static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
135 return rtl2831_rd_regs(d, reg, val, 1);
138 static int rtl28xx_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,
144 /* no need for read if whole reg is written */
146 ret = rtl28xx_rd_reg(d, reg, &tmp);
155 return rtl28xx_wr_reg(d, reg, val);
159 static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
163 struct dvb_usb_device *d = i2c_get_adapdata(adap);
164 struct rtl28xxu_priv *priv = d->priv;
165 struct rtl28xxu_req req;
168 * It is not known which are real I2C bus xfer limits, but testing
169 * with RTL2831U + MT2060 gives max RD 24 and max WR 22 bytes.
170 * TODO: find out RTL2832U lens
174 * I2C adapter logic looks rather complicated due to fact it handles
175 * three different access methods. Those methods are;
176 * 1) integrated demod access
180 * Used method is selected in order 1, 2, 3. Method 3 can handle all
181 * requests but there is two reasons why not use it always;
182 * 1) It is most expensive, usually two USB messages are needed
183 * 2) At least RTL2831U does not support it
185 * Method 3 is needed in case of I2C write+read (typical register read)
186 * where write is more than one byte.
189 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
192 if (num == 2 && !(msg[0].flags & I2C_M_RD) &&
193 (msg[1].flags & I2C_M_RD)) {
194 if (msg[0].len > 24 || msg[1].len > 24) {
195 /* TODO: check msg[0].len max */
197 goto err_mutex_unlock;
198 } else if (msg[0].addr == 0x10) {
199 /* method 1 - integrated demod */
200 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
201 req.index = CMD_DEMOD_RD | priv->page;
202 req.size = msg[1].len;
203 req.data = &msg[1].buf[0];
204 ret = rtl28xxu_ctrl_msg(d, &req);
205 } else if (msg[0].len < 2) {
206 /* method 2 - old I2C */
207 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
208 req.index = CMD_I2C_RD;
209 req.size = msg[1].len;
210 req.data = &msg[1].buf[0];
211 ret = rtl28xxu_ctrl_msg(d, &req);
213 /* method 3 - new I2C */
214 req.value = (msg[0].addr << 1);
215 req.index = CMD_I2C_DA_WR;
216 req.size = msg[0].len;
217 req.data = msg[0].buf;
218 ret = rtl28xxu_ctrl_msg(d, &req);
220 goto err_mutex_unlock;
222 req.value = (msg[0].addr << 1);
223 req.index = CMD_I2C_DA_RD;
224 req.size = msg[1].len;
225 req.data = msg[1].buf;
226 ret = rtl28xxu_ctrl_msg(d, &req);
228 } else if (num == 1 && !(msg[0].flags & I2C_M_RD)) {
229 if (msg[0].len > 22) {
230 /* TODO: check msg[0].len max */
232 goto err_mutex_unlock;
233 } else if (msg[0].addr == 0x10) {
234 /* method 1 - integrated demod */
235 if (msg[0].buf[0] == 0x00) {
236 /* save demod page for later demod access */
237 priv->page = msg[0].buf[1];
240 req.value = (msg[0].buf[0] << 8) |
242 req.index = CMD_DEMOD_WR | priv->page;
243 req.size = msg[0].len-1;
244 req.data = &msg[0].buf[1];
245 ret = rtl28xxu_ctrl_msg(d, &req);
247 } else if (msg[0].len < 23) {
248 /* method 2 - old I2C */
249 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
250 req.index = CMD_I2C_WR;
251 req.size = msg[0].len-1;
252 req.data = &msg[0].buf[1];
253 ret = rtl28xxu_ctrl_msg(d, &req);
255 /* method 3 - new I2C */
256 req.value = (msg[0].addr << 1);
257 req.index = CMD_I2C_DA_WR;
258 req.size = msg[0].len;
259 req.data = msg[0].buf;
260 ret = rtl28xxu_ctrl_msg(d, &req);
267 mutex_unlock(&d->i2c_mutex);
269 return ret ? ret : num;
272 static u32 rtl28xxu_i2c_func(struct i2c_adapter *adapter)
277 static struct i2c_algorithm rtl28xxu_i2c_algo = {
278 .master_xfer = rtl28xxu_i2c_xfer,
279 .functionality = rtl28xxu_i2c_func,
282 static int rtl2831u_read_config(struct dvb_usb_device *d)
284 struct rtl28xxu_priv *priv = d_to_priv(d);
287 /* open RTL2831U/RTL2830 I2C gate */
288 struct rtl28xxu_req req_gate_open = {0x0120, 0x0011, 0x0001, "\x08"};
290 struct rtl28xxu_req req_mt2060 = {0x00c0, CMD_I2C_RD, 1, buf};
291 struct rtl28xxu_req req_qt1010 = {0x0fc4, CMD_I2C_RD, 1, buf};
293 dev_dbg(&d->udev->dev, "%s:\n", __func__);
297 * =========================================================
298 * GPIO0 | tuner#0 | 0 off | 1 on | MXL5005S (?)
299 * GPIO2 | LED | 0 off | 1 on |
300 * GPIO4 | tuner#1 | 0 on | 1 off | MT2060
304 ret = rtl28xx_wr_reg(d, SYS_GPIO_DIR, 0x0a);
308 /* enable as output GPIO0, GPIO2, GPIO4 */
309 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_EN, 0x15);
314 * Probe used tuner. We need to know used tuner before demod attach
315 * since there is some demod params needed to set according to tuner.
318 /* demod needs some time to wake up */
321 priv->tuner_name = "NONE";
323 /* open demod I2C gate */
324 ret = rtl28xxu_ctrl_msg(d, &req_gate_open);
328 /* check QT1010 ID(?) register; reg=0f val=2c */
329 ret = rtl28xxu_ctrl_msg(d, &req_qt1010);
330 if (ret == 0 && buf[0] == 0x2c) {
331 priv->tuner = TUNER_RTL2830_QT1010;
332 priv->tuner_name = "QT1010";
336 /* open demod I2C gate */
337 ret = rtl28xxu_ctrl_msg(d, &req_gate_open);
341 /* check MT2060 ID register; reg=00 val=63 */
342 ret = rtl28xxu_ctrl_msg(d, &req_mt2060);
343 if (ret == 0 && buf[0] == 0x63) {
344 priv->tuner = TUNER_RTL2830_MT2060;
345 priv->tuner_name = "MT2060";
349 /* assume MXL5005S */
350 priv->tuner = TUNER_RTL2830_MXL5005S;
351 priv->tuner_name = "MXL5005S";
355 dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name);
359 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
363 static int rtl2832u_read_config(struct dvb_usb_device *d)
365 struct rtl28xxu_priv *priv = d_to_priv(d);
368 /* open RTL2832U/RTL2832 I2C gate */
369 struct rtl28xxu_req req_gate_open = {0x0120, 0x0011, 0x0001, "\x18"};
370 /* close RTL2832U/RTL2832 I2C gate */
371 struct rtl28xxu_req req_gate_close = {0x0120, 0x0011, 0x0001, "\x10"};
373 struct rtl28xxu_req req_fc0012 = {0x00c6, CMD_I2C_RD, 1, buf};
374 struct rtl28xxu_req req_fc0013 = {0x00c6, CMD_I2C_RD, 1, buf};
375 struct rtl28xxu_req req_mt2266 = {0x00c0, CMD_I2C_RD, 1, buf};
376 struct rtl28xxu_req req_fc2580 = {0x01ac, CMD_I2C_RD, 1, buf};
377 struct rtl28xxu_req req_mt2063 = {0x00c0, CMD_I2C_RD, 1, buf};
378 struct rtl28xxu_req req_max3543 = {0x00c0, CMD_I2C_RD, 1, buf};
379 struct rtl28xxu_req req_tua9001 = {0x7ec0, CMD_I2C_RD, 2, buf};
380 struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf};
381 struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf};
382 struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf};
383 struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
384 struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
386 dev_dbg(&d->udev->dev, "%s:\n", __func__);
388 /* enable GPIO3 and GPIO6 as output */
389 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x40);
393 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x48, 0x48);
398 * Probe used tuner. We need to know used tuner before demod attach
399 * since there is some demod params needed to set according to tuner.
402 /* open demod I2C gate */
403 ret = rtl28xxu_ctrl_msg(d, &req_gate_open);
407 priv->tuner_name = "NONE";
409 /* check FC0012 ID register; reg=00 val=a1 */
410 ret = rtl28xxu_ctrl_msg(d, &req_fc0012);
411 if (ret == 0 && buf[0] == 0xa1) {
412 priv->tuner = TUNER_RTL2832_FC0012;
413 priv->tuner_name = "FC0012";
417 /* check FC0013 ID register; reg=00 val=a3 */
418 ret = rtl28xxu_ctrl_msg(d, &req_fc0013);
419 if (ret == 0 && buf[0] == 0xa3) {
420 priv->tuner = TUNER_RTL2832_FC0013;
421 priv->tuner_name = "FC0013";
425 /* check MT2266 ID register; reg=00 val=85 */
426 ret = rtl28xxu_ctrl_msg(d, &req_mt2266);
427 if (ret == 0 && buf[0] == 0x85) {
428 priv->tuner = TUNER_RTL2832_MT2266;
429 priv->tuner_name = "MT2266";
433 /* check FC2580 ID register; reg=01 val=56 */
434 ret = rtl28xxu_ctrl_msg(d, &req_fc2580);
435 if (ret == 0 && buf[0] == 0x56) {
436 priv->tuner = TUNER_RTL2832_FC2580;
437 priv->tuner_name = "FC2580";
441 /* check MT2063 ID register; reg=00 val=9e || 9c */
442 ret = rtl28xxu_ctrl_msg(d, &req_mt2063);
443 if (ret == 0 && (buf[0] == 0x9e || buf[0] == 0x9c)) {
444 priv->tuner = TUNER_RTL2832_MT2063;
445 priv->tuner_name = "MT2063";
449 /* check MAX3543 ID register; reg=00 val=38 */
450 ret = rtl28xxu_ctrl_msg(d, &req_max3543);
451 if (ret == 0 && buf[0] == 0x38) {
452 priv->tuner = TUNER_RTL2832_MAX3543;
453 priv->tuner_name = "MAX3543";
457 /* check TUA9001 ID register; reg=7e val=2328 */
458 ret = rtl28xxu_ctrl_msg(d, &req_tua9001);
459 if (ret == 0 && buf[0] == 0x23 && buf[1] == 0x28) {
460 priv->tuner = TUNER_RTL2832_TUA9001;
461 priv->tuner_name = "TUA9001";
465 /* check MXL5007R ID register; reg=d9 val=14 */
466 ret = rtl28xxu_ctrl_msg(d, &req_mxl5007t);
467 if (ret == 0 && buf[0] == 0x14) {
468 priv->tuner = TUNER_RTL2832_MXL5007T;
469 priv->tuner_name = "MXL5007T";
473 /* check E4000 ID register; reg=02 val=40 */
474 ret = rtl28xxu_ctrl_msg(d, &req_e4000);
475 if (ret == 0 && buf[0] == 0x40) {
476 priv->tuner = TUNER_RTL2832_E4000;
477 priv->tuner_name = "E4000";
481 /* check TDA18272 ID register; reg=00 val=c760 */
482 ret = rtl28xxu_ctrl_msg(d, &req_tda18272);
483 if (ret == 0 && (buf[0] == 0xc7 || buf[1] == 0x60)) {
484 priv->tuner = TUNER_RTL2832_TDA18272;
485 priv->tuner_name = "TDA18272";
489 /* check R820T ID register; reg=00 val=69 */
490 ret = rtl28xxu_ctrl_msg(d, &req_r820t);
491 if (ret == 0 && buf[0] == 0x69) {
492 priv->tuner = TUNER_RTL2832_R820T;
493 priv->tuner_name = "R820T";
497 /* check R828D ID register; reg=00 val=69 */
498 ret = rtl28xxu_ctrl_msg(d, &req_r828d);
499 if (ret == 0 && buf[0] == 0x69) {
500 priv->tuner = TUNER_RTL2832_R828D;
501 priv->tuner_name = "R828D";
507 dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name);
509 /* close demod I2C gate */
510 ret = rtl28xxu_ctrl_msg(d, &req_gate_close);
516 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
520 static const struct rtl2830_config rtl28xxu_rtl2830_mt2060_config = {
521 .i2c_addr = 0x10, /* 0x20 */
527 .agc_targ_val = 0x2d,
531 static const struct rtl2830_config rtl28xxu_rtl2830_qt1010_config = {
532 .i2c_addr = 0x10, /* 0x20 */
538 .agc_targ_val = 0x2d,
541 static const struct rtl2830_config rtl28xxu_rtl2830_mxl5005s_config = {
542 .i2c_addr = 0x10, /* 0x20 */
548 .agc_targ_val = 0x3e,
551 static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap)
553 struct dvb_usb_device *d = adap_to_d(adap);
554 struct rtl28xxu_priv *priv = d_to_priv(d);
555 const struct rtl2830_config *rtl2830_config;
558 dev_dbg(&d->udev->dev, "%s:\n", __func__);
560 switch (priv->tuner) {
561 case TUNER_RTL2830_QT1010:
562 rtl2830_config = &rtl28xxu_rtl2830_qt1010_config;
564 case TUNER_RTL2830_MT2060:
565 rtl2830_config = &rtl28xxu_rtl2830_mt2060_config;
567 case TUNER_RTL2830_MXL5005S:
568 rtl2830_config = &rtl28xxu_rtl2830_mxl5005s_config;
571 dev_err(&d->udev->dev, "%s: unknown tuner=%s\n",
572 KBUILD_MODNAME, priv->tuner_name);
577 /* attach demodulator */
578 adap->fe[0] = dvb_attach(rtl2830_attach, rtl2830_config, &d->i2c_adap);
586 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
590 static const struct rtl2832_config rtl28xxu_rtl2832_fc0012_config = {
591 .i2c_addr = 0x10, /* 0x20 */
593 .tuner = TUNER_RTL2832_FC0012
596 static const struct rtl2832_config rtl28xxu_rtl2832_fc0013_config = {
597 .i2c_addr = 0x10, /* 0x20 */
599 .tuner = TUNER_RTL2832_FC0013
602 static const struct rtl2832_config rtl28xxu_rtl2832_tua9001_config = {
603 .i2c_addr = 0x10, /* 0x20 */
605 .tuner = TUNER_RTL2832_TUA9001,
608 static const struct rtl2832_config rtl28xxu_rtl2832_e4000_config = {
609 .i2c_addr = 0x10, /* 0x20 */
611 .tuner = TUNER_RTL2832_E4000,
614 static const struct rtl2832_config rtl28xxu_rtl2832_r820t_config = {
617 .tuner = TUNER_RTL2832_R820T,
620 static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
626 dev_dbg(&d->udev->dev, "%s: cmd=%d arg=%d\n", __func__, cmd, arg);
629 case FC_FE_CALLBACK_VHF_ENABLE:
630 /* set output values */
631 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
636 val &= 0xbf; /* set GPIO6 low */
638 val |= 0x40; /* set GPIO6 high */
641 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
651 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
655 static int rtl2832u_tua9001_tuner_callback(struct dvb_usb_device *d,
661 dev_dbg(&d->udev->dev, "%s: cmd=%d arg=%d\n", __func__, cmd, arg);
664 * CEN always enabled by hardware wiring
670 case TUA9001_CMD_RESETN:
676 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x10);
680 case TUA9001_CMD_RXEN:
686 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x02);
694 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
698 static int rtl2832u_tuner_callback(struct dvb_usb_device *d, int cmd, int arg)
700 struct rtl28xxu_priv *priv = d->priv;
702 switch (priv->tuner) {
703 case TUNER_RTL2832_FC0012:
704 return rtl2832u_fc0012_tuner_callback(d, cmd, arg);
705 case TUNER_RTL2832_TUA9001:
706 return rtl2832u_tua9001_tuner_callback(d, cmd, arg);
714 static int rtl2832u_frontend_callback(void *adapter_priv, int component,
717 struct i2c_adapter *adap = adapter_priv;
718 struct dvb_usb_device *d = i2c_get_adapdata(adap);
720 dev_dbg(&d->udev->dev, "%s: component=%d cmd=%d arg=%d\n",
721 __func__, component, cmd, arg);
724 case DVB_FRONTEND_COMPONENT_TUNER:
725 return rtl2832u_tuner_callback(d, cmd, arg);
733 static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
736 struct dvb_usb_device *d = adap_to_d(adap);
737 struct rtl28xxu_priv *priv = d_to_priv(d);
738 const struct rtl2832_config *rtl2832_config;
740 dev_dbg(&d->udev->dev, "%s:\n", __func__);
742 switch (priv->tuner) {
743 case TUNER_RTL2832_FC0012:
744 rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
746 case TUNER_RTL2832_FC0013:
747 rtl2832_config = &rtl28xxu_rtl2832_fc0013_config;
749 case TUNER_RTL2832_FC2580:
750 /* FIXME: do not abuse fc0012 settings */
751 rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
753 case TUNER_RTL2832_TUA9001:
754 rtl2832_config = &rtl28xxu_rtl2832_tua9001_config;
756 case TUNER_RTL2832_E4000:
757 rtl2832_config = &rtl28xxu_rtl2832_e4000_config;
759 case TUNER_RTL2832_R820T:
760 case TUNER_RTL2832_R828D:
761 rtl2832_config = &rtl28xxu_rtl2832_r820t_config;
764 dev_err(&d->udev->dev, "%s: unknown tuner=%s\n",
765 KBUILD_MODNAME, priv->tuner_name);
770 /* attach demodulator */
771 adap->fe[0] = dvb_attach(rtl2832_attach, rtl2832_config, &d->i2c_adap);
777 /* RTL2832 I2C repeater */
778 priv->demod_i2c_adapter = rtl2832_get_i2c_adapter(adap->fe[0]);
780 /* set fe callback */
781 adap->fe[0]->callback = rtl2832u_frontend_callback;
785 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
789 static struct qt1010_config rtl28xxu_qt1010_config = {
790 .i2c_address = 0x62, /* 0xc4 */
793 static struct mt2060_config rtl28xxu_mt2060_config = {
794 .i2c_address = 0x60, /* 0xc0 */
798 static struct mxl5005s_config rtl28xxu_mxl5005s_config = {
799 .i2c_address = 0x63, /* 0xc6 */
800 .if_freq = IF_FREQ_4570000HZ,
801 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
802 .agc_mode = MXL_SINGLE_AGC,
803 .tracking_filter = MXL_TF_C_H,
804 .rssi_enable = MXL_RSSI_ENABLE,
805 .cap_select = MXL_CAP_SEL_ENABLE,
806 .div_out = MXL_DIV_OUT_4,
807 .clock_out = MXL_CLOCK_OUT_DISABLE,
808 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
809 .top = MXL5005S_TOP_25P2,
810 .mod_mode = MXL_DIGITAL_MODE,
811 .if_mode = MXL_ZERO_IF,
812 .AgcMasterByte = 0x00,
815 static int rtl2831u_tuner_attach(struct dvb_usb_adapter *adap)
818 struct dvb_usb_device *d = adap_to_d(adap);
819 struct rtl28xxu_priv *priv = d_to_priv(d);
820 struct i2c_adapter *rtl2830_tuner_i2c;
821 struct dvb_frontend *fe;
823 dev_dbg(&d->udev->dev, "%s:\n", __func__);
825 /* use rtl2830 driver I2C adapter, for more info see rtl2830 driver */
826 rtl2830_tuner_i2c = rtl2830_get_tuner_i2c_adapter(adap->fe[0]);
828 switch (priv->tuner) {
829 case TUNER_RTL2830_QT1010:
830 fe = dvb_attach(qt1010_attach, adap->fe[0],
831 rtl2830_tuner_i2c, &rtl28xxu_qt1010_config);
833 case TUNER_RTL2830_MT2060:
834 fe = dvb_attach(mt2060_attach, adap->fe[0],
835 rtl2830_tuner_i2c, &rtl28xxu_mt2060_config,
838 case TUNER_RTL2830_MXL5005S:
839 fe = dvb_attach(mxl5005s_attach, adap->fe[0],
840 rtl2830_tuner_i2c, &rtl28xxu_mxl5005s_config);
844 dev_err(&d->udev->dev, "%s: unknown tuner=%d\n", KBUILD_MODNAME,
855 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
859 static const struct fc2580_config rtl2832u_fc2580_config = {
864 static struct tua9001_config rtl2832u_tua9001_config = {
868 static const struct fc0012_config rtl2832u_fc0012_config = {
869 .i2c_address = 0x63, /* 0xc6 >> 1 */
870 .xtal_freq = FC_XTAL_28_8_MHZ,
873 static const struct r820t_config rtl2832u_r820t_config = {
876 .max_i2c_msg_len = 2,
877 .rafael_chip = CHIP_R820T,
880 static const struct r820t_config rtl2832u_r828d_config = {
883 .max_i2c_msg_len = 2,
884 .rafael_chip = CHIP_R828D,
887 static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
890 struct dvb_usb_device *d = adap_to_d(adap);
891 struct rtl28xxu_priv *priv = d_to_priv(d);
892 struct dvb_frontend *fe = NULL;
893 struct i2c_board_info info;
894 struct i2c_client *client;
896 dev_dbg(&d->udev->dev, "%s:\n", __func__);
898 memset(&info, 0, sizeof(struct i2c_board_info));
900 switch (priv->tuner) {
901 case TUNER_RTL2832_FC0012:
902 fe = dvb_attach(fc0012_attach, adap->fe[0],
903 &d->i2c_adap, &rtl2832u_fc0012_config);
905 /* since fc0012 includs reading the signal strength delegate
906 * that to the tuner driver */
907 adap->fe[0]->ops.read_signal_strength =
908 adap->fe[0]->ops.tuner_ops.get_rf_strength;
911 dvb_attach(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap,
912 &rtl28xxu_rtl2832_fc0012_config, NULL);
914 case TUNER_RTL2832_FC0013:
915 fe = dvb_attach(fc0013_attach, adap->fe[0],
916 &d->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
918 /* fc0013 also supports signal strength reading */
919 adap->fe[0]->ops.read_signal_strength =
920 adap->fe[0]->ops.tuner_ops.get_rf_strength;
923 dvb_attach(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap,
924 &rtl28xxu_rtl2832_fc0013_config, NULL);
926 case TUNER_RTL2832_E4000: {
927 struct v4l2_subdev *sd;
928 struct i2c_adapter *i2c_adap_internal =
929 rtl2832_get_private_i2c_adapter(adap->fe[0]);
930 struct e4000_config e4000_config = {
935 strlcpy(info.type, "e4000", I2C_NAME_SIZE);
937 info.platform_data = &e4000_config;
939 request_module(info.type);
940 client = i2c_new_device(priv->demod_i2c_adapter, &info);
941 if (client == NULL || client->dev.driver == NULL)
944 if (!try_module_get(client->dev.driver->owner)) {
945 i2c_unregister_device(client);
949 priv->client = client;
950 sd = i2c_get_clientdata(client);
951 i2c_set_adapdata(i2c_adap_internal, d);
954 dvb_attach(rtl2832_sdr_attach, adap->fe[0],
956 &rtl28xxu_rtl2832_e4000_config, sd);
959 case TUNER_RTL2832_FC2580:
960 fe = dvb_attach(fc2580_attach, adap->fe[0], &d->i2c_adap,
961 &rtl2832u_fc2580_config);
963 case TUNER_RTL2832_TUA9001:
964 /* enable GPIO1 and GPIO4 as output */
965 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x12);
969 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x12, 0x12);
973 fe = dvb_attach(tua9001_attach, adap->fe[0], &d->i2c_adap,
974 &rtl2832u_tua9001_config);
976 case TUNER_RTL2832_R820T:
977 fe = dvb_attach(r820t_attach, adap->fe[0], &d->i2c_adap,
978 &rtl2832u_r820t_config);
980 /* Use tuner to get the signal strength */
981 adap->fe[0]->ops.read_signal_strength =
982 adap->fe[0]->ops.tuner_ops.get_rf_strength;
985 dvb_attach(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap,
986 &rtl28xxu_rtl2832_r820t_config, NULL);
988 case TUNER_RTL2832_R828D:
989 /* power off mn88472 demod on GPIO0 */
990 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x00, 0x01);
994 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x01);
998 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x01, 0x01);
1002 fe = dvb_attach(r820t_attach, adap->fe[0], &d->i2c_adap,
1003 &rtl2832u_r828d_config);
1005 /* Use tuner to get the signal strength */
1006 adap->fe[0]->ops.read_signal_strength =
1007 adap->fe[0]->ops.tuner_ops.get_rf_strength;
1010 dev_err(&d->udev->dev, "%s: unknown tuner=%d\n", KBUILD_MODNAME,
1014 if (fe == NULL && priv->client == NULL) {
1021 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1025 static int rtl28xxu_init(struct dvb_usb_device *d)
1030 dev_dbg(&d->udev->dev, "%s:\n", __func__);
1032 /* init USB endpoints */
1033 ret = rtl28xx_rd_reg(d, USB_SYSCTL_0, &val);
1037 /* enable DMA and Full Packet Mode*/
1039 ret = rtl28xx_wr_reg(d, USB_SYSCTL_0, val);
1043 /* set EPA maximum packet size to 0x0200 */
1044 ret = rtl28xx_wr_regs(d, USB_EPA_MAXPKT, "\x00\x02\x00\x00", 4);
1048 /* change EPA FIFO length */
1049 ret = rtl28xx_wr_regs(d, USB_EPA_FIFO_CFG, "\x14\x00\x00\x00", 4);
1055 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1059 static void rtl28xxu_exit(struct dvb_usb_device *d)
1061 struct rtl28xxu_priv *priv = d->priv;
1062 struct i2c_client *client = priv->client;
1064 dev_dbg(&d->udev->dev, "%s:\n", __func__);
1066 /* remove I2C tuner */
1068 module_put(client->dev.driver->owner);
1069 i2c_unregister_device(client);
1075 static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff)
1078 u8 gpio, sys0, epa_ctl[2];
1080 dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);
1083 ret = rtl28xx_rd_reg(d, SYS_SYS0, &sys0);
1087 /* tuner power, read GPIOs */
1088 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio);
1092 dev_dbg(&d->udev->dev, "%s: RD SYS0=%02x GPIO_OUT_VAL=%02x\n", __func__,
1096 gpio |= 0x01; /* GPIO0 = 1 */
1097 gpio &= (~0x10); /* GPIO4 = 0 */
1098 gpio |= 0x04; /* GPIO2 = 1, LED on */
1101 epa_ctl[0] = 0x00; /* clear stall */
1102 epa_ctl[1] = 0x00; /* clear reset */
1104 gpio &= (~0x01); /* GPIO0 = 0 */
1105 gpio |= 0x10; /* GPIO4 = 1 */
1106 gpio &= (~0x04); /* GPIO2 = 1, LED off */
1107 sys0 = sys0 & (~0xc0);
1108 epa_ctl[0] = 0x10; /* set stall */
1109 epa_ctl[1] = 0x02; /* set reset */
1112 dev_dbg(&d->udev->dev, "%s: WR SYS0=%02x GPIO_OUT_VAL=%02x\n", __func__,
1116 ret = rtl28xx_wr_reg(d, SYS_SYS0, sys0);
1120 /* tuner power, write GPIOs */
1121 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, gpio);
1125 /* streaming EP: stall & reset */
1126 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, epa_ctl, 2);
1131 usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x81));
1135 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1139 static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
1143 dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);
1146 /* GPIO3=1, GPIO4=0 */
1147 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x08, 0x18);
1152 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL1, 0x00, 0x10);
1157 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x80, 0x80);
1162 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x20, 0x20);
1169 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x48, 0x48);
1173 /* streaming EP: clear stall & reset */
1174 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x00\x00", 2);
1178 ret = usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x81));
1183 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x10, 0x10);
1188 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x48);
1193 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x80);
1197 /* streaming EP: set stall & reset */
1198 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x10\x02", 2);
1205 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1209 #if IS_ENABLED(CONFIG_RC_CORE)
1210 static int rtl2831u_rc_query(struct dvb_usb_device *d)
1213 struct rtl28xxu_priv *priv = d->priv;
1216 struct rtl28xxu_reg_val rc_nec_tab[] = {
1233 /* init remote controller */
1234 if (!priv->rc_active) {
1235 for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
1236 ret = rtl28xx_wr_reg(d, rc_nec_tab[i].reg,
1241 priv->rc_active = true;
1244 ret = rtl2831_rd_regs(d, SYS_IRRC_RP, buf, 5);
1248 if (buf[4] & 0x01) {
1249 if (buf[2] == (u8) ~buf[3]) {
1250 if (buf[0] == (u8) ~buf[1]) {
1251 /* NEC standard (16 bit) */
1252 rc_code = buf[0] << 8 | buf[2];
1254 /* NEC extended (24 bit) */
1255 rc_code = buf[0] << 16 |
1256 buf[1] << 8 | buf[2];
1259 /* NEC full (32 bit) */
1260 rc_code = buf[0] << 24 | buf[1] << 16 |
1261 buf[2] << 8 | buf[3];
1264 rc_keydown(d->rc_dev, rc_code, 0);
1266 ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
1270 /* repeated intentionally to avoid extra keypress */
1271 ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
1278 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1282 static int rtl2831u_get_rc_config(struct dvb_usb_device *d,
1283 struct dvb_usb_rc *rc)
1285 rc->map_name = RC_MAP_EMPTY;
1286 rc->allowed_protos = RC_BIT_NEC;
1287 rc->query = rtl2831u_rc_query;
1293 static int rtl2832u_rc_query(struct dvb_usb_device *d)
1296 struct rtl28xxu_priv *priv = d->priv;
1297 struct ir_raw_event ev;
1299 static const struct rtl28xxu_reg_val_mask refresh_tab[] = {
1300 {IR_RX_IF, 0x03, 0xff},
1301 {IR_RX_BUF_CTRL, 0x80, 0xff},
1302 {IR_RX_CTRL, 0x80, 0xff},
1305 /* init remote controller */
1306 if (!priv->rc_active) {
1307 static const struct rtl28xxu_reg_val_mask init_tab[] = {
1308 {SYS_DEMOD_CTL1, 0x00, 0x04},
1309 {SYS_DEMOD_CTL1, 0x00, 0x08},
1310 {USB_CTRL, 0x20, 0x20},
1311 {SYS_GPIO_DIR, 0x00, 0x08},
1312 {SYS_GPIO_OUT_EN, 0x08, 0x08},
1313 {SYS_GPIO_OUT_VAL, 0x08, 0x08},
1314 {IR_MAX_DURATION0, 0xd0, 0xff},
1315 {IR_MAX_DURATION1, 0x07, 0xff},
1316 {IR_IDLE_LEN0, 0xc0, 0xff},
1317 {IR_IDLE_LEN1, 0x00, 0xff},
1318 {IR_GLITCH_LEN, 0x03, 0xff},
1319 {IR_RX_CLK, 0x09, 0xff},
1320 {IR_RX_CFG, 0x1c, 0xff},
1321 {IR_MAX_H_TOL_LEN, 0x1e, 0xff},
1322 {IR_MAX_L_TOL_LEN, 0x1e, 0xff},
1323 {IR_RX_CTRL, 0x80, 0xff},
1326 for (i = 0; i < ARRAY_SIZE(init_tab); i++) {
1327 ret = rtl28xx_wr_reg_mask(d, init_tab[i].reg,
1328 init_tab[i].val, init_tab[i].mask);
1333 priv->rc_active = true;
1336 ret = rtl28xx_rd_reg(d, IR_RX_IF, &buf[0]);
1343 ret = rtl28xx_rd_reg(d, IR_RX_BC, &buf[0]);
1349 /* read raw code from hw */
1350 ret = rtl2831_rd_regs(d, IR_RX_BUF, buf, len);
1354 /* let hw receive new code */
1355 for (i = 0; i < ARRAY_SIZE(refresh_tab); i++) {
1356 ret = rtl28xx_wr_reg_mask(d, refresh_tab[i].reg,
1357 refresh_tab[i].val, refresh_tab[i].mask);
1362 /* pass data to Kernel IR decoder */
1363 init_ir_raw_event(&ev);
1365 for (i = 0; i < len; i++) {
1366 ev.pulse = buf[i] >> 7;
1367 ev.duration = 50800 * (buf[i] & 0x7f);
1368 ir_raw_event_store_with_filter(d->rc_dev, &ev);
1371 /* 'flush' ir_raw_event_store_with_filter() */
1372 ir_raw_event_set_idle(d->rc_dev, true);
1373 ir_raw_event_handle(d->rc_dev);
1377 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1381 static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
1382 struct dvb_usb_rc *rc)
1384 /* disable IR interrupts in order to avoid SDR sample loss */
1385 if (rtl28xxu_disable_rc)
1386 return rtl28xx_wr_reg(d, IR_RX_IE, 0x00);
1388 /* load empty to enable rc */
1390 rc->map_name = RC_MAP_EMPTY;
1391 rc->allowed_protos = RC_BIT_ALL;
1392 rc->driver_type = RC_DRIVER_IR_RAW;
1393 rc->query = rtl2832u_rc_query;
1399 #define rtl2831u_get_rc_config NULL
1400 #define rtl2832u_get_rc_config NULL
1403 static const struct dvb_usb_device_properties rtl2831u_props = {
1404 .driver_name = KBUILD_MODNAME,
1405 .owner = THIS_MODULE,
1406 .adapter_nr = adapter_nr,
1407 .size_of_priv = sizeof(struct rtl28xxu_priv),
1409 .power_ctrl = rtl2831u_power_ctrl,
1410 .i2c_algo = &rtl28xxu_i2c_algo,
1411 .read_config = rtl2831u_read_config,
1412 .frontend_attach = rtl2831u_frontend_attach,
1413 .tuner_attach = rtl2831u_tuner_attach,
1414 .init = rtl28xxu_init,
1415 .get_rc_config = rtl2831u_get_rc_config,
1420 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512),
1425 static const struct dvb_usb_device_properties rtl2832u_props = {
1426 .driver_name = KBUILD_MODNAME,
1427 .owner = THIS_MODULE,
1428 .adapter_nr = adapter_nr,
1429 .size_of_priv = sizeof(struct rtl28xxu_priv),
1431 .power_ctrl = rtl2832u_power_ctrl,
1432 .i2c_algo = &rtl28xxu_i2c_algo,
1433 .read_config = rtl2832u_read_config,
1434 .frontend_attach = rtl2832u_frontend_attach,
1435 .tuner_attach = rtl2832u_tuner_attach,
1436 .init = rtl28xxu_init,
1437 .exit = rtl28xxu_exit,
1438 .get_rc_config = rtl2832u_get_rc_config,
1443 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512),
1448 static const struct usb_device_id rtl28xxu_id_table[] = {
1449 /* RTL2831U devices: */
1450 { DVB_USB_DEVICE(USB_VID_REALTEK, USB_PID_REALTEK_RTL2831U,
1451 &rtl2831u_props, "Realtek RTL2831U reference design", NULL) },
1452 { DVB_USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT,
1453 &rtl2831u_props, "Freecom USB2.0 DVB-T", NULL) },
1454 { DVB_USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT_2,
1455 &rtl2831u_props, "Freecom USB2.0 DVB-T", NULL) },
1457 /* RTL2832U devices: */
1458 { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2832,
1459 &rtl2832u_props, "Realtek RTL2832U reference design", NULL) },
1460 { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2838,
1461 &rtl2832u_props, "Realtek RTL2832U reference design", NULL) },
1462 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV1,
1463 &rtl2832u_props, "TerraTec Cinergy T Stick Black", RC_MAP_TERRATEC_SLIM) },
1464 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_DELOCK_USB2_DVBT,
1465 &rtl2832u_props, "G-Tek Electronics Group Lifeview LV5TDLX DVB-T", NULL) },
1466 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK,
1467 &rtl2832u_props, "TerraTec NOXON DAB Stick", NULL) },
1468 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV2,
1469 &rtl2832u_props, "TerraTec NOXON DAB Stick (rev 2)", NULL) },
1470 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV3,
1471 &rtl2832u_props, "TerraTec NOXON DAB Stick (rev 3)", NULL) },
1472 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_TREKSTOR_TERRES_2_0,
1473 &rtl2832u_props, "Trekstor DVB-T Stick Terres 2.0", NULL) },
1474 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1101,
1475 &rtl2832u_props, "Dexatek DK DVB-T Dongle", NULL) },
1476 { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6680,
1477 &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) },
1478 { DVB_USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_MINID,
1479 &rtl2832u_props, "Leadtek Winfast DTV Dongle Mini D", NULL) },
1480 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3,
1481 &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) },
1482 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1102,
1483 &rtl2832u_props, "Dexatek DK mini DVB-T Dongle", NULL) },
1484 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d7,
1485 &rtl2832u_props, "TerraTec Cinergy T Stick+", NULL) },
1486 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd3a8,
1487 &rtl2832u_props, "ASUS My Cinema-U3100Mini Plus V2", NULL) },
1488 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd393,
1489 &rtl2832u_props, "GIGABYTE U7300", NULL) },
1490 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1104,
1491 &rtl2832u_props, "MSI DIGIVOX Micro HD", NULL) },
1492 { DVB_USB_DEVICE(USB_VID_COMPRO, 0x0620,
1493 &rtl2832u_props, "Compro VideoMate U620F", NULL) },
1494 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd394,
1495 &rtl2832u_props, "MaxMedia HU394-T", NULL) },
1496 { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a03,
1497 &rtl2832u_props, "Leadtek WinFast DTV Dongle mini", NULL) },
1498 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_CPYTO_REDI_PC50A,
1499 &rtl2832u_props, "Crypto ReDi PC 50 A", NULL) },
1500 { DVB_USB_DEVICE(USB_VID_KYE, 0x707f,
1501 &rtl2832u_props, "Genius TVGo DVB-T03", NULL) },
1503 /* RTL2832P devices: */
1504 { DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131,
1505 &rtl2832u_props, "Astrometa DVB-T2", NULL) },
1508 MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
1510 static struct usb_driver rtl28xxu_usb_driver = {
1511 .name = KBUILD_MODNAME,
1512 .id_table = rtl28xxu_id_table,
1513 .probe = dvb_usbv2_probe,
1514 .disconnect = dvb_usbv2_disconnect,
1515 .suspend = dvb_usbv2_suspend,
1516 .resume = dvb_usbv2_resume,
1517 .reset_resume = dvb_usbv2_reset_resume,
1522 module_usb_driver(rtl28xxu_usb_driver);
1524 MODULE_DESCRIPTION("Realtek RTL28xxU DVB USB driver");
1525 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1526 MODULE_AUTHOR("Thomas Mair <thomas.mair86@googlemail.com>");
1527 MODULE_LICENSE("GPL");