diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-06 08:40:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-16 20:19:10 -0400 |
commit | 6889ab2a25cf39a048edc69b4d61884b8b4da6b0 (patch) | |
tree | 339e8764beb1f34295950af04761cd759e520b98 | |
parent | a80abc58feda48f868d748bde8c88592c2892b1d (diff) |
[media] rtl28xxu: add support for Rafael Micro r820t
This tuner is used on some rtl2882 dongles. Add it to the driver.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/Kconfig | 1 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 30 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/rtl28xxu.h | 1 |
3 files changed, 32 insertions, 0 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 9aff03555464..a3c8ecf22078 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig | |||
@@ -143,6 +143,7 @@ config DVB_USB_RTL28XXU | |||
143 | select MEDIA_TUNER_FC0013 if MEDIA_SUBDRV_AUTOSELECT | 143 | select MEDIA_TUNER_FC0013 if MEDIA_SUBDRV_AUTOSELECT |
144 | select MEDIA_TUNER_E4000 if MEDIA_SUBDRV_AUTOSELECT | 144 | select MEDIA_TUNER_E4000 if MEDIA_SUBDRV_AUTOSELECT |
145 | select MEDIA_TUNER_FC2580 if MEDIA_SUBDRV_AUTOSELECT | 145 | select MEDIA_TUNER_FC2580 if MEDIA_SUBDRV_AUTOSELECT |
146 | select MEDIA_TUNER_R820T if MEDIA_SUBDRV_AUTOSELECT | ||
146 | help | 147 | help |
147 | Say Y here to support the Realtek RTL28xxU DVB USB receiver. | 148 | Say Y here to support the Realtek RTL28xxU DVB USB receiver. |
148 | 149 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index 3d128a5e4794..18756a6d03d5 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "e4000.h" | 33 | #include "e4000.h" |
34 | #include "fc2580.h" | 34 | #include "fc2580.h" |
35 | #include "tua9001.h" | 35 | #include "tua9001.h" |
36 | #include "r820t.h" | ||
36 | 37 | ||
37 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 38 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
38 | 39 | ||
@@ -375,6 +376,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d) | |||
375 | struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf}; | 376 | struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf}; |
376 | struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf}; | 377 | struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf}; |
377 | struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf}; | 378 | struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf}; |
379 | struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 5, buf}; | ||
378 | 380 | ||
379 | dev_dbg(&d->udev->dev, "%s:\n", __func__); | 381 | dev_dbg(&d->udev->dev, "%s:\n", __func__); |
380 | 382 | ||
@@ -479,6 +481,14 @@ static int rtl2832u_read_config(struct dvb_usb_device *d) | |||
479 | goto found; | 481 | goto found; |
480 | } | 482 | } |
481 | 483 | ||
484 | /* check R820T by reading tuner stats at I2C addr 0x1a */ | ||
485 | ret = rtl28xxu_ctrl_msg(d, &req_r820t); | ||
486 | if (ret == 0) { | ||
487 | priv->tuner = TUNER_RTL2832_R820T; | ||
488 | priv->tuner_name = "R820T"; | ||
489 | goto found; | ||
490 | } | ||
491 | |||
482 | found: | 492 | found: |
483 | dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name); | 493 | dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name); |
484 | 494 | ||
@@ -589,6 +599,12 @@ static struct rtl2832_config rtl28xxu_rtl2832_e4000_config = { | |||
589 | .tuner = TUNER_RTL2832_E4000, | 599 | .tuner = TUNER_RTL2832_E4000, |
590 | }; | 600 | }; |
591 | 601 | ||
602 | static struct rtl2832_config rtl28xxu_rtl2832_r820t_config = { | ||
603 | .i2c_addr = 0x10, | ||
604 | .xtal = 28800000, | ||
605 | .tuner = TUNER_RTL2832_R820T, | ||
606 | }; | ||
607 | |||
592 | static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d, | 608 | static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d, |
593 | int cmd, int arg) | 609 | int cmd, int arg) |
594 | { | 610 | { |
@@ -728,6 +744,9 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) | |||
728 | case TUNER_RTL2832_E4000: | 744 | case TUNER_RTL2832_E4000: |
729 | rtl2832_config = &rtl28xxu_rtl2832_e4000_config; | 745 | rtl2832_config = &rtl28xxu_rtl2832_e4000_config; |
730 | break; | 746 | break; |
747 | case TUNER_RTL2832_R820T: | ||
748 | rtl2832_config = &rtl28xxu_rtl2832_r820t_config; | ||
749 | break; | ||
731 | default: | 750 | default: |
732 | dev_err(&d->udev->dev, "%s: unknown tuner=%s\n", | 751 | dev_err(&d->udev->dev, "%s: unknown tuner=%s\n", |
733 | KBUILD_MODNAME, priv->tuner_name); | 752 | KBUILD_MODNAME, priv->tuner_name); |
@@ -840,6 +859,13 @@ static const struct fc0012_config rtl2832u_fc0012_config = { | |||
840 | .xtal_freq = FC_XTAL_28_8_MHZ, | 859 | .xtal_freq = FC_XTAL_28_8_MHZ, |
841 | }; | 860 | }; |
842 | 861 | ||
862 | static const struct r820t_config rtl2832u_r820t_config = { | ||
863 | .i2c_addr = 0x1a, | ||
864 | .xtal = 28800000, | ||
865 | .max_i2c_msg_len = 2, | ||
866 | .rafael_chip = CHIP_R820T, | ||
867 | }; | ||
868 | |||
843 | static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) | 869 | static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) |
844 | { | 870 | { |
845 | int ret; | 871 | int ret; |
@@ -889,6 +915,10 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) | |||
889 | fe = dvb_attach(tua9001_attach, adap->fe[0], &d->i2c_adap, | 915 | fe = dvb_attach(tua9001_attach, adap->fe[0], &d->i2c_adap, |
890 | &rtl2832u_tua9001_config); | 916 | &rtl2832u_tua9001_config); |
891 | break; | 917 | break; |
918 | case TUNER_RTL2832_R820T: | ||
919 | fe = dvb_attach(r820t_attach, adap->fe[0], &d->i2c_adap, | ||
920 | &rtl2832u_r820t_config); | ||
921 | break; | ||
892 | default: | 922 | default: |
893 | fe = NULL; | 923 | fe = NULL; |
894 | dev_err(&d->udev->dev, "%s: unknown tuner=%d\n", KBUILD_MODNAME, | 924 | dev_err(&d->udev->dev, "%s: unknown tuner=%d\n", KBUILD_MODNAME, |
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h index 2f3af2d3b6ce..533a33127289 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h | |||
@@ -82,6 +82,7 @@ enum rtl28xxu_tuner { | |||
82 | TUNER_RTL2832_E4000, | 82 | TUNER_RTL2832_E4000, |
83 | TUNER_RTL2832_TDA18272, | 83 | TUNER_RTL2832_TDA18272, |
84 | TUNER_RTL2832_FC0013, | 84 | TUNER_RTL2832_FC0013, |
85 | TUNER_RTL2832_R820T, | ||
85 | }; | 86 | }; |
86 | 87 | ||
87 | struct rtl28xxu_req { | 88 | struct rtl28xxu_req { |