Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0cdf1a1 authored by Jemma Denson's avatar Jemma Denson Committed by Mauro Carvalho Chehab
Browse files

[media] cx24120: Improve cooked signal strength value



Algorithm copied from cx24117.c - it seems to work. Showing 95% on
a signal I know to be somewhere around 74dBuV.

[mchehab@osg.samsung.net: merged two patches, to avoid breaking compilation]
Signed-off-by: default avatarJemma Denson <jdenson@gmail.com>
Signed-off-by: default avatarPatrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 34ce475d
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -608,8 +608,8 @@ static void cx24120_get_stats(struct cx24120_state *state)
	struct dvb_frontend *fe = &state->frontend;
	struct dvb_frontend *fe = &state->frontend;
	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
	struct cx24120_cmd cmd;
	struct cx24120_cmd cmd;
	int ret, sigstr_h, sigstr_l;
	int ret;
	u16 u16tmp;
	u16 sig;


	dev_dbg(&state->i2c->dev, "%s()\n", __func__);
	dev_dbg(&state->i2c->dev, "%s()\n", __func__);


@@ -626,18 +626,18 @@ static void cx24120_get_stats(struct cx24120_state *state)
		}
		}


		/* raw */
		/* raw */
		sigstr_h = (cx24120_readreg(state, CX24120_REG_SIGSTR_H) >> 6) << 8;
		sig = cx24120_readreg(state, CX24120_REG_SIGSTR_H) >> 6;
		sigstr_l = cx24120_readreg(state, CX24120_REG_SIGSTR_L);
		sig = sig << 8;
		dev_dbg(&state->i2c->dev, "%s: Signal strength from firmware= 0x%x\n",
		sig |= cx24120_readreg(state, CX24120_REG_SIGSTR_L);
			__func__, (sigstr_h | sigstr_l));
		dev_dbg(&state->i2c->dev,
			"%s: Signal strength from firmware= 0x%x\n",
			__func__, sig);


		/* cooked */
		/* cooked */
		u16tmp = ((sigstr_h | sigstr_l)  << 5) & 0x0000ffff;
		sig = -100 * sig + 94324;
		dev_dbg(&state->i2c->dev, "%s: Signal strength= 0x%x\n",
			__func__, u16tmp);


		c->strength.stat[0].scale = FE_SCALE_RELATIVE;
		c->strength.stat[0].scale = FE_SCALE_RELATIVE;
		c->strength.stat[0].uvalue = u16tmp;
		c->strength.stat[0].uvalue = sig;
	} else {
	} else {
		c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
		c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
	}
	}