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.
39 * RTL2832_SDR module is in staging. That logic is added in order to avoid any
40 * hard dependency to drivers/staging/ directory as we want compile mainline
41 * driver even whole staging directory is missing.
43 #include <media/v4l2-subdev.h>
45 #if IS_ENABLED(CONFIG_DVB_RTL2832_SDR)
46 struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe,
47 struct i2c_adapter *i2c, const struct rtl2832_config *cfg,
48 struct v4l2_subdev *sd);
50 static inline struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe,
51 struct i2c_adapter *i2c, const struct rtl2832_config *cfg,
52 struct v4l2_subdev *sd)
58 #ifdef CONFIG_MEDIA_ATTACH
59 #define dvb_attach_sdr(FUNCTION, ARGS...) ({ \
61 typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
63 __r = (void *) __a(ARGS); \
65 symbol_put(FUNCTION); \
71 #define dvb_attach_sdr(FUNCTION, ARGS...) ({ \
77 static int rtl28xxu_disable_rc;
78 module_param_named(disable_rc, rtl28xxu_disable_rc, int, 0644);
79 MODULE_PARM_DESC(disable_rc, "disable RTL2832U remote controller");
80 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
82 static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req)
89 buf = kmalloc(req->size, GFP_KERNEL);
95 if (req->index & CMD_WR_FLAG) {
97 memcpy(buf, req->data, req->size);
98 requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT);
99 pipe = usb_sndctrlpipe(d->udev, 0);
102 requesttype = (USB_TYPE_VENDOR | USB_DIR_IN);
103 pipe = usb_rcvctrlpipe(d->udev, 0);
106 ret = usb_control_msg(d->udev, pipe, 0, requesttype, req->value,
107 req->index, buf, req->size, 1000);
109 dvb_usb_dbg_usb_control_msg(d->udev, 0, requesttype, req->value,
110 req->index, buf, req->size);
115 /* read request, copy returned data to return buf */
116 if (!ret && requesttype == (USB_TYPE_VENDOR | USB_DIR_IN))
117 memcpy(req->data, buf, req->size);
126 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
130 static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
132 struct rtl28xxu_req req;
135 req.index = CMD_USB_WR;
136 else if (reg < 0x4000)
137 req.index = CMD_SYS_WR;
139 req.index = CMD_IR_WR;
145 return rtl28xxu_ctrl_msg(d, &req);
148 static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
150 struct rtl28xxu_req req;
153 req.index = CMD_USB_RD;
154 else if (reg < 0x4000)
155 req.index = CMD_SYS_RD;
157 req.index = CMD_IR_RD;
163 return rtl28xxu_ctrl_msg(d, &req);
166 static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
168 return rtl28xx_wr_regs(d, reg, &val, 1);
171 static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
173 return rtl2831_rd_regs(d, reg, val, 1);
176 static int rtl28xx_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,
182 /* no need for read if whole reg is written */
184 ret = rtl28xx_rd_reg(d, reg, &tmp);
193 return rtl28xx_wr_reg(d, reg, val);
197 static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
201 struct dvb_usb_device *d = i2c_get_adapdata(adap);
202 struct rtl28xxu_priv *priv = d->priv;
203 struct rtl28xxu_req req;
206 * It is not known which are real I2C bus xfer limits, but testing
207 * with RTL2831U + MT2060 gives max RD 24 and max WR 22 bytes.
208 * TODO: find out RTL2832U lens
212 * I2C adapter logic looks rather complicated due to fact it handles
213 * three different access methods. Those methods are;
214 * 1) integrated demod access
218 * Used method is selected in order 1, 2, 3. Method 3 can handle all
219 * requests but there is two reasons why not use it always;
220 * 1) It is most expensive, usually two USB messages are needed
221 * 2) At least RTL2831U does not support it
223 * Method 3 is needed in case of I2C write+read (typical register read)
224 * where write is more than one byte.
227 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
230 if (num == 2 && !(msg[0].flags & I2C_M_RD) &&
231 (msg[1].flags & I2C_M_RD)) {
232 if (msg[0].len > 24 || msg[1].len > 24) {
233 /* TODO: check msg[0].len max */
235 goto err_mutex_unlock;
236 } else if (msg[0].addr == 0x10) {
237 /* method 1 - integrated demod */
238 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
239 req.index = CMD_DEMOD_RD | priv->page;
240 req.size = msg[1].len;
241 req.data = &msg[1].buf[0];
242 ret = rtl28xxu_ctrl_msg(d, &req);
243 } else if (msg[0].len < 2) {
244 /* method 2 - old I2C */
245 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
246 req.index = CMD_I2C_RD;
247 req.size = msg[1].len;
248 req.data = &msg[1].buf[0];
249 ret = rtl28xxu_ctrl_msg(d, &req);
251 /* method 3 - new I2C */
252 req.value = (msg[0].addr << 1);
253 req.index = CMD_I2C_DA_WR;
254 req.size = msg[0].len;
255 req.data = msg[0].buf;
256 ret = rtl28xxu_ctrl_msg(d, &req);
258 goto err_mutex_unlock;
260 req.value = (msg[0].addr << 1);
261 req.index = CMD_I2C_DA_RD;
262 req.size = msg[1].len;
263 req.data = msg[1].buf;
264 ret = rtl28xxu_ctrl_msg(d, &req);
266 } else if (num == 1 && !(msg[0].flags & I2C_M_RD)) {
267 if (msg[0].len > 22) {
268 /* TODO: check msg[0].len max */
270 goto err_mutex_unlock;
271 } else if (msg[0].addr == 0x10) {
272 /* method 1 - integrated demod */
273 if (msg[0].buf[0] == 0x00) {
274 /* save demod page for later demod access */
275 priv->page = msg[0].buf[1];
278 req.value = (msg[0].buf[0] << 8) |
280 req.index = CMD_DEMOD_WR | priv->page;
281 req.size = msg[0].len-1;
282 req.data = &msg[0].buf[1];
283 ret = rtl28xxu_ctrl_msg(d, &req);
285 } else if (msg[0].len < 23) {
286 /* method 2 - old I2C */
287 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
288 req.index = CMD_I2C_WR;
289 req.size = msg[0].len-1;
290 req.data = &msg[0].buf[1];
291 ret = rtl28xxu_ctrl_msg(d, &req);
293 /* method 3 - new I2C */
294 req.value = (msg[0].addr << 1);
295 req.index = CMD_I2C_DA_WR;
296 req.size = msg[0].len;
297 req.data = msg[0].buf;
298 ret = rtl28xxu_ctrl_msg(d, &req);
305 mutex_unlock(&d->i2c_mutex);
307 return ret ? ret : num;
310 static u32 rtl28xxu_i2c_func(struct i2c_adapter *adapter)
315 static struct i2c_algorithm rtl28xxu_i2c_algo = {
316 .master_xfer = rtl28xxu_i2c_xfer,
317 .functionality = rtl28xxu_i2c_func,
320 static int rtl2831u_read_config(struct dvb_usb_device *d)
322 struct rtl28xxu_priv *priv = d_to_priv(d);
325 /* open RTL2831U/RTL2830 I2C gate */
326 struct rtl28xxu_req req_gate_open = {0x0120, 0x0011, 0x0001, "\x08"};
328 struct rtl28xxu_req req_mt2060 = {0x00c0, CMD_I2C_RD, 1, buf};
329 struct rtl28xxu_req req_qt1010 = {0x0fc4, CMD_I2C_RD, 1, buf};
331 dev_dbg(&d->udev->dev, "%s:\n", __func__);
335 * =========================================================
336 * GPIO0 | tuner#0 | 0 off | 1 on | MXL5005S (?)
337 * GPIO2 | LED | 0 off | 1 on |
338 * GPIO4 | tuner#1 | 0 on | 1 off | MT2060
342 ret = rtl28xx_wr_reg(d, SYS_GPIO_DIR, 0x0a);
346 /* enable as output GPIO0, GPIO2, GPIO4 */
347 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_EN, 0x15);
352 * Probe used tuner. We need to know used tuner before demod attach
353 * since there is some demod params needed to set according to tuner.
356 /* demod needs some time to wake up */
359 priv->tuner_name = "NONE";
361 /* open demod I2C gate */
362 ret = rtl28xxu_ctrl_msg(d, &req_gate_open);
366 /* check QT1010 ID(?) register; reg=0f val=2c */
367 ret = rtl28xxu_ctrl_msg(d, &req_qt1010);
368 if (ret == 0 && buf[0] == 0x2c) {
369 priv->tuner = TUNER_RTL2830_QT1010;
370 priv->tuner_name = "QT1010";
374 /* open demod I2C gate */
375 ret = rtl28xxu_ctrl_msg(d, &req_gate_open);
379 /* check MT2060 ID register; reg=00 val=63 */
380 ret = rtl28xxu_ctrl_msg(d, &req_mt2060);
381 if (ret == 0 && buf[0] == 0x63) {
382 priv->tuner = TUNER_RTL2830_MT2060;
383 priv->tuner_name = "MT2060";
387 /* assume MXL5005S */
388 priv->tuner = TUNER_RTL2830_MXL5005S;
389 priv->tuner_name = "MXL5005S";
393 dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name);
397 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
401 static int rtl2832u_read_config(struct dvb_usb_device *d)
403 struct rtl28xxu_priv *priv = d_to_priv(d);
406 /* open RTL2832U/RTL2832 I2C gate */
407 struct rtl28xxu_req req_gate_open = {0x0120, 0x0011, 0x0001, "\x18"};
408 /* close RTL2832U/RTL2832 I2C gate */
409 struct rtl28xxu_req req_gate_close = {0x0120, 0x0011, 0x0001, "\x10"};
411 struct rtl28xxu_req req_fc0012 = {0x00c6, CMD_I2C_RD, 1, buf};
412 struct rtl28xxu_req req_fc0013 = {0x00c6, CMD_I2C_RD, 1, buf};
413 struct rtl28xxu_req req_mt2266 = {0x00c0, CMD_I2C_RD, 1, buf};
414 struct rtl28xxu_req req_fc2580 = {0x01ac, CMD_I2C_RD, 1, buf};
415 struct rtl28xxu_req req_mt2063 = {0x00c0, CMD_I2C_RD, 1, buf};
416 struct rtl28xxu_req req_max3543 = {0x00c0, CMD_I2C_RD, 1, buf};
417 struct rtl28xxu_req req_tua9001 = {0x7ec0, CMD_I2C_RD, 2, buf};
418 struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf};
419 struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf};
420 struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf};
421 struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
422 struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
424 dev_dbg(&d->udev->dev, "%s:\n", __func__);
426 /* enable GPIO3 and GPIO6 as output */
427 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x40);
431 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x48, 0x48);
436 * Probe used tuner. We need to know used tuner before demod attach
437 * since there is some demod params needed to set according to tuner.
440 /* open demod I2C gate */
441 ret = rtl28xxu_ctrl_msg(d, &req_gate_open);
445 priv->tuner_name = "NONE";
447 /* check FC0012 ID register; reg=00 val=a1 */
448 ret = rtl28xxu_ctrl_msg(d, &req_fc0012);
449 if (ret == 0 && buf[0] == 0xa1) {
450 priv->tuner = TUNER_RTL2832_FC0012;
451 priv->tuner_name = "FC0012";
455 /* check FC0013 ID register; reg=00 val=a3 */
456 ret = rtl28xxu_ctrl_msg(d, &req_fc0013);
457 if (ret == 0 && buf[0] == 0xa3) {
458 priv->tuner = TUNER_RTL2832_FC0013;
459 priv->tuner_name = "FC0013";
463 /* check MT2266 ID register; reg=00 val=85 */
464 ret = rtl28xxu_ctrl_msg(d, &req_mt2266);
465 if (ret == 0 && buf[0] == 0x85) {
466 priv->tuner = TUNER_RTL2832_MT2266;
467 priv->tuner_name = "MT2266";
471 /* check FC2580 ID register; reg=01 val=56 */
472 ret = rtl28xxu_ctrl_msg(d, &req_fc2580);
473 if (ret == 0 && buf[0] == 0x56) {
474 priv->tuner = TUNER_RTL2832_FC2580;
475 priv->tuner_name = "FC2580";
479 /* check MT2063 ID register; reg=00 val=9e || 9c */
480 ret = rtl28xxu_ctrl_msg(d, &req_mt2063);
481 if (ret == 0 && (buf[0] == 0x9e || buf[0] == 0x9c)) {
482 priv->tuner = TUNER_RTL2832_MT2063;
483 priv->tuner_name = "MT2063";
487 /* check MAX3543 ID register; reg=00 val=38 */
488 ret = rtl28xxu_ctrl_msg(d, &req_max3543);
489 if (ret == 0 && buf[0] == 0x38) {
490 priv->tuner = TUNER_RTL2832_MAX3543;
491 priv->tuner_name = "MAX3543";
495 /* check TUA9001 ID register; reg=7e val=2328 */
496 ret = rtl28xxu_ctrl_msg(d, &req_tua9001);
497 if (ret == 0 && buf[0] == 0x23 && buf[1] == 0x28) {
498 priv->tuner = TUNER_RTL2832_TUA9001;
499 priv->tuner_name = "TUA9001";
503 /* check MXL5007R ID register; reg=d9 val=14 */
504 ret = rtl28xxu_ctrl_msg(d, &req_mxl5007t);
505 if (ret == 0 && buf[0] == 0x14) {
506 priv->tuner = TUNER_RTL2832_MXL5007T;
507 priv->tuner_name = "MXL5007T";
511 /* check E4000 ID register; reg=02 val=40 */
512 ret = rtl28xxu_ctrl_msg(d, &req_e4000);
513 if (ret == 0 && buf[0] == 0x40) {
514 priv->tuner = TUNER_RTL2832_E4000;
515 priv->tuner_name = "E4000";
519 /* check TDA18272 ID register; reg=00 val=c760 */
520 ret = rtl28xxu_ctrl_msg(d, &req_tda18272);
521 if (ret == 0 && (buf[0] == 0xc7 || buf[1] == 0x60)) {
522 priv->tuner = TUNER_RTL2832_TDA18272;
523 priv->tuner_name = "TDA18272";
527 /* check R820T ID register; reg=00 val=69 */
528 ret = rtl28xxu_ctrl_msg(d, &req_r820t);
529 if (ret == 0 && buf[0] == 0x69) {
530 priv->tuner = TUNER_RTL2832_R820T;
531 priv->tuner_name = "R820T";
535 /* check R828D ID register; reg=00 val=69 */
536 ret = rtl28xxu_ctrl_msg(d, &req_r828d);
537 if (ret == 0 && buf[0] == 0x69) {
538 priv->tuner = TUNER_RTL2832_R828D;
539 priv->tuner_name = "R828D";
545 dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name);
547 /* close demod I2C gate */
548 ret = rtl28xxu_ctrl_msg(d, &req_gate_close);
554 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
558 static const struct rtl2830_config rtl28xxu_rtl2830_mt2060_config = {
559 .i2c_addr = 0x10, /* 0x20 */
565 .agc_targ_val = 0x2d,
569 static const struct rtl2830_config rtl28xxu_rtl2830_qt1010_config = {
570 .i2c_addr = 0x10, /* 0x20 */
576 .agc_targ_val = 0x2d,
579 static const struct rtl2830_config rtl28xxu_rtl2830_mxl5005s_config = {
580 .i2c_addr = 0x10, /* 0x20 */
586 .agc_targ_val = 0x3e,
589 static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap)
591 struct dvb_usb_device *d = adap_to_d(adap);
592 struct rtl28xxu_priv *priv = d_to_priv(d);
593 const struct rtl2830_config *rtl2830_config;
596 dev_dbg(&d->udev->dev, "%s:\n", __func__);
598 switch (priv->tuner) {
599 case TUNER_RTL2830_QT1010:
600 rtl2830_config = &rtl28xxu_rtl2830_qt1010_config;
602 case TUNER_RTL2830_MT2060:
603 rtl2830_config = &rtl28xxu_rtl2830_mt2060_config;
605 case TUNER_RTL2830_MXL5005S:
606 rtl2830_config = &rtl28xxu_rtl2830_mxl5005s_config;
609 dev_err(&d->udev->dev, "%s: unknown tuner=%s\n",
610 KBUILD_MODNAME, priv->tuner_name);
615 /* attach demodulator */
616 adap->fe[0] = dvb_attach(rtl2830_attach, rtl2830_config, &d->i2c_adap);
624 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
628 static const struct rtl2832_config rtl28xxu_rtl2832_fc0012_config = {
629 .i2c_addr = 0x10, /* 0x20 */
631 .tuner = TUNER_RTL2832_FC0012
634 static const struct rtl2832_config rtl28xxu_rtl2832_fc0013_config = {
635 .i2c_addr = 0x10, /* 0x20 */
637 .tuner = TUNER_RTL2832_FC0013
640 static const struct rtl2832_config rtl28xxu_rtl2832_tua9001_config = {
641 .i2c_addr = 0x10, /* 0x20 */
643 .tuner = TUNER_RTL2832_TUA9001,
646 static const struct rtl2832_config rtl28xxu_rtl2832_e4000_config = {
647 .i2c_addr = 0x10, /* 0x20 */
649 .tuner = TUNER_RTL2832_E4000,
652 static const struct rtl2832_config rtl28xxu_rtl2832_r820t_config = {
655 .tuner = TUNER_RTL2832_R820T,
658 static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
664 dev_dbg(&d->udev->dev, "%s: cmd=%d arg=%d\n", __func__, cmd, arg);
667 case FC_FE_CALLBACK_VHF_ENABLE:
668 /* set output values */
669 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
674 val &= 0xbf; /* set GPIO6 low */
676 val |= 0x40; /* set GPIO6 high */
679 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
689 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
693 static int rtl2832u_tua9001_tuner_callback(struct dvb_usb_device *d,
699 dev_dbg(&d->udev->dev, "%s: cmd=%d arg=%d\n", __func__, cmd, arg);
702 * CEN always enabled by hardware wiring
708 case TUA9001_CMD_RESETN:
714 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x10);
718 case TUA9001_CMD_RXEN:
724 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x02);
732 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
736 static int rtl2832u_tuner_callback(struct dvb_usb_device *d, int cmd, int arg)
738 struct rtl28xxu_priv *priv = d->priv;
740 switch (priv->tuner) {
741 case TUNER_RTL2832_FC0012:
742 return rtl2832u_fc0012_tuner_callback(d, cmd, arg);
743 case TUNER_RTL2832_TUA9001:
744 return rtl2832u_tua9001_tuner_callback(d, cmd, arg);
752 static int rtl2832u_frontend_callback(void *adapter_priv, int component,
755 struct i2c_adapter *adap = adapter_priv;
756 struct dvb_usb_device *d = i2c_get_adapdata(adap);
758 dev_dbg(&d->udev->dev, "%s: component=%d cmd=%d arg=%d\n",
759 __func__, component, cmd, arg);
762 case DVB_FRONTEND_COMPONENT_TUNER:
763 return rtl2832u_tuner_callback(d, cmd, arg);
771 static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
774 struct dvb_usb_device *d = adap_to_d(adap);
775 struct rtl28xxu_priv *priv = d_to_priv(d);
776 const struct rtl2832_config *rtl2832_config;
778 dev_dbg(&d->udev->dev, "%s:\n", __func__);
780 switch (priv->tuner) {
781 case TUNER_RTL2832_FC0012:
782 rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
784 case TUNER_RTL2832_FC0013:
785 rtl2832_config = &rtl28xxu_rtl2832_fc0013_config;
787 case TUNER_RTL2832_FC2580:
788 /* FIXME: do not abuse fc0012 settings */
789 rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
791 case TUNER_RTL2832_TUA9001:
792 rtl2832_config = &rtl28xxu_rtl2832_tua9001_config;
794 case TUNER_RTL2832_E4000:
795 rtl2832_config = &rtl28xxu_rtl2832_e4000_config;
797 case TUNER_RTL2832_R820T:
798 case TUNER_RTL2832_R828D:
799 rtl2832_config = &rtl28xxu_rtl2832_r820t_config;
802 dev_err(&d->udev->dev, "%s: unknown tuner=%s\n",
803 KBUILD_MODNAME, priv->tuner_name);
808 /* attach demodulator */
809 adap->fe[0] = dvb_attach(rtl2832_attach, rtl2832_config, &d->i2c_adap);
815 /* RTL2832 I2C repeater */
816 priv->demod_i2c_adapter = rtl2832_get_i2c_adapter(adap->fe[0]);
818 /* set fe callback */
819 adap->fe[0]->callback = rtl2832u_frontend_callback;
823 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
827 static struct qt1010_config rtl28xxu_qt1010_config = {
828 .i2c_address = 0x62, /* 0xc4 */
831 static struct mt2060_config rtl28xxu_mt2060_config = {
832 .i2c_address = 0x60, /* 0xc0 */
836 static struct mxl5005s_config rtl28xxu_mxl5005s_config = {
837 .i2c_address = 0x63, /* 0xc6 */
838 .if_freq = IF_FREQ_4570000HZ,
839 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
840 .agc_mode = MXL_SINGLE_AGC,
841 .tracking_filter = MXL_TF_C_H,
842 .rssi_enable = MXL_RSSI_ENABLE,
843 .cap_select = MXL_CAP_SEL_ENABLE,
844 .div_out = MXL_DIV_OUT_4,
845 .clock_out = MXL_CLOCK_OUT_DISABLE,
846 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
847 .top = MXL5005S_TOP_25P2,
848 .mod_mode = MXL_DIGITAL_MODE,
849 .if_mode = MXL_ZERO_IF,
850 .AgcMasterByte = 0x00,
853 static int rtl2831u_tuner_attach(struct dvb_usb_adapter *adap)
856 struct dvb_usb_device *d = adap_to_d(adap);
857 struct rtl28xxu_priv *priv = d_to_priv(d);
858 struct i2c_adapter *rtl2830_tuner_i2c;
859 struct dvb_frontend *fe;
861 dev_dbg(&d->udev->dev, "%s:\n", __func__);
863 /* use rtl2830 driver I2C adapter, for more info see rtl2830 driver */
864 rtl2830_tuner_i2c = rtl2830_get_tuner_i2c_adapter(adap->fe[0]);
866 switch (priv->tuner) {
867 case TUNER_RTL2830_QT1010:
868 fe = dvb_attach(qt1010_attach, adap->fe[0],
869 rtl2830_tuner_i2c, &rtl28xxu_qt1010_config);
871 case TUNER_RTL2830_MT2060:
872 fe = dvb_attach(mt2060_attach, adap->fe[0],
873 rtl2830_tuner_i2c, &rtl28xxu_mt2060_config,
876 case TUNER_RTL2830_MXL5005S:
877 fe = dvb_attach(mxl5005s_attach, adap->fe[0],
878 rtl2830_tuner_i2c, &rtl28xxu_mxl5005s_config);
882 dev_err(&d->udev->dev, "%s: unknown tuner=%d\n", KBUILD_MODNAME,
893 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
897 static const struct fc2580_config rtl2832u_fc2580_config = {
902 static struct tua9001_config rtl2832u_tua9001_config = {
906 static const struct fc0012_config rtl2832u_fc0012_config = {
907 .i2c_address = 0x63, /* 0xc6 >> 1 */
908 .xtal_freq = FC_XTAL_28_8_MHZ,
911 static const struct r820t_config rtl2832u_r820t_config = {
914 .max_i2c_msg_len = 2,
915 .rafael_chip = CHIP_R820T,
918 static const struct r820t_config rtl2832u_r828d_config = {
921 .max_i2c_msg_len = 2,
922 .rafael_chip = CHIP_R828D,
925 static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
928 struct dvb_usb_device *d = adap_to_d(adap);
929 struct rtl28xxu_priv *priv = d_to_priv(d);
930 struct dvb_frontend *fe = NULL;
931 struct i2c_board_info info;
932 struct i2c_client *client;
934 dev_dbg(&d->udev->dev, "%s:\n", __func__);
936 memset(&info, 0, sizeof(struct i2c_board_info));
938 switch (priv->tuner) {
939 case TUNER_RTL2832_FC0012:
940 fe = dvb_attach(fc0012_attach, adap->fe[0],
941 &d->i2c_adap, &rtl2832u_fc0012_config);
943 /* since fc0012 includs reading the signal strength delegate
944 * that to the tuner driver */
945 adap->fe[0]->ops.read_signal_strength =
946 adap->fe[0]->ops.tuner_ops.get_rf_strength;
949 dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap,
950 &rtl28xxu_rtl2832_fc0012_config, NULL);
952 case TUNER_RTL2832_FC0013:
953 fe = dvb_attach(fc0013_attach, adap->fe[0],
954 &d->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
956 /* fc0013 also supports signal strength reading */
957 adap->fe[0]->ops.read_signal_strength =
958 adap->fe[0]->ops.tuner_ops.get_rf_strength;
961 dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap,
962 &rtl28xxu_rtl2832_fc0013_config, NULL);
964 case TUNER_RTL2832_E4000: {
965 struct v4l2_subdev *sd;
966 struct i2c_adapter *i2c_adap_internal =
967 rtl2832_get_private_i2c_adapter(adap->fe[0]);
968 struct e4000_config e4000_config = {
973 strlcpy(info.type, "e4000", I2C_NAME_SIZE);
975 info.platform_data = &e4000_config;
977 request_module(info.type);
978 client = i2c_new_device(priv->demod_i2c_adapter, &info);
979 if (client == NULL || client->dev.driver == NULL)
982 if (!try_module_get(client->dev.driver->owner)) {
983 i2c_unregister_device(client);
987 priv->client = client;
988 sd = i2c_get_clientdata(client);
989 i2c_set_adapdata(i2c_adap_internal, d);
992 dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0],
994 &rtl28xxu_rtl2832_e4000_config, sd);
997 case TUNER_RTL2832_FC2580:
998 fe = dvb_attach(fc2580_attach, adap->fe[0], &d->i2c_adap,
999 &rtl2832u_fc2580_config);
1001 case TUNER_RTL2832_TUA9001:
1002 /* enable GPIO1 and GPIO4 as output */
1003 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x12);
1007 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x12, 0x12);
1011 fe = dvb_attach(tua9001_attach, adap->fe[0], &d->i2c_adap,
1012 &rtl2832u_tua9001_config);
1014 case TUNER_RTL2832_R820T:
1015 fe = dvb_attach(r820t_attach, adap->fe[0], &d->i2c_adap,
1016 &rtl2832u_r820t_config);
1018 /* Use tuner to get the signal strength */
1019 adap->fe[0]->ops.read_signal_strength =
1020 adap->fe[0]->ops.tuner_ops.get_rf_strength;
1023 dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap,
1024 &rtl28xxu_rtl2832_r820t_config, NULL);
1026 case TUNER_RTL2832_R828D:
1027 /* power off mn88472 demod on GPIO0 */
1028 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x00, 0x01);
1032 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x01);
1036 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x01, 0x01);
1040 fe = dvb_attach(r820t_attach, adap->fe[0], &d->i2c_adap,
1041 &rtl2832u_r828d_config);
1043 /* Use tuner to get the signal strength */
1044 adap->fe[0]->ops.read_signal_strength =
1045 adap->fe[0]->ops.tuner_ops.get_rf_strength;
1048 dev_err(&d->udev->dev, "%s: unknown tuner=%d\n", KBUILD_MODNAME,
1052 if (fe == NULL && priv->client == NULL) {
1059 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1063 static int rtl28xxu_init(struct dvb_usb_device *d)
1068 dev_dbg(&d->udev->dev, "%s:\n", __func__);
1070 /* init USB endpoints */
1071 ret = rtl28xx_rd_reg(d, USB_SYSCTL_0, &val);
1075 /* enable DMA and Full Packet Mode*/
1077 ret = rtl28xx_wr_reg(d, USB_SYSCTL_0, val);
1081 /* set EPA maximum packet size to 0x0200 */
1082 ret = rtl28xx_wr_regs(d, USB_EPA_MAXPKT, "\x00\x02\x00\x00", 4);
1086 /* change EPA FIFO length */
1087 ret = rtl28xx_wr_regs(d, USB_EPA_FIFO_CFG, "\x14\x00\x00\x00", 4);
1093 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1097 static void rtl28xxu_exit(struct dvb_usb_device *d)
1099 struct rtl28xxu_priv *priv = d->priv;
1100 struct i2c_client *client = priv->client;
1102 dev_dbg(&d->udev->dev, "%s:\n", __func__);
1104 /* remove I2C tuner */
1106 module_put(client->dev.driver->owner);
1107 i2c_unregister_device(client);
1113 static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff)
1116 u8 gpio, sys0, epa_ctl[2];
1118 dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);
1121 ret = rtl28xx_rd_reg(d, SYS_SYS0, &sys0);
1125 /* tuner power, read GPIOs */
1126 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio);
1130 dev_dbg(&d->udev->dev, "%s: RD SYS0=%02x GPIO_OUT_VAL=%02x\n", __func__,
1134 gpio |= 0x01; /* GPIO0 = 1 */
1135 gpio &= (~0x10); /* GPIO4 = 0 */
1136 gpio |= 0x04; /* GPIO2 = 1, LED on */
1139 epa_ctl[0] = 0x00; /* clear stall */
1140 epa_ctl[1] = 0x00; /* clear reset */
1142 gpio &= (~0x01); /* GPIO0 = 0 */
1143 gpio |= 0x10; /* GPIO4 = 1 */
1144 gpio &= (~0x04); /* GPIO2 = 1, LED off */
1145 sys0 = sys0 & (~0xc0);
1146 epa_ctl[0] = 0x10; /* set stall */
1147 epa_ctl[1] = 0x02; /* set reset */
1150 dev_dbg(&d->udev->dev, "%s: WR SYS0=%02x GPIO_OUT_VAL=%02x\n", __func__,
1154 ret = rtl28xx_wr_reg(d, SYS_SYS0, sys0);
1158 /* tuner power, write GPIOs */
1159 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, gpio);
1163 /* streaming EP: stall & reset */
1164 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, epa_ctl, 2);
1169 usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x81));
1173 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1177 static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
1181 dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);
1184 /* GPIO3=1, GPIO4=0 */
1185 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x08, 0x18);
1190 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL1, 0x00, 0x10);
1195 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x80, 0x80);
1200 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x20, 0x20);
1207 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x48, 0x48);
1211 /* streaming EP: clear stall & reset */
1212 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x00\x00", 2);
1216 ret = usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x81));
1221 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x10, 0x10);
1226 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x48);
1231 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x80);
1235 /* streaming EP: set stall & reset */
1236 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x10\x02", 2);
1243 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1247 #if IS_ENABLED(CONFIG_RC_CORE)
1248 static int rtl2831u_rc_query(struct dvb_usb_device *d)
1251 struct rtl28xxu_priv *priv = d->priv;
1254 struct rtl28xxu_reg_val rc_nec_tab[] = {
1271 /* init remote controller */
1272 if (!priv->rc_active) {
1273 for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
1274 ret = rtl28xx_wr_reg(d, rc_nec_tab[i].reg,
1279 priv->rc_active = true;
1282 ret = rtl2831_rd_regs(d, SYS_IRRC_RP, buf, 5);
1286 if (buf[4] & 0x01) {
1287 if (buf[2] == (u8) ~buf[3]) {
1288 if (buf[0] == (u8) ~buf[1]) {
1289 /* NEC standard (16 bit) */
1290 rc_code = RC_SCANCODE_NEC(buf[0], buf[2]);
1292 /* NEC extended (24 bit) */
1293 rc_code = RC_SCANCODE_NECX(buf[0] << 8 | buf[1],
1297 /* NEC full (32 bit) */
1298 rc_code = RC_SCANCODE_NEC32(buf[0] << 24 | buf[1] << 16 |
1299 buf[2] << 8 | buf[3]);
1302 rc_keydown(d->rc_dev, RC_TYPE_NEC, rc_code, 0);
1304 ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
1308 /* repeated intentionally to avoid extra keypress */
1309 ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
1316 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1320 static int rtl2831u_get_rc_config(struct dvb_usb_device *d,
1321 struct dvb_usb_rc *rc)
1323 rc->map_name = RC_MAP_EMPTY;
1324 rc->allowed_protos = RC_BIT_NEC;
1325 rc->query = rtl2831u_rc_query;
1331 static int rtl2832u_rc_query(struct dvb_usb_device *d)
1334 struct rtl28xxu_priv *priv = d->priv;
1335 struct ir_raw_event ev;
1337 static const struct rtl28xxu_reg_val_mask refresh_tab[] = {
1338 {IR_RX_IF, 0x03, 0xff},
1339 {IR_RX_BUF_CTRL, 0x80, 0xff},
1340 {IR_RX_CTRL, 0x80, 0xff},
1343 /* init remote controller */
1344 if (!priv->rc_active) {
1345 static const struct rtl28xxu_reg_val_mask init_tab[] = {
1346 {SYS_DEMOD_CTL1, 0x00, 0x04},
1347 {SYS_DEMOD_CTL1, 0x00, 0x08},
1348 {USB_CTRL, 0x20, 0x20},
1349 {SYS_GPIO_DIR, 0x00, 0x08},
1350 {SYS_GPIO_OUT_EN, 0x08, 0x08},
1351 {SYS_GPIO_OUT_VAL, 0x08, 0x08},
1352 {IR_MAX_DURATION0, 0xd0, 0xff},
1353 {IR_MAX_DURATION1, 0x07, 0xff},
1354 {IR_IDLE_LEN0, 0xc0, 0xff},
1355 {IR_IDLE_LEN1, 0x00, 0xff},
1356 {IR_GLITCH_LEN, 0x03, 0xff},
1357 {IR_RX_CLK, 0x09, 0xff},
1358 {IR_RX_CFG, 0x1c, 0xff},
1359 {IR_MAX_H_TOL_LEN, 0x1e, 0xff},
1360 {IR_MAX_L_TOL_LEN, 0x1e, 0xff},
1361 {IR_RX_CTRL, 0x80, 0xff},
1364 for (i = 0; i < ARRAY_SIZE(init_tab); i++) {
1365 ret = rtl28xx_wr_reg_mask(d, init_tab[i].reg,
1366 init_tab[i].val, init_tab[i].mask);
1371 priv->rc_active = true;
1374 ret = rtl28xx_rd_reg(d, IR_RX_IF, &buf[0]);
1381 ret = rtl28xx_rd_reg(d, IR_RX_BC, &buf[0]);
1387 /* read raw code from hw */
1388 ret = rtl2831_rd_regs(d, IR_RX_BUF, buf, len);
1392 /* let hw receive new code */
1393 for (i = 0; i < ARRAY_SIZE(refresh_tab); i++) {
1394 ret = rtl28xx_wr_reg_mask(d, refresh_tab[i].reg,
1395 refresh_tab[i].val, refresh_tab[i].mask);
1400 /* pass data to Kernel IR decoder */
1401 init_ir_raw_event(&ev);
1403 for (i = 0; i < len; i++) {
1404 ev.pulse = buf[i] >> 7;
1405 ev.duration = 50800 * (buf[i] & 0x7f);
1406 ir_raw_event_store_with_filter(d->rc_dev, &ev);
1409 /* 'flush' ir_raw_event_store_with_filter() */
1410 ir_raw_event_set_idle(d->rc_dev, true);
1411 ir_raw_event_handle(d->rc_dev);
1415 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1419 static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
1420 struct dvb_usb_rc *rc)
1422 /* disable IR interrupts in order to avoid SDR sample loss */
1423 if (rtl28xxu_disable_rc)
1424 return rtl28xx_wr_reg(d, IR_RX_IE, 0x00);
1426 /* load empty to enable rc */
1428 rc->map_name = RC_MAP_EMPTY;
1429 rc->allowed_protos = RC_BIT_ALL;
1430 rc->driver_type = RC_DRIVER_IR_RAW;
1431 rc->query = rtl2832u_rc_query;
1437 #define rtl2831u_get_rc_config NULL
1438 #define rtl2832u_get_rc_config NULL
1441 static const struct dvb_usb_device_properties rtl2831u_props = {
1442 .driver_name = KBUILD_MODNAME,
1443 .owner = THIS_MODULE,
1444 .adapter_nr = adapter_nr,
1445 .size_of_priv = sizeof(struct rtl28xxu_priv),
1447 .power_ctrl = rtl2831u_power_ctrl,
1448 .i2c_algo = &rtl28xxu_i2c_algo,
1449 .read_config = rtl2831u_read_config,
1450 .frontend_attach = rtl2831u_frontend_attach,
1451 .tuner_attach = rtl2831u_tuner_attach,
1452 .init = rtl28xxu_init,
1453 .get_rc_config = rtl2831u_get_rc_config,
1458 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512),
1463 static const struct dvb_usb_device_properties rtl2832u_props = {
1464 .driver_name = KBUILD_MODNAME,
1465 .owner = THIS_MODULE,
1466 .adapter_nr = adapter_nr,
1467 .size_of_priv = sizeof(struct rtl28xxu_priv),
1469 .power_ctrl = rtl2832u_power_ctrl,
1470 .i2c_algo = &rtl28xxu_i2c_algo,
1471 .read_config = rtl2832u_read_config,
1472 .frontend_attach = rtl2832u_frontend_attach,
1473 .tuner_attach = rtl2832u_tuner_attach,
1474 .init = rtl28xxu_init,
1475 .exit = rtl28xxu_exit,
1476 .get_rc_config = rtl2832u_get_rc_config,
1481 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512),
1486 static const struct usb_device_id rtl28xxu_id_table[] = {
1487 /* RTL2831U devices: */
1488 { DVB_USB_DEVICE(USB_VID_REALTEK, USB_PID_REALTEK_RTL2831U,
1489 &rtl2831u_props, "Realtek RTL2831U reference design", NULL) },
1490 { DVB_USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT,
1491 &rtl2831u_props, "Freecom USB2.0 DVB-T", NULL) },
1492 { DVB_USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT_2,
1493 &rtl2831u_props, "Freecom USB2.0 DVB-T", NULL) },
1495 /* RTL2832U devices: */
1496 { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2832,
1497 &rtl2832u_props, "Realtek RTL2832U reference design", NULL) },
1498 { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2838,
1499 &rtl2832u_props, "Realtek RTL2832U reference design", NULL) },
1500 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV1,
1501 &rtl2832u_props, "TerraTec Cinergy T Stick Black", RC_MAP_TERRATEC_SLIM) },
1502 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_DELOCK_USB2_DVBT,
1503 &rtl2832u_props, "G-Tek Electronics Group Lifeview LV5TDLX DVB-T", NULL) },
1504 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK,
1505 &rtl2832u_props, "TerraTec NOXON DAB Stick", NULL) },
1506 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV2,
1507 &rtl2832u_props, "TerraTec NOXON DAB Stick (rev 2)", NULL) },
1508 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV3,
1509 &rtl2832u_props, "TerraTec NOXON DAB Stick (rev 3)", NULL) },
1510 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_TREKSTOR_TERRES_2_0,
1511 &rtl2832u_props, "Trekstor DVB-T Stick Terres 2.0", NULL) },
1512 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1101,
1513 &rtl2832u_props, "Dexatek DK DVB-T Dongle", NULL) },
1514 { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6680,
1515 &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) },
1516 { DVB_USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_MINID,
1517 &rtl2832u_props, "Leadtek Winfast DTV Dongle Mini D", NULL) },
1518 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3,
1519 &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) },
1520 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1102,
1521 &rtl2832u_props, "Dexatek DK mini DVB-T Dongle", NULL) },
1522 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d7,
1523 &rtl2832u_props, "TerraTec Cinergy T Stick+", NULL) },
1524 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd3a8,
1525 &rtl2832u_props, "ASUS My Cinema-U3100Mini Plus V2", NULL) },
1526 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd393,
1527 &rtl2832u_props, "GIGABYTE U7300", NULL) },
1528 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1104,
1529 &rtl2832u_props, "MSI DIGIVOX Micro HD", NULL) },
1530 { DVB_USB_DEVICE(USB_VID_COMPRO, 0x0620,
1531 &rtl2832u_props, "Compro VideoMate U620F", NULL) },
1532 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd394,
1533 &rtl2832u_props, "MaxMedia HU394-T", NULL) },
1534 { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a03,
1535 &rtl2832u_props, "Leadtek WinFast DTV Dongle mini", NULL) },
1536 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_CPYTO_REDI_PC50A,
1537 &rtl2832u_props, "Crypto ReDi PC 50 A", NULL) },
1538 { DVB_USB_DEVICE(USB_VID_KYE, 0x707f,
1539 &rtl2832u_props, "Genius TVGo DVB-T03", NULL) },
1540 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd395,
1541 &rtl2832u_props, "Peak DVB-T USB", NULL) },
1542 { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20_RTL2832U,
1543 &rtl2832u_props, "Sveon STV20", NULL) },
1544 { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV21,
1545 &rtl2832u_props, "Sveon STV21", NULL) },
1546 { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV27,
1547 &rtl2832u_props, "Sveon STV27", NULL) },
1549 /* RTL2832P devices: */
1550 { DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131,
1551 &rtl2832u_props, "Astrometa DVB-T2", NULL) },
1554 MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
1556 static struct usb_driver rtl28xxu_usb_driver = {
1557 .name = KBUILD_MODNAME,
1558 .id_table = rtl28xxu_id_table,
1559 .probe = dvb_usbv2_probe,
1560 .disconnect = dvb_usbv2_disconnect,
1561 .suspend = dvb_usbv2_suspend,
1562 .resume = dvb_usbv2_resume,
1563 .reset_resume = dvb_usbv2_reset_resume,
1568 module_usb_driver(rtl28xxu_usb_driver);
1570 MODULE_DESCRIPTION("Realtek RTL28xxU DVB USB driver");
1571 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1572 MODULE_AUTHOR("Thomas Mair <thomas.mair86@googlemail.com>");
1573 MODULE_LICENSE("GPL");