From patchwork Wed Jun 3 11:35:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 29982 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Z06xd-00037g-5I; Wed, 03 Jun 2015 13:35:53 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-8) with esmtp id 1Z06xa-00075R-mJ; Wed, 03 Jun 2015 13:35:52 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752992AbbFCLfN (ORCPT + 1 other); Wed, 3 Jun 2015 07:35:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51084 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751736AbbFCLfL (ORCPT ); Wed, 3 Jun 2015 07:35:11 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id D169B19F3B1; Wed, 3 Jun 2015 11:35:11 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-71.phx2.redhat.com [10.3.112.71]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t53BZ8xY026983; Wed, 3 Jun 2015 07:35:09 -0400 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH] ts2020: Allow stats polling to be suppressed From: David Howells To: crope@iki.fi Cc: dhowells@redhat.com, tvboxspy@gmail.com, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Date: Wed, 03 Jun 2015 12:35:08 +0100 Message-ID: <20150603113508.32135.28906.stgit@warthog.procyon.org.uk> In-Reply-To: <5564C269.2000003@gmail.com> References: <5564C269.2000003@gmail.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.6.3.112716 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, REFERENCES 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0' 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 Signed-off-by: David Howells cc: Malcolm Priestley --- drivers/media/dvb-frontends/ts2020.c | 18 ++++++++++++++---- drivers/media/dvb-frontends/ts2020.h | 3 +++ 2 files changed, 17 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 */