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

[ Upstream commit 8982735f8dd02096b75255e3c0a0df28aeaa9955 ]

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 STATE_ACTIVE_* in priv->state. If it isn't in any
active state, additionally set the strength scale to NOT_AVAILABLE.

Signed-off-by: Daniel Scheller <d.schel...@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mche...@s-opensource.com>
Signed-off-by: Sasha Levin <alexander.le...@microsoft.com>
---
 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 b97647cd7dc6..8c175d959038 100644
--- a/drivers/media/dvb-frontends/cxd2841er.c
+++ b/drivers/media/dvb-frontends/cxd2841er.c
@@ -3210,7 +3210,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 (priv->state == STATE_ACTIVE_TC || priv->state == STATE_ACTIVE_S)
+               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.15.1

Reply via email to