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.
40 * RTL2832_SDR module is in staging. That logic is added in order to avoid any
41 * hard dependency to drivers/staging/ directory as we want compile mainline
42 * driver even whole staging directory is missing.
44 #include <media/v4l2-subdev.h>
46 #if IS_ENABLED(CONFIG_DVB_RTL2832_SDR)
47 struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe,
48 struct i2c_adapter *i2c, const struct rtl2832_config *cfg,
49 struct v4l2_subdev *sd);
51 static inline struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe,
52 struct i2c_adapter *i2c, const struct rtl2832_config *cfg,
53 struct v4l2_subdev *sd)
59 #ifdef CONFIG_MEDIA_ATTACH
60 #define dvb_attach_sdr(FUNCTION, ARGS...) ({ \
62 typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
64 __r = (void *) __a(ARGS); \
66 symbol_put(FUNCTION); \
72 #define dvb_attach_sdr(FUNCTION, ARGS...) ({ \
78 static int rtl28xxu_disable_rc;
79 module_param_named(disable_rc, rtl28xxu_disable_rc, int, 0644);
80 MODULE_PARM_DESC(disable_rc, "disable RTL2832U remote controller");
81 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
83 static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req)
90 buf = kmalloc(req->size, GFP_KERNEL);
96 if (req->index & CMD_WR_FLAG) {
98 memcpy(buf, req->data, req->size);
99 requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT);
100 pipe = usb_sndctrlpipe(d->udev, 0);
103 requesttype = (USB_TYPE_VENDOR | USB_DIR_IN);
104 pipe = usb_rcvctrlpipe(d->udev, 0);
107 ret = usb_control_msg(d->udev, pipe, 0, requesttype, req->value,
108 req->index, buf, req->size, 1000);
110 dvb_usb_dbg_usb_control_msg(d->udev, 0, requesttype, req->value,
111 req->index, buf, req->size);
116 /* read request, copy returned data to return buf */
117 if (!ret && requesttype == (USB_TYPE_VENDOR | USB_DIR_IN))
118 memcpy(req->data, buf, req->size);
127 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
131 static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
133 struct rtl28xxu_req req;
136 req.index = CMD_USB_WR;
137 else if (reg < 0x4000)
138 req.index = CMD_SYS_WR;
140 req.index = CMD_IR_WR;
146 return rtl28xxu_ctrl_msg(d, &req);
149 static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
151 struct rtl28xxu_req req;
154 req.index = CMD_USB_RD;
155 else if (reg < 0x4000)
156 req.index = CMD_SYS_RD;
158 req.index = CMD_IR_RD;
164 return rtl28xxu_ctrl_msg(d, &req);
167 static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
169 return rtl28xx_wr_regs(d, reg, &val, 1);
172 static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
174 return rtl2831_rd_regs(d, reg, val, 1);
177 static int rtl28xx_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,
183 /* no need for read if whole reg is written */
185 ret = rtl28xx_rd_reg(d, reg, &tmp);
194 return rtl28xx_wr_reg(d, reg, val);
198 static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
202 struct dvb_usb_device *d = i2c_get_adapdata(adap);
203 struct rtl28xxu_priv *priv = d->priv;
204 struct rtl28xxu_req req;
207 * It is not known which are real I2C bus xfer limits, but testing
208 * with RTL2831U + MT2060 gives max RD 24 and max WR 22 bytes.
209 * TODO: find out RTL2832U lens
213 * I2C adapter logic looks rather complicated due to fact it handles
214 * three different access methods. Those methods are;
215 * 1) integrated demod access
219 * Used method is selected in order 1, 2, 3. Method 3 can handle all
220 * requests but there is two reasons why not use it always;
221 * 1) It is most expensive, usually two USB messages are needed
222 * 2) At least RTL2831U does not support it
224 * Method 3 is needed in case of I2C write+read (typical register read)
225 * where write is more than one byte.
228 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
231 if (num == 2 && !(msg[0].flags & I2C_M_RD) &&
232 (msg[1].flags & I2C_M_RD)) {
233 if (msg[0].len > 24 || msg[1].len > 24) {
234 /* TODO: check msg[0].len max */
236 goto err_mutex_unlock;
237 } else if (msg[0].addr == 0x10) {
238 /* method 1 - integrated demod */
239 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
240 req.index = CMD_DEMOD_RD | priv->page;
241 req.size = msg[1].len;
242 req.data = &msg[1].buf[0];
243 ret = rtl28xxu_ctrl_msg(d, &req);
244 } else if (msg[0].len < 2) {
245 /* method 2 - old I2C */
246 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
247 req.index = CMD_I2C_RD;
248 req.size = msg[1].len;
249 req.data = &msg[1].buf[0];
250 ret = rtl28xxu_ctrl_msg(d, &req);
252 /* method 3 - new I2C */
253 req.value = (msg[0].addr << 1);
254 req.index = CMD_I2C_DA_WR;
255 req.size = msg[0].len;
256 req.data = msg[0].buf;
257 ret = rtl28xxu_ctrl_msg(d, &req);
259 goto err_mutex_unlock;
261 req.value = (msg[0].addr << 1);
262 req.index = CMD_I2C_DA_RD;
263 req.size = msg[1].len;
264 req.data = msg[1].buf;
265 ret = rtl28xxu_ctrl_msg(d, &req);
267 } else if (num == 1 && !(msg[0].flags & I2C_M_RD)) {
268 if (msg[0].len > 22) {
269 /* TODO: check msg[0].len max */
271 goto err_mutex_unlock;
272 } else if (msg[0].addr == 0x10) {
273 /* method 1 - integrated demod */
274 if (msg[0].buf[0] == 0x00) {
275 /* save demod page for later demod access */
276 priv->page = msg[0].buf[1];
279 req.value = (msg[0].buf[0] << 8) |
281 req.index = CMD_DEMOD_WR | priv->page;
282 req.size = msg[0].len-1;
283 req.data = &msg[0].buf[1];
284 ret = rtl28xxu_ctrl_msg(d, &req);
286 } else if (msg[0].len < 23) {
287 /* method 2 - old I2C */
288 req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
289 req.index = CMD_I2C_WR;
290 req.size = msg[0].len-1;
291 req.data = &msg[0].buf[1];
292 ret = rtl28xxu_ctrl_msg(d, &req);
294 /* method 3 - new I2C */
295 req.value = (msg[0].addr << 1);
296 req.index = CMD_I2C_DA_WR;
297 req.size = msg[0].len;
298 req.data = msg[0].buf;
299 ret = rtl28xxu_ctrl_msg(d, &req);
306 mutex_unlock(&d->i2c_mutex);
308 return ret ? ret : num;
311 static u32 rtl28xxu_i2c_func(struct i2c_adapter *adapter)
316 static struct i2c_algorithm rtl28xxu_i2c_algo = {
317 .master_xfer = rtl28xxu_i2c_xfer,
318 .functionality = rtl28xxu_i2c_func,
321 static int rtl2831u_read_config(struct dvb_usb_device *d)
323 struct rtl28xxu_priv *priv = d_to_priv(d);
326 /* open RTL2831U/RTL2830 I2C gate */
327 struct rtl28xxu_req req_gate_open = {0x0120, 0x0011, 0x0001, "\x08"};
329 struct rtl28xxu_req req_mt2060 = {0x00c0, CMD_I2C_RD, 1, buf};
330 struct rtl28xxu_req req_qt1010 = {0x0fc4, CMD_I2C_RD, 1, buf};
332 dev_dbg(&d->udev->dev, "%s:\n", __func__);
336 * =========================================================
337 * GPIO0 | tuner#0 | 0 off | 1 on | MXL5005S (?)
338 * GPIO2 | LED | 0 off | 1 on |
339 * GPIO4 | tuner#1 | 0 on | 1 off | MT2060
343 ret = rtl28xx_wr_reg(d, SYS_GPIO_DIR, 0x0a);
347 /* enable as output GPIO0, GPIO2, GPIO4 */
348 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_EN, 0x15);
353 * Probe used tuner. We need to know used tuner before demod attach
354 * since there is some demod params needed to set according to tuner.
357 /* demod needs some time to wake up */
360 priv->tuner_name = "NONE";
362 /* open demod I2C gate */
363 ret = rtl28xxu_ctrl_msg(d, &req_gate_open);
367 /* check QT1010 ID(?) register; reg=0f val=2c */
368 ret = rtl28xxu_ctrl_msg(d, &req_qt1010);
369 if (ret == 0 && buf[0] == 0x2c) {
370 priv->tuner = TUNER_RTL2830_QT1010;
371 priv->tuner_name = "QT1010";
375 /* open demod I2C gate */
376 ret = rtl28xxu_ctrl_msg(d, &req_gate_open);
380 /* check MT2060 ID register; reg=00 val=63 */
381 ret = rtl28xxu_ctrl_msg(d, &req_mt2060);
382 if (ret == 0 && buf[0] == 0x63) {
383 priv->tuner = TUNER_RTL2830_MT2060;
384 priv->tuner_name = "MT2060";
388 /* assume MXL5005S */
389 priv->tuner = TUNER_RTL2830_MXL5005S;
390 priv->tuner_name = "MXL5005S";
394 dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name);
398 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
402 static int rtl2832u_read_config(struct dvb_usb_device *d)
404 struct rtl28xxu_priv *priv = d_to_priv(d);
407 /* open RTL2832U/RTL2832 I2C gate */
408 struct rtl28xxu_req req_gate_open = {0x0120, 0x0011, 0x0001, "\x18"};
409 /* close RTL2832U/RTL2832 I2C gate */
410 struct rtl28xxu_req req_gate_close = {0x0120, 0x0011, 0x0001, "\x10"};
412 struct rtl28xxu_req req_fc0012 = {0x00c6, CMD_I2C_RD, 1, buf};
413 struct rtl28xxu_req req_fc0013 = {0x00c6, CMD_I2C_RD, 1, buf};
414 struct rtl28xxu_req req_mt2266 = {0x00c0, CMD_I2C_RD, 1, buf};
415 struct rtl28xxu_req req_fc2580 = {0x01ac, CMD_I2C_RD, 1, buf};
416 struct rtl28xxu_req req_mt2063 = {0x00c0, CMD_I2C_RD, 1, buf};
417 struct rtl28xxu_req req_max3543 = {0x00c0, CMD_I2C_RD, 1, buf};
418 struct rtl28xxu_req req_tua9001 = {0x7ec0, CMD_I2C_RD, 2, buf};
419 struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf};
420 struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf};
421 struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf};
422 struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
423 struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
424 struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf};
426 dev_dbg(&d->udev->dev, "%s:\n", __func__);
428 /* enable GPIO3 and GPIO6 as output */
429 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x40);
433 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x48, 0x48);
438 * Probe used tuner. We need to know used tuner before demod attach
439 * since there is some demod params needed to set according to tuner.
442 /* open demod I2C gate */
443 ret = rtl28xxu_ctrl_msg(d, &req_gate_open);
447 priv->tuner_name = "NONE";
449 /* check FC0012 ID register; reg=00 val=a1 */
450 ret = rtl28xxu_ctrl_msg(d, &req_fc0012);
451 if (ret == 0 && buf[0] == 0xa1) {
452 priv->tuner = TUNER_RTL2832_FC0012;
453 priv->tuner_name = "FC0012";
457 /* check FC0013 ID register; reg=00 val=a3 */
458 ret = rtl28xxu_ctrl_msg(d, &req_fc0013);
459 if (ret == 0 && buf[0] == 0xa3) {
460 priv->tuner = TUNER_RTL2832_FC0013;
461 priv->tuner_name = "FC0013";
465 /* check MT2266 ID register; reg=00 val=85 */
466 ret = rtl28xxu_ctrl_msg(d, &req_mt2266);
467 if (ret == 0 && buf[0] == 0x85) {
468 priv->tuner = TUNER_RTL2832_MT2266;
469 priv->tuner_name = "MT2266";
473 /* check FC2580 ID register; reg=01 val=56 */
474 ret = rtl28xxu_ctrl_msg(d, &req_fc2580);
475 if (ret == 0 && buf[0] == 0x56) {
476 priv->tuner = TUNER_RTL2832_FC2580;
477 priv->tuner_name = "FC2580";
481 /* check MT2063 ID register; reg=00 val=9e || 9c */
482 ret = rtl28xxu_ctrl_msg(d, &req_mt2063);
483 if (ret == 0 && (buf[0] == 0x9e || buf[0] == 0x9c)) {
484 priv->tuner = TUNER_RTL2832_MT2063;
485 priv->tuner_name = "MT2063";
489 /* check MAX3543 ID register; reg=00 val=38 */
490 ret = rtl28xxu_ctrl_msg(d, &req_max3543);
491 if (ret == 0 && buf[0] == 0x38) {
492 priv->tuner = TUNER_RTL2832_MAX3543;
493 priv->tuner_name = "MAX3543";
497 /* check TUA9001 ID register; reg=7e val=2328 */
498 ret = rtl28xxu_ctrl_msg(d, &req_tua9001);
499 if (ret == 0 && buf[0] == 0x23 && buf[1] == 0x28) {
500 priv->tuner = TUNER_RTL2832_TUA9001;
501 priv->tuner_name = "TUA9001";
505 /* check MXL5007R ID register; reg=d9 val=14 */
506 ret = rtl28xxu_ctrl_msg(d, &req_mxl5007t);
507 if (ret == 0 && buf[0] == 0x14) {
508 priv->tuner = TUNER_RTL2832_MXL5007T;
509 priv->tuner_name = "MXL5007T";
513 /* check E4000 ID register; reg=02 val=40 */
514 ret = rtl28xxu_ctrl_msg(d, &req_e4000);
515 if (ret == 0 && buf[0] == 0x40) {
516 priv->tuner = TUNER_RTL2832_E4000;
517 priv->tuner_name = "E4000";
521 /* check TDA18272 ID register; reg=00 val=c760 */
522 ret = rtl28xxu_ctrl_msg(d, &req_tda18272);
523 if (ret == 0 && (buf[0] == 0xc7 || buf[1] == 0x60)) {
524 priv->tuner = TUNER_RTL2832_TDA18272;
525 priv->tuner_name = "TDA18272";
529 /* check R820T ID register; reg=00 val=69 */
530 ret = rtl28xxu_ctrl_msg(d, &req_r820t);
531 if (ret == 0 && buf[0] == 0x69) {
532 priv->tuner = TUNER_RTL2832_R820T;
533 priv->tuner_name = "R820T";
537 /* check R828D ID register; reg=00 val=69 */
538 ret = rtl28xxu_ctrl_msg(d, &req_r828d);
539 if (ret == 0 && buf[0] == 0x69) {
540 priv->tuner = TUNER_RTL2832_R828D;
541 priv->tuner_name = "R828D";
546 dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name);
548 /* probe slave demod */
549 if (priv->tuner == TUNER_RTL2832_R828D) {
550 /* power on MN88472 demod on GPIO0 */
551 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x01, 0x01);
555 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x01);
559 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x01, 0x01);
563 /* check MN88472 answers */
564 ret = rtl28xxu_ctrl_msg(d, &req_mn88472);
565 if (ret == 0 && buf[0] == 0x02) {
566 dev_dbg(&d->udev->dev, "%s: MN88472 found\n", __func__);
567 priv->slave_demod = SLAVE_DEMOD_MN88472;
573 /* close demod I2C gate */
574 ret = rtl28xxu_ctrl_msg(d, &req_gate_close);
580 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
584 static const struct rtl2830_config rtl28xxu_rtl2830_mt2060_config = {
585 .i2c_addr = 0x10, /* 0x20 */
591 .agc_targ_val = 0x2d,
595 static const struct rtl2830_config rtl28xxu_rtl2830_qt1010_config = {
596 .i2c_addr = 0x10, /* 0x20 */
602 .agc_targ_val = 0x2d,
605 static const struct rtl2830_config rtl28xxu_rtl2830_mxl5005s_config = {
606 .i2c_addr = 0x10, /* 0x20 */
612 .agc_targ_val = 0x3e,
615 static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap)
617 struct dvb_usb_device *d = adap_to_d(adap);
618 struct rtl28xxu_priv *priv = d_to_priv(d);
619 const struct rtl2830_config *rtl2830_config;
622 dev_dbg(&d->udev->dev, "%s:\n", __func__);
624 switch (priv->tuner) {
625 case TUNER_RTL2830_QT1010:
626 rtl2830_config = &rtl28xxu_rtl2830_qt1010_config;
628 case TUNER_RTL2830_MT2060:
629 rtl2830_config = &rtl28xxu_rtl2830_mt2060_config;
631 case TUNER_RTL2830_MXL5005S:
632 rtl2830_config = &rtl28xxu_rtl2830_mxl5005s_config;
635 dev_err(&d->udev->dev, "%s: unknown tuner=%s\n",
636 KBUILD_MODNAME, priv->tuner_name);
641 /* attach demodulator */
642 adap->fe[0] = dvb_attach(rtl2830_attach, rtl2830_config, &d->i2c_adap);
650 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
654 static const struct rtl2832_config rtl28xxu_rtl2832_fc0012_config = {
655 .i2c_addr = 0x10, /* 0x20 */
657 .tuner = TUNER_RTL2832_FC0012
660 static const struct rtl2832_config rtl28xxu_rtl2832_fc0013_config = {
661 .i2c_addr = 0x10, /* 0x20 */
663 .tuner = TUNER_RTL2832_FC0013
666 static const struct rtl2832_config rtl28xxu_rtl2832_tua9001_config = {
667 .i2c_addr = 0x10, /* 0x20 */
669 .tuner = TUNER_RTL2832_TUA9001,
672 static const struct rtl2832_config rtl28xxu_rtl2832_e4000_config = {
673 .i2c_addr = 0x10, /* 0x20 */
675 .tuner = TUNER_RTL2832_E4000,
678 static const struct rtl2832_config rtl28xxu_rtl2832_r820t_config = {
681 .tuner = TUNER_RTL2832_R820T,
684 static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
690 dev_dbg(&d->udev->dev, "%s: cmd=%d arg=%d\n", __func__, cmd, arg);
693 case FC_FE_CALLBACK_VHF_ENABLE:
694 /* set output values */
695 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
700 val &= 0xbf; /* set GPIO6 low */
702 val |= 0x40; /* set GPIO6 high */
705 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
715 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
719 static int rtl2832u_tua9001_tuner_callback(struct dvb_usb_device *d,
725 dev_dbg(&d->udev->dev, "%s: cmd=%d arg=%d\n", __func__, cmd, arg);
728 * CEN always enabled by hardware wiring
734 case TUA9001_CMD_RESETN:
740 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x10);
744 case TUA9001_CMD_RXEN:
750 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x02);
758 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
762 static int rtl2832u_tuner_callback(struct dvb_usb_device *d, int cmd, int arg)
764 struct rtl28xxu_priv *priv = d->priv;
766 switch (priv->tuner) {
767 case TUNER_RTL2832_FC0012:
768 return rtl2832u_fc0012_tuner_callback(d, cmd, arg);
769 case TUNER_RTL2832_TUA9001:
770 return rtl2832u_tua9001_tuner_callback(d, cmd, arg);
778 static int rtl2832u_frontend_callback(void *adapter_priv, int component,
781 struct i2c_adapter *adap = adapter_priv;
782 struct dvb_usb_device *d = i2c_get_adapdata(adap);
784 dev_dbg(&d->udev->dev, "%s: component=%d cmd=%d arg=%d\n",
785 __func__, component, cmd, arg);
788 case DVB_FRONTEND_COMPONENT_TUNER:
789 return rtl2832u_tuner_callback(d, cmd, arg);
797 static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
800 struct dvb_usb_device *d = adap_to_d(adap);
801 struct rtl28xxu_priv *priv = d_to_priv(d);
802 const struct rtl2832_config *rtl2832_config;
804 dev_dbg(&d->udev->dev, "%s:\n", __func__);
806 switch (priv->tuner) {
807 case TUNER_RTL2832_FC0012:
808 rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
810 case TUNER_RTL2832_FC0013:
811 rtl2832_config = &rtl28xxu_rtl2832_fc0013_config;
813 case TUNER_RTL2832_FC2580:
814 /* FIXME: do not abuse fc0012 settings */
815 rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
817 case TUNER_RTL2832_TUA9001:
818 rtl2832_config = &rtl28xxu_rtl2832_tua9001_config;
820 case TUNER_RTL2832_E4000:
821 rtl2832_config = &rtl28xxu_rtl2832_e4000_config;
823 case TUNER_RTL2832_R820T:
824 case TUNER_RTL2832_R828D:
825 rtl2832_config = &rtl28xxu_rtl2832_r820t_config;
828 dev_err(&d->udev->dev, "%s: unknown tuner=%s\n",
829 KBUILD_MODNAME, priv->tuner_name);
834 /* attach demodulator */
835 adap->fe[0] = dvb_attach(rtl2832_attach, rtl2832_config, &d->i2c_adap);
841 /* RTL2832 I2C repeater */
842 priv->demod_i2c_adapter = rtl2832_get_i2c_adapter(adap->fe[0]);
844 /* set fe callback */
845 adap->fe[0]->callback = rtl2832u_frontend_callback;
847 if (priv->slave_demod) {
848 struct i2c_board_info info = {};
849 struct i2c_client *client;
852 * We continue on reduced mode, without DVB-T2/C, using master
853 * demod, when slave demod fails.
857 /* attach slave demodulator */
858 if (priv->slave_demod == SLAVE_DEMOD_MN88472) {
859 struct mn88472_config mn88472_config = {};
861 mn88472_config.fe = &adap->fe[1];
862 mn88472_config.i2c_wr_max = 22,
863 strlcpy(info.type, "mn88472", I2C_NAME_SIZE);
865 info.platform_data = &mn88472_config;
866 request_module(info.type);
867 client = i2c_new_device(priv->demod_i2c_adapter, &info);
868 if (client == NULL || client->dev.driver == NULL) {
869 priv->slave_demod = SLAVE_DEMOD_NONE;
870 goto err_slave_demod_failed;
873 if (!try_module_get(client->dev.driver->owner)) {
874 i2c_unregister_device(client);
875 priv->slave_demod = SLAVE_DEMOD_NONE;
876 goto err_slave_demod_failed;
879 priv->i2c_client_slave_demod = client;
884 err_slave_demod_failed:
886 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
890 static struct qt1010_config rtl28xxu_qt1010_config = {
891 .i2c_address = 0x62, /* 0xc4 */
894 static struct mt2060_config rtl28xxu_mt2060_config = {
895 .i2c_address = 0x60, /* 0xc0 */
899 static struct mxl5005s_config rtl28xxu_mxl5005s_config = {
900 .i2c_address = 0x63, /* 0xc6 */
901 .if_freq = IF_FREQ_4570000HZ,
902 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
903 .agc_mode = MXL_SINGLE_AGC,
904 .tracking_filter = MXL_TF_C_H,
905 .rssi_enable = MXL_RSSI_ENABLE,
906 .cap_select = MXL_CAP_SEL_ENABLE,
907 .div_out = MXL_DIV_OUT_4,
908 .clock_out = MXL_CLOCK_OUT_DISABLE,
909 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
910 .top = MXL5005S_TOP_25P2,
911 .mod_mode = MXL_DIGITAL_MODE,
912 .if_mode = MXL_ZERO_IF,
913 .AgcMasterByte = 0x00,
916 static int rtl2831u_tuner_attach(struct dvb_usb_adapter *adap)
919 struct dvb_usb_device *d = adap_to_d(adap);
920 struct rtl28xxu_priv *priv = d_to_priv(d);
921 struct i2c_adapter *rtl2830_tuner_i2c;
922 struct dvb_frontend *fe;
924 dev_dbg(&d->udev->dev, "%s:\n", __func__);
926 /* use rtl2830 driver I2C adapter, for more info see rtl2830 driver */
927 rtl2830_tuner_i2c = rtl2830_get_tuner_i2c_adapter(adap->fe[0]);
929 switch (priv->tuner) {
930 case TUNER_RTL2830_QT1010:
931 fe = dvb_attach(qt1010_attach, adap->fe[0],
932 rtl2830_tuner_i2c, &rtl28xxu_qt1010_config);
934 case TUNER_RTL2830_MT2060:
935 fe = dvb_attach(mt2060_attach, adap->fe[0],
936 rtl2830_tuner_i2c, &rtl28xxu_mt2060_config,
939 case TUNER_RTL2830_MXL5005S:
940 fe = dvb_attach(mxl5005s_attach, adap->fe[0],
941 rtl2830_tuner_i2c, &rtl28xxu_mxl5005s_config);
945 dev_err(&d->udev->dev, "%s: unknown tuner=%d\n", KBUILD_MODNAME,
956 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
960 static const struct fc2580_config rtl2832u_fc2580_config = {
965 static struct tua9001_config rtl2832u_tua9001_config = {
969 static const struct fc0012_config rtl2832u_fc0012_config = {
970 .i2c_address = 0x63, /* 0xc6 >> 1 */
971 .xtal_freq = FC_XTAL_28_8_MHZ,
974 static const struct r820t_config rtl2832u_r820t_config = {
977 .max_i2c_msg_len = 2,
978 .rafael_chip = CHIP_R820T,
981 static const struct r820t_config rtl2832u_r828d_config = {
984 .max_i2c_msg_len = 2,
985 .rafael_chip = CHIP_R828D,
988 static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
991 struct dvb_usb_device *d = adap_to_d(adap);
992 struct rtl28xxu_priv *priv = d_to_priv(d);
993 struct dvb_frontend *fe = NULL;
994 struct i2c_board_info info;
995 struct i2c_client *client;
997 dev_dbg(&d->udev->dev, "%s:\n", __func__);
999 memset(&info, 0, sizeof(struct i2c_board_info));
1001 switch (priv->tuner) {
1002 case TUNER_RTL2832_FC0012:
1003 fe = dvb_attach(fc0012_attach, adap->fe[0],
1004 &d->i2c_adap, &rtl2832u_fc0012_config);
1006 /* since fc0012 includs reading the signal strength delegate
1007 * that to the tuner driver */
1008 adap->fe[0]->ops.read_signal_strength =
1009 adap->fe[0]->ops.tuner_ops.get_rf_strength;
1012 dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap,
1013 &rtl28xxu_rtl2832_fc0012_config, NULL);
1015 case TUNER_RTL2832_FC0013:
1016 fe = dvb_attach(fc0013_attach, adap->fe[0],
1017 &d->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
1019 /* fc0013 also supports signal strength reading */
1020 adap->fe[0]->ops.read_signal_strength =
1021 adap->fe[0]->ops.tuner_ops.get_rf_strength;
1024 dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap,
1025 &rtl28xxu_rtl2832_fc0013_config, NULL);
1027 case TUNER_RTL2832_E4000: {
1028 struct v4l2_subdev *sd;
1029 struct i2c_adapter *i2c_adap_internal =
1030 rtl2832_get_private_i2c_adapter(adap->fe[0]);
1031 struct e4000_config e4000_config = {
1036 strlcpy(info.type, "e4000", I2C_NAME_SIZE);
1038 info.platform_data = &e4000_config;
1040 request_module(info.type);
1041 client = i2c_new_device(priv->demod_i2c_adapter, &info);
1042 if (client == NULL || client->dev.driver == NULL)
1045 if (!try_module_get(client->dev.driver->owner)) {
1046 i2c_unregister_device(client);
1050 priv->client = client;
1051 sd = i2c_get_clientdata(client);
1052 i2c_set_adapdata(i2c_adap_internal, d);
1055 dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0],
1057 &rtl28xxu_rtl2832_e4000_config, sd);
1060 case TUNER_RTL2832_FC2580:
1061 fe = dvb_attach(fc2580_attach, adap->fe[0], &d->i2c_adap,
1062 &rtl2832u_fc2580_config);
1064 case TUNER_RTL2832_TUA9001:
1065 /* enable GPIO1 and GPIO4 as output */
1066 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x12);
1070 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x12, 0x12);
1074 fe = dvb_attach(tua9001_attach, adap->fe[0], &d->i2c_adap,
1075 &rtl2832u_tua9001_config);
1077 case TUNER_RTL2832_R820T:
1078 fe = dvb_attach(r820t_attach, adap->fe[0], &d->i2c_adap,
1079 &rtl2832u_r820t_config);
1081 /* Use tuner to get the signal strength */
1082 adap->fe[0]->ops.read_signal_strength =
1083 adap->fe[0]->ops.tuner_ops.get_rf_strength;
1086 dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap,
1087 &rtl28xxu_rtl2832_r820t_config, NULL);
1089 case TUNER_RTL2832_R828D:
1090 fe = dvb_attach(r820t_attach, adap->fe[0],
1091 priv->demod_i2c_adapter,
1092 &rtl2832u_r828d_config);
1093 adap->fe[0]->ops.read_signal_strength =
1094 adap->fe[0]->ops.tuner_ops.get_rf_strength;
1097 fe = dvb_attach(r820t_attach, adap->fe[1],
1098 priv->demod_i2c_adapter,
1099 &rtl2832u_r828d_config);
1100 adap->fe[1]->ops.read_signal_strength =
1101 adap->fe[1]->ops.tuner_ops.get_rf_strength;
1105 dev_err(&d->udev->dev, "%s: unknown tuner=%d\n", KBUILD_MODNAME,
1109 if (fe == NULL && priv->client == NULL) {
1116 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1120 static int rtl28xxu_init(struct dvb_usb_device *d)
1125 dev_dbg(&d->udev->dev, "%s:\n", __func__);
1127 /* init USB endpoints */
1128 ret = rtl28xx_rd_reg(d, USB_SYSCTL_0, &val);
1132 /* enable DMA and Full Packet Mode*/
1134 ret = rtl28xx_wr_reg(d, USB_SYSCTL_0, val);
1138 /* set EPA maximum packet size to 0x0200 */
1139 ret = rtl28xx_wr_regs(d, USB_EPA_MAXPKT, "\x00\x02\x00\x00", 4);
1143 /* change EPA FIFO length */
1144 ret = rtl28xx_wr_regs(d, USB_EPA_FIFO_CFG, "\x14\x00\x00\x00", 4);
1150 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1154 static void rtl28xxu_exit(struct dvb_usb_device *d)
1156 struct rtl28xxu_priv *priv = d->priv;
1157 struct i2c_client *client;
1159 dev_dbg(&d->udev->dev, "%s:\n", __func__);
1161 /* remove I2C tuner */
1162 client = priv->client;
1164 module_put(client->dev.driver->owner);
1165 i2c_unregister_device(client);
1168 /* remove I2C slave demod */
1169 client = priv->i2c_client_slave_demod;
1171 module_put(client->dev.driver->owner);
1172 i2c_unregister_device(client);
1178 static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff)
1181 u8 gpio, sys0, epa_ctl[2];
1183 dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);
1186 ret = rtl28xx_rd_reg(d, SYS_SYS0, &sys0);
1190 /* tuner power, read GPIOs */
1191 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio);
1195 dev_dbg(&d->udev->dev, "%s: RD SYS0=%02x GPIO_OUT_VAL=%02x\n", __func__,
1199 gpio |= 0x01; /* GPIO0 = 1 */
1200 gpio &= (~0x10); /* GPIO4 = 0 */
1201 gpio |= 0x04; /* GPIO2 = 1, LED on */
1204 epa_ctl[0] = 0x00; /* clear stall */
1205 epa_ctl[1] = 0x00; /* clear reset */
1207 gpio &= (~0x01); /* GPIO0 = 0 */
1208 gpio |= 0x10; /* GPIO4 = 1 */
1209 gpio &= (~0x04); /* GPIO2 = 1, LED off */
1210 sys0 = sys0 & (~0xc0);
1211 epa_ctl[0] = 0x10; /* set stall */
1212 epa_ctl[1] = 0x02; /* set reset */
1215 dev_dbg(&d->udev->dev, "%s: WR SYS0=%02x GPIO_OUT_VAL=%02x\n", __func__,
1219 ret = rtl28xx_wr_reg(d, SYS_SYS0, sys0);
1223 /* tuner power, write GPIOs */
1224 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, gpio);
1228 /* streaming EP: stall & reset */
1229 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, epa_ctl, 2);
1234 usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x81));
1238 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1242 static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
1246 dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);
1249 /* GPIO3=1, GPIO4=0 */
1250 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x08, 0x18);
1255 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL1, 0x00, 0x10);
1260 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x80, 0x80);
1265 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x20, 0x20);
1269 /* streaming EP: clear stall & reset */
1270 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x00\x00", 2);
1274 ret = usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x81));
1279 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x10, 0x10);
1284 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x80);
1288 /* streaming EP: set stall & reset */
1289 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x10\x02", 2);
1296 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1300 static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff)
1302 struct dvb_usb_device *d = fe_to_d(fe);
1303 struct dvb_usb_adapter *adap = fe_to_adap(fe);
1307 dev_dbg(&d->udev->dev, "%s: fe=%d onoff=%d\n", __func__, fe->id, onoff);
1309 /* control internal demod ADC */
1310 if (fe->id == 0 && onoff)
1311 val = 0x48; /* enable ADC */
1313 val = 0x00; /* disable ADC */
1315 ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, val, 0x48);
1319 /* bypass slave demod TS through master demod */
1320 if (fe->id == 1 && onoff) {
1321 ret = rtl2832_enable_external_ts_if(adap->fe[0]);
1328 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1332 #if IS_ENABLED(CONFIG_RC_CORE)
1333 static int rtl2831u_rc_query(struct dvb_usb_device *d)
1336 struct rtl28xxu_priv *priv = d->priv;
1339 struct rtl28xxu_reg_val rc_nec_tab[] = {
1356 /* init remote controller */
1357 if (!priv->rc_active) {
1358 for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
1359 ret = rtl28xx_wr_reg(d, rc_nec_tab[i].reg,
1364 priv->rc_active = true;
1367 ret = rtl2831_rd_regs(d, SYS_IRRC_RP, buf, 5);
1371 if (buf[4] & 0x01) {
1372 if (buf[2] == (u8) ~buf[3]) {
1373 if (buf[0] == (u8) ~buf[1]) {
1374 /* NEC standard (16 bit) */
1375 rc_code = RC_SCANCODE_NEC(buf[0], buf[2]);
1377 /* NEC extended (24 bit) */
1378 rc_code = RC_SCANCODE_NECX(buf[0] << 8 | buf[1],
1382 /* NEC full (32 bit) */
1383 rc_code = RC_SCANCODE_NEC32(buf[0] << 24 | buf[1] << 16 |
1384 buf[2] << 8 | buf[3]);
1387 rc_keydown(d->rc_dev, RC_TYPE_NEC, rc_code, 0);
1389 ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
1393 /* repeated intentionally to avoid extra keypress */
1394 ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
1401 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1405 static int rtl2831u_get_rc_config(struct dvb_usb_device *d,
1406 struct dvb_usb_rc *rc)
1408 rc->map_name = RC_MAP_EMPTY;
1409 rc->allowed_protos = RC_BIT_NEC;
1410 rc->query = rtl2831u_rc_query;
1416 static int rtl2832u_rc_query(struct dvb_usb_device *d)
1419 struct rtl28xxu_priv *priv = d->priv;
1420 struct ir_raw_event ev;
1422 static const struct rtl28xxu_reg_val_mask refresh_tab[] = {
1423 {IR_RX_IF, 0x03, 0xff},
1424 {IR_RX_BUF_CTRL, 0x80, 0xff},
1425 {IR_RX_CTRL, 0x80, 0xff},
1428 /* init remote controller */
1429 if (!priv->rc_active) {
1430 static const struct rtl28xxu_reg_val_mask init_tab[] = {
1431 {SYS_DEMOD_CTL1, 0x00, 0x04},
1432 {SYS_DEMOD_CTL1, 0x00, 0x08},
1433 {USB_CTRL, 0x20, 0x20},
1434 {SYS_GPIO_DIR, 0x00, 0x08},
1435 {SYS_GPIO_OUT_EN, 0x08, 0x08},
1436 {SYS_GPIO_OUT_VAL, 0x08, 0x08},
1437 {IR_MAX_DURATION0, 0xd0, 0xff},
1438 {IR_MAX_DURATION1, 0x07, 0xff},
1439 {IR_IDLE_LEN0, 0xc0, 0xff},
1440 {IR_IDLE_LEN1, 0x00, 0xff},
1441 {IR_GLITCH_LEN, 0x03, 0xff},
1442 {IR_RX_CLK, 0x09, 0xff},
1443 {IR_RX_CFG, 0x1c, 0xff},
1444 {IR_MAX_H_TOL_LEN, 0x1e, 0xff},
1445 {IR_MAX_L_TOL_LEN, 0x1e, 0xff},
1446 {IR_RX_CTRL, 0x80, 0xff},
1449 for (i = 0; i < ARRAY_SIZE(init_tab); i++) {
1450 ret = rtl28xx_wr_reg_mask(d, init_tab[i].reg,
1451 init_tab[i].val, init_tab[i].mask);
1456 priv->rc_active = true;
1459 ret = rtl28xx_rd_reg(d, IR_RX_IF, &buf[0]);
1466 ret = rtl28xx_rd_reg(d, IR_RX_BC, &buf[0]);
1472 /* read raw code from hw */
1473 ret = rtl2831_rd_regs(d, IR_RX_BUF, buf, len);
1477 /* let hw receive new code */
1478 for (i = 0; i < ARRAY_SIZE(refresh_tab); i++) {
1479 ret = rtl28xx_wr_reg_mask(d, refresh_tab[i].reg,
1480 refresh_tab[i].val, refresh_tab[i].mask);
1485 /* pass data to Kernel IR decoder */
1486 init_ir_raw_event(&ev);
1488 for (i = 0; i < len; i++) {
1489 ev.pulse = buf[i] >> 7;
1490 ev.duration = 50800 * (buf[i] & 0x7f);
1491 ir_raw_event_store_with_filter(d->rc_dev, &ev);
1494 /* 'flush' ir_raw_event_store_with_filter() */
1495 ir_raw_event_set_idle(d->rc_dev, true);
1496 ir_raw_event_handle(d->rc_dev);
1500 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
1504 static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
1505 struct dvb_usb_rc *rc)
1507 /* disable IR interrupts in order to avoid SDR sample loss */
1508 if (rtl28xxu_disable_rc)
1509 return rtl28xx_wr_reg(d, IR_RX_IE, 0x00);
1511 /* load empty to enable rc */
1513 rc->map_name = RC_MAP_EMPTY;
1514 rc->allowed_protos = RC_BIT_ALL;
1515 rc->driver_type = RC_DRIVER_IR_RAW;
1516 rc->query = rtl2832u_rc_query;
1522 #define rtl2831u_get_rc_config NULL
1523 #define rtl2832u_get_rc_config NULL
1526 static const struct dvb_usb_device_properties rtl2831u_props = {
1527 .driver_name = KBUILD_MODNAME,
1528 .owner = THIS_MODULE,
1529 .adapter_nr = adapter_nr,
1530 .size_of_priv = sizeof(struct rtl28xxu_priv),
1532 .power_ctrl = rtl2831u_power_ctrl,
1533 .i2c_algo = &rtl28xxu_i2c_algo,
1534 .read_config = rtl2831u_read_config,
1535 .frontend_attach = rtl2831u_frontend_attach,
1536 .tuner_attach = rtl2831u_tuner_attach,
1537 .init = rtl28xxu_init,
1538 .get_rc_config = rtl2831u_get_rc_config,
1543 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512),
1548 static const struct dvb_usb_device_properties rtl2832u_props = {
1549 .driver_name = KBUILD_MODNAME,
1550 .owner = THIS_MODULE,
1551 .adapter_nr = adapter_nr,
1552 .size_of_priv = sizeof(struct rtl28xxu_priv),
1554 .power_ctrl = rtl2832u_power_ctrl,
1555 .frontend_ctrl = rtl2832u_frontend_ctrl,
1556 .i2c_algo = &rtl28xxu_i2c_algo,
1557 .read_config = rtl2832u_read_config,
1558 .frontend_attach = rtl2832u_frontend_attach,
1559 .tuner_attach = rtl2832u_tuner_attach,
1560 .init = rtl28xxu_init,
1561 .exit = rtl28xxu_exit,
1562 .get_rc_config = rtl2832u_get_rc_config,
1567 .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512),
1572 static const struct usb_device_id rtl28xxu_id_table[] = {
1573 /* RTL2831U devices: */
1574 { DVB_USB_DEVICE(USB_VID_REALTEK, USB_PID_REALTEK_RTL2831U,
1575 &rtl2831u_props, "Realtek RTL2831U reference design", NULL) },
1576 { DVB_USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT,
1577 &rtl2831u_props, "Freecom USB2.0 DVB-T", NULL) },
1578 { DVB_USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT_2,
1579 &rtl2831u_props, "Freecom USB2.0 DVB-T", NULL) },
1581 /* RTL2832U devices: */
1582 { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2832,
1583 &rtl2832u_props, "Realtek RTL2832U reference design", NULL) },
1584 { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2838,
1585 &rtl2832u_props, "Realtek RTL2832U reference design", NULL) },
1586 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV1,
1587 &rtl2832u_props, "TerraTec Cinergy T Stick Black", RC_MAP_TERRATEC_SLIM) },
1588 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_DELOCK_USB2_DVBT,
1589 &rtl2832u_props, "G-Tek Electronics Group Lifeview LV5TDLX DVB-T", NULL) },
1590 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK,
1591 &rtl2832u_props, "TerraTec NOXON DAB Stick", NULL) },
1592 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV2,
1593 &rtl2832u_props, "TerraTec NOXON DAB Stick (rev 2)", NULL) },
1594 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV3,
1595 &rtl2832u_props, "TerraTec NOXON DAB Stick (rev 3)", NULL) },
1596 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_TREKSTOR_TERRES_2_0,
1597 &rtl2832u_props, "Trekstor DVB-T Stick Terres 2.0", NULL) },
1598 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1101,
1599 &rtl2832u_props, "Dexatek DK DVB-T Dongle", NULL) },
1600 { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6680,
1601 &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) },
1602 { DVB_USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_MINID,
1603 &rtl2832u_props, "Leadtek Winfast DTV Dongle Mini D", NULL) },
1604 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3,
1605 &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) },
1606 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1102,
1607 &rtl2832u_props, "Dexatek DK mini DVB-T Dongle", NULL) },
1608 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d7,
1609 &rtl2832u_props, "TerraTec Cinergy T Stick+", NULL) },
1610 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd3a8,
1611 &rtl2832u_props, "ASUS My Cinema-U3100Mini Plus V2", NULL) },
1612 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd393,
1613 &rtl2832u_props, "GIGABYTE U7300", NULL) },
1614 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1104,
1615 &rtl2832u_props, "MSI DIGIVOX Micro HD", NULL) },
1616 { DVB_USB_DEVICE(USB_VID_COMPRO, 0x0620,
1617 &rtl2832u_props, "Compro VideoMate U620F", NULL) },
1618 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd394,
1619 &rtl2832u_props, "MaxMedia HU394-T", NULL) },
1620 { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a03,
1621 &rtl2832u_props, "Leadtek WinFast DTV Dongle mini", NULL) },
1622 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_CPYTO_REDI_PC50A,
1623 &rtl2832u_props, "Crypto ReDi PC 50 A", NULL) },
1624 { DVB_USB_DEVICE(USB_VID_KYE, 0x707f,
1625 &rtl2832u_props, "Genius TVGo DVB-T03", NULL) },
1626 { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd395,
1627 &rtl2832u_props, "Peak DVB-T USB", NULL) },
1628 { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20_RTL2832U,
1629 &rtl2832u_props, "Sveon STV20", NULL) },
1630 { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV21,
1631 &rtl2832u_props, "Sveon STV21", NULL) },
1632 { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV27,
1633 &rtl2832u_props, "Sveon STV27", NULL) },
1635 /* RTL2832P devices: */
1636 { DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131,
1637 &rtl2832u_props, "Astrometa DVB-T2", NULL) },
1640 MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
1642 static struct usb_driver rtl28xxu_usb_driver = {
1643 .name = KBUILD_MODNAME,
1644 .id_table = rtl28xxu_id_table,
1645 .probe = dvb_usbv2_probe,
1646 .disconnect = dvb_usbv2_disconnect,
1647 .suspend = dvb_usbv2_suspend,
1648 .resume = dvb_usbv2_resume,
1649 .reset_resume = dvb_usbv2_reset_resume,
1654 module_usb_driver(rtl28xxu_usb_driver);
1656 MODULE_DESCRIPTION("Realtek RTL28xxU DVB USB driver");
1657 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1658 MODULE_AUTHOR("Thomas Mair <thomas.mair86@googlemail.com>");
1659 MODULE_LICENSE("GPL");