Commit fe37b38b authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[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: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent db85a040
...@@ -258,13 +258,11 @@ static int rtl2832_rd_regs(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val, ...@@ -258,13 +258,11 @@ static int rtl2832_rd_regs(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val,
return rtl2832_rd(priv, reg, val, len); return rtl2832_rd(priv, reg, val, len);
} }
#if 0 /* currently not used */
/* write single register */ /* write single register */
static int rtl2832_wr_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 val) static int rtl2832_wr_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 val)
{ {
return rtl2832_wr_regs(priv, reg, page, &val, 1); return rtl2832_wr_regs(priv, reg, page, &val, 1);
} }
#endif
/* read single register */ /* read single register */
static int rtl2832_rd_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val) static 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,6 +597,11 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
if (fe->ops.tuner_ops.set_params) if (fe->ops.tuner_ops.set_params)
fe->ops.tuner_ops.set_params(fe); fe->ops.tuner_ops.set_params(fe);
/* PIP mode related */
ret = rtl2832_wr_regs(priv, 0x92, 1, "\x00\x0f\xff", 3);
if (ret)
goto err;
/* If the frontend has get_if_frequency(), use it */ /* If the frontend has get_if_frequency(), use it */
if (fe->ops.tuner_ops.get_if_frequency) { if (fe->ops.tuner_ops.get_if_frequency) {
u32 if_freq; u32 if_freq;
...@@ -661,7 +664,6 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe) ...@@ -661,7 +664,6 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
if (ret) if (ret)
goto err; goto err;
/* soft reset */ /* soft reset */
ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x1); ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x1);
if (ret) if (ret)
...@@ -1020,6 +1022,58 @@ static int rtl2832_deselect(struct i2c_adapter *adap, void *mux_priv, ...@@ -1020,6 +1022,58 @@ static int rtl2832_deselect(struct i2c_adapter *adap, void *mux_priv,
return 0; return 0;
} }
int rtl2832_enable_external_ts_if(struct dvb_frontend *fe)
{
struct rtl2832_priv *priv = fe->demodulator_priv;
int ret;
dev_dbg(&priv->i2c->dev, "%s: setting PIP mode\n", __func__);
ret = rtl2832_wr_regs(priv, 0x0c, 1, "\x5f\xff", 2);
if (ret)
goto err;
ret = rtl2832_wr_demod_reg(priv, DVBT_PIP_ON, 0x1);
if (ret)
goto err;
ret = rtl2832_wr_reg(priv, 0xbc, 0, 0x18);
if (ret)
goto err;
ret = rtl2832_wr_reg(priv, 0x22, 0, 0x01);
if (ret)
goto err;
ret = rtl2832_wr_reg(priv, 0x26, 0, 0x1f);
if (ret)
goto err;
ret = rtl2832_wr_reg(priv, 0x27, 0, 0xff);
if (ret)
goto err;
ret = rtl2832_wr_regs(priv, 0x92, 1, "\x7f\xf7\xff", 3);
if (ret)
goto err;
/* soft reset */
ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x1);
if (ret)
goto err;
ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x0);
if (ret)
goto err;
return 0;
err:
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
EXPORT_SYMBOL(rtl2832_enable_external_ts_if);
struct i2c_adapter *rtl2832_get_i2c_adapter(struct dvb_frontend *fe) struct i2c_adapter *rtl2832_get_i2c_adapter(struct dvb_frontend *fe)
{ {
struct rtl2832_priv *priv = fe->demodulator_priv; struct rtl2832_priv *priv = fe->demodulator_priv;
......
...@@ -64,6 +64,10 @@ extern struct i2c_adapter *rtl2832_get_private_i2c_adapter( ...@@ -64,6 +64,10 @@ extern struct i2c_adapter *rtl2832_get_private_i2c_adapter(
struct dvb_frontend *fe struct dvb_frontend *fe
); );
extern int rtl2832_enable_external_ts_if(
struct dvb_frontend *fe
);
#else #else
static inline struct dvb_frontend *rtl2832_attach( static inline struct dvb_frontend *rtl2832_attach(
...@@ -89,6 +93,13 @@ static inline struct i2c_adapter *rtl2832_get_private_i2c_adapter( ...@@ -89,6 +93,13 @@ static inline struct i2c_adapter *rtl2832_get_private_i2c_adapter(
return NULL; return NULL;
} }
static inline int rtl2832_enable_external_ts_if(
struct dvb_frontend *fe
)
{
return -ENODEV;
}
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment