aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2013-11-28 17:15:19 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-21 13:03:39 -0500
commitfe37b38bbb7145e080b094b790ba8427945c6ecc (patch)
treef3b09e707aa367a0bf2ac46919a4aff5f67120ec /drivers
parentdb85a0403be4a59cf536a25622fe110feefba8d3 (diff)
[media] rtl2832: implement option to bypass slave demod TS
Implement partial PIP mode to carry TS from slave demodulator, through that master demodulator. RTL2832 demod has TS input interface to connected another demodulator TS output. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb-frontends/rtl2832.c60
-rw-r--r--drivers/media/dvb-frontends/rtl2832.h11
2 files changed, 68 insertions, 3 deletions
diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c
index eb737cf29a36..9026e1aee163 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -258,13 +258,11 @@ static int rtl2832_rd_regs(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val,
258 return rtl2832_rd(priv, reg, val, len); 258 return rtl2832_rd(priv, reg, val, len);
259} 259}
260 260
261#if 0 /* currently not used */
262/* write single register */ 261/* write single register */
263static int rtl2832_wr_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 val) 262static int rtl2832_wr_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 val)
264{ 263{
265 return rtl2832_wr_regs(priv, reg, page, &val, 1); 264 return rtl2832_wr_regs(priv, reg, page, &val, 1);
266} 265}
267#endif
268 266
269/* read single register */ 267/* read single register */
270static int rtl2832_rd_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val) 268static int rtl2832_rd_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val)
@@ -599,6 +597,11 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
599 if (fe->ops.tuner_ops.set_params) 597 if (fe->ops.tuner_ops.set_params)
600 fe->ops.tuner_ops.set_params(fe); 598 fe->ops.tuner_ops.set_params(fe);
601 599
600 /* PIP mode related */
601 ret = rtl2832_wr_regs(priv, 0x92, 1, "\x00\x0f\xff", 3);
602 if (ret)
603 goto err;
604
602 /* If the frontend has get_if_frequency(), use it */ 605 /* If the frontend has get_if_frequency(), use it */
603 if (fe->ops.tuner_ops.get_if_frequency) { 606 if (fe->ops.tuner_ops.get_if_frequency) {
604 u32 if_freq; 607 u32 if_freq;
@@ -661,7 +664,6 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
661 if (ret) 664 if (ret)
662 goto err; 665 goto err;
663 666
664
665 /* soft reset */ 667 /* soft reset */
666 ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x1); 668 ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x1);
667 if (ret) 669 if (ret)
@@ -1020,6 +1022,58 @@ static int rtl2832_deselect(struct i2c_adapter *adap, void *mux_priv,
1020 return 0; 1022 return 0;
1021} 1023}
1022 1024
1025int rtl2832_enable_external_ts_if(struct dvb_frontend *fe)
1026{
1027 struct rtl2832_priv *priv = fe->demodulator_priv;
1028 int ret;
1029
1030 dev_dbg(&priv->i2c->dev, "%s: setting PIP mode\n", __func__);
1031
1032 ret = rtl2832_wr_regs(priv, 0x0c, 1, "\x5f\xff", 2);
1033 if (ret)
1034 goto err;
1035
1036 ret = rtl2832_wr_demod_reg(priv, DVBT_PIP_ON, 0x1);
1037 if (ret)
1038 goto err;
1039
1040 ret = rtl2832_wr_reg(priv, 0xbc, 0, 0x18);
1041 if (ret)
1042 goto err;
1043
1044 ret = rtl2832_wr_reg(priv, 0x22, 0, 0x01);
1045 if (ret)
1046 goto err;
1047
1048 ret = rtl2832_wr_reg(priv, 0x26, 0, 0x1f);
1049 if (ret)
1050 goto err;
1051
1052 ret = rtl2832_wr_reg(priv, 0x27, 0, 0xff);
1053 if (ret)
1054 goto err;
1055
1056 ret = rtl2832_wr_regs(priv, 0x92, 1, "\x7f\xf7\xff", 3);
1057 if (ret)
1058 goto err;
1059
1060 /* soft reset */
1061 ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x1);
1062 if (ret)
1063 goto err;
1064
1065 ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x0);
1066 if (ret)
1067 goto err;
1068
1069 return 0;
1070err:
1071 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
1072 return ret;
1073
1074}
1075EXPORT_SYMBOL(rtl2832_enable_external_ts_if);
1076
1023struct i2c_adapter *rtl2832_get_i2c_adapter(struct dvb_frontend *fe) 1077struct i2c_adapter *rtl2832_get_i2c_adapter(struct dvb_frontend *fe)
1024{ 1078{
1025 struct rtl2832_priv *priv = fe->demodulator_priv; 1079 struct rtl2832_priv *priv = fe->demodulator_priv;
diff --git a/drivers/media/dvb-frontends/rtl2832.h b/drivers/media/dvb-frontends/rtl2832.h
index cb3b6b0775b8..5254c1dfc8de 100644
--- a/drivers/media/dvb-frontends/rtl2832.h
+++ b/drivers/media/dvb-frontends/rtl2832.h
@@ -64,6 +64,10 @@ extern struct i2c_adapter *rtl2832_get_private_i2c_adapter(
64 struct dvb_frontend *fe 64 struct dvb_frontend *fe
65); 65);
66 66
67extern int rtl2832_enable_external_ts_if(
68 struct dvb_frontend *fe
69);
70
67#else 71#else
68 72
69static inline struct dvb_frontend *rtl2832_attach( 73static inline struct dvb_frontend *rtl2832_attach(
@@ -89,6 +93,13 @@ static inline struct i2c_adapter *rtl2832_get_private_i2c_adapter(
89 return NULL; 93 return NULL;
90} 94}
91 95
96static inline int rtl2832_enable_external_ts_if(
97 struct dvb_frontend *fe
98)
99{
100 return -ENODEV;
101}
102
92#endif 103#endif
93 104
94 105