diff options
author | Abylay Ospan <aospan@netup.ru> | 2016-06-30 23:09:48 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-08 18:55:42 -0300 |
commit | d0998ce76f428bd607ab73c3258eabeb9735820f (patch) | |
tree | 9979a7ef3aa6bb67467fc7c9e43809221c794e3c /drivers/media/dvb-frontends/cxd2841er.c | |
parent | 5fda1b65c2ecb2acaceb4418c16cfd929ac138b3 (diff) | |
download | linux-d0998ce76f428bd607ab73c3258eabeb9735820f.tar.gz linux-d0998ce76f428bd607ab73c3258eabeb9735820f.tar.bz2 linux-d0998ce76f428bd607ab73c3258eabeb9735820f.zip |
[media] DVB-C read signal strength added for Sony demod
cxd2841er_read_agc_gain_c added to obtain signal strength.
signal strength now relay on AGC value.
Signed-off-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends/cxd2841er.c')
-rw-r--r-- | drivers/media/dvb-frontends/cxd2841er.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index c960e8a725cc..0c7d92aee857 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -1656,6 +1656,21 @@ static int cxd2841er_read_snr_i(struct cxd2841er_priv *priv, u32 *snr) return 0; } +static u16 cxd2841er_read_agc_gain_c(struct cxd2841er_priv *priv, + u8 delsys) +{ + u8 data[2]; + + cxd2841er_write_reg( + priv, I2C_SLVT, 0x00, 0x40); + cxd2841er_read_regs(priv, I2C_SLVT, 0x49, data, 2); + dev_dbg(&priv->i2c->dev, + "%s(): AGC value=%u\n", + __func__, (((u16)data[0] & 0x0F) << 8) | + (u16)(data[1] & 0xFF)); + return ((((u16)data[0] & 0x0F) << 8) | (u16)(data[1] & 0xFF)) << 4; +} + static u16 cxd2841er_read_agc_gain_t_t2(struct cxd2841er_priv *priv, u8 delsys) { @@ -1735,6 +1750,14 @@ static void cxd2841er_read_signal_strength(struct dvb_frontend *fe) dev_dbg(&priv->i2c->dev, "%s()\n", __func__); switch (p->delivery_system) { + case SYS_DVBC_ANNEX_A: + case SYS_DVBC_ANNEX_B: + case SYS_DVBC_ANNEX_C: + strength = 65535 - cxd2841er_read_agc_gain_c( + priv, p->delivery_system); + p->strength.stat[0].scale = FE_SCALE_RELATIVE; + p->strength.stat[0].uvalue = strength; + break; case SYS_DVBT: case SYS_DVBT2: strength = cxd2841er_read_agc_gain_t_t2(priv, |