aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2013-10-29 23:45:38 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-10-31 04:09:49 -0400
commit8b4cac1a12708c9e1f34f256b62706fef7ad2295 (patch)
tree9c80d095199db730e1d32e0b7672be645eac4a98 /drivers/media
parenta26758edff8e65b598213112521fe411ac2933ae (diff)
[media] rtl28xxu: add RTL2832P + R828D support
RTL2832P is version of RTL2832U with extra TS interface. As for now, we support only integrated RTL2832 demod. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/dvb-usb-v2/rtl28xxu.c39
-rw-r--r--drivers/media/usb/dvb-usb-v2/rtl28xxu.h1
2 files changed, 40 insertions, 0 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index c0cd0848631b..8c600b70d20e 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -377,6 +377,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
377 struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf}; 377 struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf};
378 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, 1, buf}; 379 struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
380 struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
380 381
381 dev_dbg(&d->udev->dev, "%s:\n", __func__); 382 dev_dbg(&d->udev->dev, "%s:\n", __func__);
382 383
@@ -489,6 +490,15 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
489 goto found; 490 goto found;
490 } 491 }
491 492
493 /* check R828D ID register; reg=00 val=69 */
494 ret = rtl28xxu_ctrl_msg(d, &req_r828d);
495 if (ret == 0 && buf[0] == 0x69) {
496 priv->tuner = TUNER_RTL2832_R828D;
497 priv->tuner_name = "R828D";
498 goto found;
499 }
500
501
492found: 502found:
493 dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name); 503 dev_dbg(&d->udev->dev, "%s: tuner=%s\n", __func__, priv->tuner_name);
494 504
@@ -745,6 +755,7 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
745 rtl2832_config = &rtl28xxu_rtl2832_e4000_config; 755 rtl2832_config = &rtl28xxu_rtl2832_e4000_config;
746 break; 756 break;
747 case TUNER_RTL2832_R820T: 757 case TUNER_RTL2832_R820T:
758 case TUNER_RTL2832_R828D:
748 rtl2832_config = &rtl28xxu_rtl2832_r820t_config; 759 rtl2832_config = &rtl28xxu_rtl2832_r820t_config;
749 break; 760 break;
750 default: 761 default:
@@ -866,6 +877,13 @@ static const struct r820t_config rtl2832u_r820t_config = {
866 .rafael_chip = CHIP_R820T, 877 .rafael_chip = CHIP_R820T,
867}; 878};
868 879
880static const struct r820t_config rtl2832u_r828d_config = {
881 .i2c_addr = 0x3a,
882 .xtal = 16000000,
883 .max_i2c_msg_len = 2,
884 .rafael_chip = CHIP_R828D,
885};
886
869static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) 887static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
870{ 888{
871 int ret; 889 int ret;
@@ -923,6 +941,27 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
923 adap->fe[0]->ops.read_signal_strength = 941 adap->fe[0]->ops.read_signal_strength =
924 adap->fe[0]->ops.tuner_ops.get_rf_strength; 942 adap->fe[0]->ops.tuner_ops.get_rf_strength;
925 break; 943 break;
944 case TUNER_RTL2832_R828D:
945 /* power off mn88472 demod on GPIO0 */
946 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x00, 0x01);
947 if (ret)
948 goto err;
949
950 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x01);
951 if (ret)
952 goto err;
953
954 ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x01, 0x01);
955 if (ret)
956 goto err;
957
958 fe = dvb_attach(r820t_attach, adap->fe[0], &d->i2c_adap,
959 &rtl2832u_r828d_config);
960
961 /* Use tuner to get the signal strength */
962 adap->fe[0]->ops.read_signal_strength =
963 adap->fe[0]->ops.tuner_ops.get_rf_strength;
964 break;
926 default: 965 default:
927 fe = NULL; 966 fe = NULL;
928 dev_err(&d->udev->dev, "%s: unknown tuner=%d\n", KBUILD_MODNAME, 967 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 729b3540c2f9..2142bcb41b41 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
@@ -83,6 +83,7 @@ enum rtl28xxu_tuner {
83 TUNER_RTL2832_TDA18272, 83 TUNER_RTL2832_TDA18272,
84 TUNER_RTL2832_FC0013, 84 TUNER_RTL2832_FC0013,
85 TUNER_RTL2832_R820T, 85 TUNER_RTL2832_R820T,
86 TUNER_RTL2832_R828D,
86}; 87};
87 88
88struct rtl28xxu_req { 89struct rtl28xxu_req {