All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] dvb-frontends/cxd2841er: require FE_HAS_SYNC for agc readout
@ 2017-06-22 20:03 Daniel Scheller
  2017-06-24 18:35 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Scheller @ 2017-06-22 20:03 UTC (permalink / raw)
  To: linux-media, aospan, serjk; +Cc: mchehab

From: Daniel Scheller <d.scheller@gmx.net>

When the demod driver puts the demod into sleep or shutdown state and it's
status is then polled e.g. via "dvb-fe-tool -m", i2c errors are printed
to the kernel log. If the last delsys was DVB-T/T2:

  cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1
  cxd2841er: i2c rd failed=-5 addr=6c reg=26

and if it was DVB-C:

  cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1
  cxd2841er: i2c rd failed=-5 addr=6c reg=49

This happens when read_status unconditionally calls into the
read_signal_strength() function which triggers the read_agc_gain_*()
functions, where these registered are polled.

This isn't a critical thing since when the demod is active again, no more
such errors are logged, however this might make users suspecting defects.

Fix this by requiring fe_status FE_HAS_SYNC to be sure the demod is not
put asleep or shut down. If FE_HAS_SYNC isn't set, additionally set the
strength scale to NOT_AVAILABLE.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
---
 drivers/media/dvb-frontends/cxd2841er.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c
