From: David Howells <dhowells@redhat.com>
To: crope@iki.fi
Cc: dhowells@redhat.com, tvboxspy@gmail.com,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: [PATCH] ts2020: Allow stats polling to be suppressed
Date: Wed, 03 Jun 2015 12:35:08 +0100 [thread overview]
Message-ID: <20150603113508.32135.28906.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <5564C269.2000003@gmail.com>
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: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Malcolm Priestley <tvboxspy@gmail.com>
---
drivers/media/dvb-frontends/ts2020.c | 18 ++++++++++++++----
drivers/media/dvb-frontends/ts2020.h | 3 +++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c
index 8c997d0..946d8e950 100644
--- a/drivers/media/dvb-frontends/ts2020.c
+++ b/drivers/media/dvb-frontends/ts2020.c
@@ -40,6 +40,7 @@ struct ts2020_priv {
bool loop_through:1;
u8 clk_out:2;
u8 clk_out_div:5;
+ bool dont_poll:1;
u32 frequency_div; /* LO output divider switch frequency */
u32 frequency_khz; /* actual used LO frequency */
#define TS2020_M88TS2020 0
@@ -52,6 +53,8 @@ struct ts2020_reg_val {
u8 val;
};
+static void ts2020_stat_work(struct work_struct *work);
+
static int ts2020_release(struct dvb_frontend *fe)
{
struct ts2020_priv *priv = fe->tuner_priv;
@@ -79,7 +82,8 @@ static int ts2020_sleep(struct dvb_frontend *fe)
return ret;
/* stop statistics polling */
- cancel_delayed_work_sync(&priv->stat_work);
+ if (!priv->dont_poll)
+ cancel_delayed_work_sync(&priv->stat_work);
return 0;
}
@@ -152,8 +156,8 @@ static int ts2020_init(struct dvb_frontend *fe)
c->strength.stat[0].scale = FE_SCALE_DECIBEL;
c->strength.stat[0].uvalue = 0;
- /* Start statistics polling */
- schedule_delayed_work(&priv->stat_work, 0);
+ /* Start statistics polling by invoking the work function */
+ ts2020_stat_work(&priv->stat_work.work);
return 0;
}
@@ -445,7 +449,8 @@ static void ts2020_stat_work(struct work_struct *work)
c->strength.stat[0].scale = FE_SCALE_DECIBEL;
- schedule_delayed_work(&priv->stat_work, msecs_to_jiffies(2000));
+ if (!priv->dont_poll)
+ schedule_delayed_work(&priv->stat_work, msecs_to_jiffies(2000));
return;
err:
dev_dbg(&client->dev, "failed=%d\n", ret);
@@ -458,9 +463,13 @@ static int ts2020_read_signal_strength(struct dvb_frontend *fe,
u16 *_signal_strength)
{
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
+ struct ts2020_priv *priv = fe->tuner_priv;
unsigned strength;
__s64 gain;
+ if (priv->dont_poll)
+ ts2020_stat_work(&priv->stat_work.work);
+
if (c->strength.stat[0].scale == FE_SCALE_NOT_AVAILABLE) {
*_signal_strength = 0;
return 0;
@@ -585,6 +594,7 @@ static int ts2020_probe(struct i2c_client *client,
dev->loop_through = pdata->loop_through;
dev->clk_out = pdata->clk_out;
dev->clk_out_div = pdata->clk_out_div;
+ dev->dont_poll = pdata->dont_poll;
dev->frequency_div = pdata->frequency_div;
dev->fe = fe;
dev->get_agc_pwm = pdata->get_agc_pwm;
diff --git a/drivers/media/dvb-frontends/ts2020.h b/drivers/media/dvb-frontends/ts2020.h
index 002bc0a..9220e5c 100644
--- a/drivers/media/dvb-frontends/ts2020.h
+++ b/drivers/media/dvb-frontends/ts2020.h
@@ -48,6 +48,9 @@ struct ts2020_config {
*/
u8 clk_out_div:5;
+ /* Set to true to suppress stat polling */
+ bool dont_poll:1;
+
/*
* pointer to DVB frontend
*/
next prev parent reply other threads:[~2015-06-03 11:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 15:04 [PATCH 1/2] TS2020: Calculate tuner gain correctly David Howells
2015-05-26 15:04 ` [PATCH 2/2] ts2020: Provide DVBv5 API signal strength David Howells
2015-05-26 18:58 ` Malcolm Priestley
2015-06-03 11:35 ` David Howells [this message]
2015-06-03 18:33 ` [PATCH] ts2020: Allow stats polling to be suppressed Malcolm Priestley
2015-05-28 10:08 ` [PATCH 2/2] ts2020: Provide DVBv5 API signal strength David Howells
2015-05-28 20:07 ` Malcolm Priestley
2015-06-03 11:13 ` Antti Palosaari
2015-06-03 15:57 ` Malcolm Priestley
2015-06-03 10:17 ` David Howells
2015-06-03 15:15 ` Malcolm Priestley
2015-06-03 16:37 ` David Howells
2015-06-03 16:43 ` Antti Palosaari
2015-06-03 17:04 ` Malcolm Priestley
2015-06-03 16:44 ` Malcolm Priestley
2015-06-03 17:15 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150603113508.32135.28906.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=crope@iki.fi \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=tvboxspy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®