diff options
author | Antti Palosaari <crope@iki.fi> | 2016-02-05 18:26:30 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-03-03 09:26:49 -0300 |
commit | d884acad4fe728b30b55d166089fb9f092b336ed (patch) | |
tree | 685e457091916a6b1688ea3285469368b82f4285 /drivers/media/dvb-frontends/rtl2832.c | |
parent | 7908fad99a6cc08a41c666d425df42809b34dce2 (diff) | |
download | linux-d884acad4fe728b30b55d166089fb9f092b336ed.tar.gz linux-d884acad4fe728b30b55d166089fb9f092b336ed.tar.bz2 linux-d884acad4fe728b30b55d166089fb9f092b336ed.zip |
[media] rtl2832: improve slave TS control
Add callback parameter to select enable / disable slave TS and use
it when slave demod is in use.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends/rtl2832.c')
-rw-r--r-- | drivers/media/dvb-frontends/rtl2832.c | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index c2469fb42f12..8c6971121ed5 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -347,6 +347,10 @@ static int rtl2832_init(struct dvb_frontend *fe) dev_dbg(&client->dev, "\n"); + ret = rtl2832_wr_demod_reg(dev, DVBT_SOFT_RST, 0x0); + if (ret) + goto err; + for (i = 0; i < ARRAY_SIZE(rtl2832_initial_regs); i++) { ret = rtl2832_wr_demod_reg(dev, rtl2832_initial_regs[i].reg, rtl2832_initial_regs[i].value); @@ -491,11 +495,6 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe) if (fe->ops.tuner_ops.set_params) fe->ops.tuner_ops.set_params(fe); - /* PIP mode related */ - ret = rtl2832_bulk_write(client, 0x192, "\x00\x0f\xff", 3); - if (ret) - goto err; - /* If the frontend has get_if_frequency(), use it */ if (fe->ops.tuner_ops.get_if_frequency) { u32 if_freq; @@ -1081,37 +1080,46 @@ static struct i2c_adapter *rtl2832_get_i2c_adapter(struct i2c_client *client) return dev->i2c_adapter_tuner; } -static int rtl2832_enable_slave_ts(struct i2c_client *client) +static int rtl2832_slave_ts_ctrl(struct i2c_client *client, bool enable) { struct rtl2832_dev *dev = i2c_get_clientdata(client); int ret; - dev_dbg(&client->dev, "\n"); - - ret = rtl2832_bulk_write(client, 0x10c, "\x5f\xff", 2); - if (ret) - goto err; - - ret = rtl2832_wr_demod_reg(dev, DVBT_PIP_ON, 0x1); - if (ret) - goto err; - - ret = rtl2832_bulk_write(client, 0x0bc, "\x18", 1); - if (ret) - goto err; - - ret = rtl2832_bulk_write(client, 0x192, "\x7f\xf7\xff", 3); - if (ret) - goto err; - - /* soft reset */ - ret = rtl2832_wr_demod_reg(dev, DVBT_SOFT_RST, 0x1); - if (ret) - goto err; + dev_dbg(&client->dev, "enable=%d\n", enable); - ret = rtl2832_wr_demod_reg(dev, DVBT_SOFT_RST, 0x0); - if (ret) - goto err; + if (enable) { + ret = rtl2832_wr_demod_reg(dev, DVBT_SOFT_RST, 0x0); + if (ret) + goto err; + ret = rtl2832_bulk_write(client, 0x10c, "\x5f\xff", 2); + if (ret) + goto err; + ret = rtl2832_wr_demod_reg(dev, DVBT_PIP_ON, 0x1); + if (ret) + goto err; + ret = rtl2832_bulk_write(client, 0x0bc, "\x18", 1); + if (ret) + goto err; + ret = rtl2832_bulk_write(client, 0x192, "\x7f\xf7\xff", 3); + if (ret) + goto err; + } else { + ret = rtl2832_bulk_write(client, 0x192, "\x00\x0f\xff", 3); + if (ret) + goto err; + ret = rtl2832_bulk_write(client, 0x0bc, "\x08", 1); + if (ret) + goto err; + ret = rtl2832_wr_demod_reg(dev, DVBT_PIP_ON, 0x0); + if (ret) + goto err; + ret = rtl2832_bulk_write(client, 0x10c, "\x00\x00", 2); + if (ret) + goto err; + ret = rtl2832_wr_demod_reg(dev, DVBT_SOFT_RST, 0x1); + if (ret) + goto err; + } return 0; err: @@ -1267,7 +1275,7 @@ static int rtl2832_probe(struct i2c_client *client, /* setup callbacks */ pdata->get_dvb_frontend = rtl2832_get_dvb_frontend; pdata->get_i2c_adapter = rtl2832_get_i2c_adapter; - pdata->enable_slave_ts = rtl2832_enable_slave_ts; + pdata->slave_ts_ctrl = rtl2832_slave_ts_ctrl; pdata->pid_filter = rtl2832_pid_filter; pdata->pid_filter_ctrl = rtl2832_pid_filter_ctrl; pdata->bulk_read = rtl2832_bulk_read; |