diff options
author | Antti Palosaari <crope@iki.fi> | 2013-11-26 19:53:46 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-05 22:38:28 +0400 |
commit | 8823f0288d345a26b27502c71f8ca3d05b4ac013 (patch) | |
tree | 12c7419d42bd1873db13cdea116635498c9d98a0 /drivers/media/dvb-frontends/rtl2832.c | |
parent | 3ca2418d707c9eeafa76f6096eb8e06d1cfa8bdb (diff) | |
download | linux-8823f0288d345a26b27502c71f8ca3d05b4ac013.tar.xz |
[media] rtl2832: provide muxed I2C adapter
RTL2832 provides gated / repeater I2C adapter for tuner.
Implement it as a muxed I2C adapter.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends/rtl2832.c')
-rw-r--r-- | drivers/media/dvb-frontends/rtl2832.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index 00e63b9f104d..dc46cf0841e0 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -891,9 +891,29 @@ static void rtl2832_release(struct dvb_frontend *fe) struct rtl2832_priv *priv = fe->demodulator_priv; dev_dbg(&priv->i2c->dev, "%s:\n", __func__); + i2c_del_mux_adapter(priv->i2c_adapter); kfree(priv); } +static int rtl2832_select(struct i2c_adapter *adap, void *mux_priv, u32 chan) +{ + struct rtl2832_priv *priv = mux_priv; + return rtl2832_i2c_gate_ctrl(&priv->fe, 1); +} + +static int rtl2832_deselect(struct i2c_adapter *adap, void *mux_priv, u32 chan) +{ + struct rtl2832_priv *priv = mux_priv; + return rtl2832_i2c_gate_ctrl(&priv->fe, 0); +} + +struct i2c_adapter *rtl2832_get_i2c_adapter(struct dvb_frontend *fe) +{ + struct rtl2832_priv *priv = fe->demodulator_priv; + return priv->i2c_adapter; +} +EXPORT_SYMBOL(rtl2832_get_i2c_adapter); + struct dvb_frontend *rtl2832_attach(const struct rtl2832_config *cfg, struct i2c_adapter *i2c) { @@ -918,6 +938,12 @@ struct dvb_frontend *rtl2832_attach(const struct rtl2832_config *cfg, if (ret) goto err; + /* create muxed i2c adapter */ + priv->i2c_adapter = i2c_add_mux_adapter(i2c, &i2c->dev, priv, 0, 0, 0, + rtl2832_select, rtl2832_deselect); + if (priv->i2c_adapter == NULL) + goto err; + /* create dvb_frontend */ memcpy(&priv->fe.ops, &rtl2832_ops, sizeof(struct dvb_frontend_ops)); priv->fe.demodulator_priv = priv; |