linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Malcolm Priestley <tvboxspy@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: crope@iki.fi, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH 2/2] ts2020: Provide DVBv5 API signal strength
Date: Tue, 26 May 2015 19:58:49 +0100	[thread overview]
Message-ID: <5564C269.2000003@gmail.com> (raw)
In-Reply-To: <20150526150407.10241.89123.stgit@warthog.procyon.org.uk>

On 26/05/15 16:04, David Howells wrote:
> Provide a DVBv5 API signal strength.  This is in units of 0.001 dBm rather
> than a percentage.
>
>>From Antti Palosaari's testing with a signal generator, it appears that the
> gain calculated according to Montage's specification if negated is a
> reasonable representation of the signal strength of the generator.
>
> To this end:
>
>   (1) Polled statistic gathering needed to be implemented in the TS2020 driver.
>       This is done in the ts2020_stat_work() function.
>
>   (2) The calculated gain is placed as the signal strength in the
>       dtv_property_cache associated with the front end with the scale set to
>       FE_SCALE_DECIBEL.
>
>   (3) The DVBv3 format signal strength then needed to be calculated from the
>       signal strength stored in the dtv_property_cache rather than accessing
>       the value when ts2020_read_signal_strength() is called.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
>
>   drivers/media/dvb-frontends/ts2020.c |   62 +++++++++++++++++++++++++++++-----
>   1 file changed, 53 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c
> index 277e1cf..80ae039 100644
> --- a/drivers/media/dvb-frontends/ts2020.c
> +++ b/drivers/media/dvb-frontends/ts2020.c
> @@ -32,10 +32,11 @@ struct ts2020_priv {
>   	struct regmap_config regmap_config;
>   	struct regmap *regmap;
>   	struct dvb_frontend *fe;
> +	struct delayed_work stat_work;
>   	int (*get_agc_pwm)(struct dvb_frontend *fe, u8 *_agc_pwm);
>   	/* i2c details */
> -	int i2c_address;
>   	struct i2c_adapter *i2c;
> +	int i2c_address;
>   	u8 clk_out:2;
>   	u8 clk_out_div:5;
>   	u32 frequency_div; /* LO output divider switch frequency */
> @@ -65,6 +66,7 @@ static int ts2020_release(struct dvb_frontend *fe)
>   static int ts2020_sleep(struct dvb_frontend *fe)
>   {
>   	struct ts2020_priv *priv = fe->tuner_priv;
> +	int ret;
>   	u8 u8tmp;
>
>   	if (priv->tuner == TS2020_M88TS2020)
> @@ -72,11 +74,18 @@ static int ts2020_sleep(struct dvb_frontend *fe)
>   	else
>   		u8tmp = 0x00;
>
> -	return regmap_write(priv->regmap, u8tmp, 0x00);
> +	ret = regmap_write(priv->regmap, u8tmp, 0x00);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* stop statistics polling */
> +	cancel_delayed_work_sync(&priv->stat_work);
> +	return 0;
>   }
>
>   static int ts2020_init(struct dvb_frontend *fe)
>   {
> +	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
>   	struct ts2020_priv *priv = fe->tuner_priv;
>   	int i;
>   	u8 u8tmp;
> @@ -138,6 +147,13 @@ static int ts2020_init(struct dvb_frontend *fe)
>   				     reg_vals[i].val);
>   	}
>
> +	/* Initialise v5 stats here */
> +	c->strength.len = 1;
> +	c->strength.stat[0].scale = FE_SCALE_DECIBEL;
> +	c->strength.stat[0].uvalue = 0;
> +
> +	/* Start statistics polling */
> +	schedule_delayed_work(&priv->stat_work, 0);
>   	return 0;
>   }
>

Hi David

Statistics polling can not be done by lmedm04 driver's implementation of 
M88RS2000/TS2020 because I2C messages stop the devices demuxer.

So any polling must be a config option for this driver.

Regards

Malcolm






  reply	other threads:[~2015-05-26 18:58 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 [this message]
2015-05-28 10:08     ` David Howells
2015-05-28 20:07       ` 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 17:15                 ` David Howells
2015-06-03 16:44               ` Malcolm Priestley
2015-06-03 11:13         ` Antti Palosaari
2015-06-03 15:57           ` Malcolm Priestley
2015-06-03 11:35     ` [PATCH] ts2020: Allow stats polling to be suppressed David Howells
2015-06-03 18:33       ` Malcolm Priestley

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=5564C269.2000003@gmail.com \
    --to=tvboxspy@gmail.com \
    --cc=crope@iki.fi \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).