Commit c7275ae1 authored by David Howells's avatar David Howells Committed by Mauro Carvalho Chehab

[media] ts2020: Allow stats polling to be suppressed

Statistics polling can not be done by lmedm04 driver's implementation of
M88RS2000/TS2020 because I2C messages stop the device's demuxer, so allow
polling for statistics to be suppressed in the ts2020 driver by setting
dont_poll in the ts2020_config struct.
Reported-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 0f20baad
...@@ -40,6 +40,7 @@ struct ts2020_priv { ...@@ -40,6 +40,7 @@ struct ts2020_priv {
bool loop_through:1; bool loop_through:1;
u8 clk_out:2; u8 clk_out:2;
u8 clk_out_div:5; u8 clk_out_div:5;
bool dont_poll:1;
u32 frequency_div; /* LO output divider switch frequency */ u32 frequency_div; /* LO output divider switch frequency */
u32 frequency_khz; /* actual used LO frequency */ u32 frequency_khz; /* actual used LO frequency */
#define TS2020_M88TS2020 0 #define TS2020_M88TS2020 0
...@@ -52,6 +53,8 @@ struct ts2020_reg_val { ...@@ -52,6 +53,8 @@ struct ts2020_reg_val {
u8 val; u8 val;
}; };
static void ts2020_stat_work(struct work_struct *work);
static int ts2020_release(struct dvb_frontend *fe) static int ts2020_release(struct dvb_frontend *fe)
{ {
struct ts2020_priv *priv = fe->tuner_priv; struct ts2020_priv *priv = fe->tuner_priv;
...@@ -79,6 +82,7 @@ static int ts2020_sleep(struct dvb_frontend *fe) ...@@ -79,6 +82,7 @@ static int ts2020_sleep(struct dvb_frontend *fe)
return ret; return ret;
/* stop statistics polling */ /* stop statistics polling */
if (!priv->dont_poll)
cancel_delayed_work_sync(&priv->stat_work); cancel_delayed_work_sync(&priv->stat_work);
return 0; return 0;
} }
...@@ -152,8 +156,8 @@ static int ts2020_init(struct dvb_frontend *fe) ...@@ -152,8 +156,8 @@ static int ts2020_init(struct dvb_frontend *fe)
c->strength.stat[0].scale = FE_SCALE_DECIBEL; c->strength.stat[0].scale = FE_SCALE_DECIBEL;
c->strength.stat[0].uvalue = 0; c->strength.stat[0].uvalue = 0;
/* Start statistics polling */ /* Start statistics polling by invoking the work function */
schedule_delayed_work(&priv->stat_work, 0); ts2020_stat_work(&priv->stat_work.work);
return 0; return 0;
} }
...@@ -445,6 +449,7 @@ static void ts2020_stat_work(struct work_struct *work) ...@@ -445,6 +449,7 @@ static void ts2020_stat_work(struct work_struct *work)
c->strength.stat[0].scale = FE_SCALE_DECIBEL; c->strength.stat[0].scale = FE_SCALE_DECIBEL;
if (!priv->dont_poll)
schedule_delayed_work(&priv->stat_work, msecs_to_jiffies(2000)); schedule_delayed_work(&priv->stat_work, msecs_to_jiffies(2000));
return; return;
err: err:
...@@ -458,9 +463,13 @@ static int ts2020_read_signal_strength(struct dvb_frontend *fe, ...@@ -458,9 +463,13 @@ static int ts2020_read_signal_strength(struct dvb_frontend *fe,
u16 *_signal_strength) u16 *_signal_strength)
{ {
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct ts2020_priv *priv = fe->tuner_priv;
unsigned strength; unsigned strength;
__s64 gain; __s64 gain;
if (priv->dont_poll)
ts2020_stat_work(&priv->stat_work.work);
if (c->strength.stat[0].scale == FE_SCALE_NOT_AVAILABLE) { if (c->strength.stat[0].scale == FE_SCALE_NOT_AVAILABLE) {
*_signal_strength = 0; *_signal_strength = 0;
return 0; return 0;
...@@ -585,6 +594,7 @@ static int ts2020_probe(struct i2c_client *client, ...@@ -585,6 +594,7 @@ static int ts2020_probe(struct i2c_client *client,
dev->loop_through = pdata->loop_through; dev->loop_through = pdata->loop_through;
dev->clk_out = pdata->clk_out; dev->clk_out = pdata->clk_out;
dev->clk_out_div = pdata->clk_out_div; dev->clk_out_div = pdata->clk_out_div;
dev->dont_poll = pdata->dont_poll;
dev->frequency_div = pdata->frequency_div; dev->frequency_div = pdata->frequency_div;
dev->fe = fe; dev->fe = fe;
dev->get_agc_pwm = pdata->get_agc_pwm; dev->get_agc_pwm = pdata->get_agc_pwm;
......
...@@ -48,6 +48,9 @@ struct ts2020_config { ...@@ -48,6 +48,9 @@ struct ts2020_config {
*/ */
u8 clk_out_div:5; u8 clk_out_div:5;
/* Set to true to suppress stat polling */
bool dont_poll:1;
/* /*
* pointer to DVB frontend * pointer to DVB frontend
*/ */
......
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