index 08f67d60a7d9..9fff031436f1 100644
--- a/drivers/media/dvb-frontends/cxd2841er.c
+++ b/drivers/media/dvb-frontends/cxd2841er.c
@@ -3279,7 +3279,10 @@ static int cxd2841er_get_frontend(struct dvb_frontend *fe,
 	else if (priv->state == STATE_ACTIVE_TC)
 		cxd2841er_read_status_tc(fe, &status);
 
-	cxd2841er_read_signal_strength(fe);
+	if (status & FE_HAS_SYNC)
+		cxd2841er_read_signal_strength(fe);
+	else
+		p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
 
 	if (status & FE_HAS_LOCK) {
 		cxd2841er_read_snr(fe);
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] [media] dvb-frontends/cxd2841er: require FE_HAS_SYNC for agc readout
  2017-06-22 20:03 [PATCH] [media] dvb-frontends/cxd2841er: require FE_HAS_SYNC for agc readout Daniel Scheller
@ 2017-06-24 18:35 ` Mauro Carvalho Chehab
  2017-06-24 18:40   ` Abylay Ospan
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2017-06-24 18:35 UTC (permalink / raw)
  To: Daniel Scheller; +Cc: linux-media, aospan, serjk, mchehab

Em Thu, 22 Jun 2017 22:03:28 +0200
Daniel Scheller <d.scheller.oss@gmail.com> escreveu:

> From: Daniel Scheller <d.scheller@gmx.net>
> 
> When the demod driver puts the demod into sleep or shutdown state and it's
> status is then polled e.g. via "dvb-fe-tool -m", i2c errors are printed
> to the kernel log. If the last delsys was DVB-T/T2:
> 
>   cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1
>   cxd2841er: i2c rd failed=-5 addr=6c reg=26
> 
> and if it was DVB-C:
> 
>   cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1
>   cxd2841er: i2c rd failed=-5 addr=6c reg=49
> 
> This happens when read_status unconditionally calls into the
> read_signal_strength() function which triggers the read_agc_gain_*()
> functions, where these registered are polled.
> 
> This isn't a critical thing since when the demod is active again, no more
> such errors are logged, however this might make users suspecting defects.
> 
> Fix this by requiring fe_status FE_HAS_SYNC to be sure the demod is not
> put asleep or shut down. If FE_HAS_SYNC isn't set, additionally set the
> strength scale to NOT_AVAILABLE.

Requiring full lock for signal strength seems too much, as people usually
rely on signal strength to adjust antenna.

You should, instead, just check if the demod is shut down.

Regards,
Mauro

> 
> Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
> ---
>  drivers/media/dvb-frontends/cxd2841er.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c
> index 08f67d60a7d9..9fff031436f1 100644
> --- a/drivers/media/dvb-frontends/cxd2841er.c
> +++ b/drivers/media/dvb-frontends/cxd2841er.c
> @@ -3279,7 +3279,10 @@ static int cxd2841er_get_frontend(struct dvb_frontend *fe,
>  	else if (priv->state == STATE_ACTIVE_TC)
>  		cxd2841er_read_status_tc(fe, &status);
>  
> -	cxd2841er_read_signal_strength(fe);
> +	if (status & FE_HAS_SYNC)
> +		cxd2841er_read_signal_strength(fe);
> +	else
> +		p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
>  
>  	if (status & FE_HAS_LOCK) {
>  		cxd2841er_read_snr(fe);



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [media] dvb-frontends/cxd2841er: require FE_HAS_SYNC for agc readout
  2017-06-24 18:35 ` Mauro Carvalho Chehab
@ 2017-06-24 18:40   ` Abylay Ospan
  0 siblings, 0 replies; 3+ messages in thread
From: Abylay Ospan @ 2017-06-24 18:40 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Daniel Scheller, linux-media, Kozlov Sergey, Mauro Carvalho Chehab

Hi,

Yes, make sense.

2017-06-24 14:35 GMT-04:00 Mauro Carvalho Chehab <mchehab@s-opensource.com>:
> Em Thu, 22 Jun 2017 22:03:28 +0200
> Daniel Scheller <d.scheller.oss@gmail.com> escreveu:
>
>> From: Daniel Scheller <d.scheller@gmx.net>
>>
>> When the demod driver puts the demod into sleep or shutdown state and it's
>> status is then polled e.g. via "dvb-fe-tool -m", i2c errors are printed
>> to the kernel log. If the last delsys was DVB-T/T2:
>>
>>   cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1
>>   cxd2841er: i2c rd failed=-5 addr=6c reg=26
>>
>> and if it was DVB-C:
>>
>>   cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1
>>   cxd2841er: i2c rd failed=-5 addr=6c reg=49
>>
>> This happens when read_status unconditionally calls into the
>> read_signal_strength() function which triggers the read_agc_gain_*()
>> functions, where these registered are polled.
>>
>> This isn't a critical thing since when the demod is active again, no more
>> such errors are logged, however this might make users suspecting defects.
>>
>> Fix this by requiring fe_status FE_HAS_SYNC to be sure the demod is not
>> put asleep or shut down. If FE_HAS_SYNC isn't set, additionally set the
>> strength scale to NOT_AVAILABLE.
>
> Requiring full lock for signal strength seems too much, as people usually
> rely on signal strength to adjust antenna.
>
> You should, instead, just check if the demod is shut down.
>
> Regards,
> Mauro
>
>>
>> Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
>> ---
>>  drivers/media/dvb-frontends/cxd2841er.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c
>> index 08f67d60a7d9..9fff031436f1 100644
>> --- a/drivers/media/dvb-frontends/cxd2841er.c
>> +++ b/drivers/media/dvb-frontends/cxd2841er.c
>> @@ -3279,7 +3279,10 @@ static int cxd2841er_get_frontend(struct dvb_frontend *fe,
>>       else if (priv->state == STATE_ACTIVE_TC)
>>               cxd2841er_read_status_tc(fe, &status);
>>
>> -     cxd2841er_read_signal_strength(fe);
>> +     if (status & FE_HAS_SYNC)
>> +             cxd2841er_read_signal_strength(fe);
>> +     else
>> +             p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
>>
>>       if (status & FE_HAS_LOCK) {
>>               cxd2841er_read_snr(fe);
>
>
>
> Thanks,
> Mauro



-- 
Abylay Ospan,
NetUP Inc.
http://www.netup.tv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-24 18:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22 20:03 [PATCH] [media] dvb-frontends/cxd2841er: require FE_HAS_SYNC for agc readout Daniel Scheller
2017-06-24 18:35 ` Mauro Carvalho Chehab
2017-06-24 18:40   ` Abylay Ospan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.