diff options
author | Antti Palosaari <crope@iki.fi> | 2014-12-14 09:00:50 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-02-03 13:07:43 -0500 |
commit | 25ef9f554713bc329523b615861db7cbc443106a (patch) | |
tree | 12170d3ab23423c6fe172fe730403a7053c24df8 | |
parent | 084330b746d9fb369cc6df17fdbc9dc8952249bf (diff) |
[media] rtl2832: implement DVBv5 signal strength statistics
Estimate signal strength from IF digital AGC.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/dvb-frontends/rtl2832.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index 90d4f45d9958..6aaaec2a40c2 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c | |||
@@ -474,6 +474,8 @@ static int rtl2832_init(struct dvb_frontend *fe) | |||
474 | goto err; | 474 | goto err; |
475 | #endif | 475 | #endif |
476 | /* init stats here in order signal app which stats are supported */ | 476 | /* init stats here in order signal app which stats are supported */ |
477 | c->strength.len = 1; | ||
478 | c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; | ||
477 | c->cnr.len = 1; | 479 | c->cnr.len = 1; |
478 | c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; | 480 | c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
479 | c->post_bit_error.len = 1; | 481 | c->post_bit_error.len = 1; |
@@ -823,6 +825,24 @@ static void rtl2832_stat_work(struct work_struct *work) | |||
823 | 825 | ||
824 | dev_dbg(&client->dev, "\n"); | 826 | dev_dbg(&client->dev, "\n"); |
825 | 827 | ||
828 | /* signal strength */ | ||
829 | if (dev->fe_status & FE_HAS_SIGNAL) { | ||
830 | /* read digital AGC */ | ||
831 | ret = rtl2832_bulk_read(client, 0x305, &u8tmp, 1); | ||
832 | if (ret) | ||
833 | goto err; | ||
834 | |||
835 | dev_dbg(&client->dev, "digital agc=%02x", u8tmp); | ||
836 | |||
837 | u8tmp = ~u8tmp; | ||
838 | u16tmp = u8tmp << 8 | u8tmp << 0; | ||
839 | |||
840 | c->strength.stat[0].scale = FE_SCALE_RELATIVE; | ||
841 | c->strength.stat[0].uvalue = u16tmp; | ||
842 | } else { | ||
843 | c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; | ||
844 | } | ||
845 | |||
826 | /* CNR */ | 846 | /* CNR */ |
827 | if (dev->fe_status & FE_HAS_VITERBI) { | 847 | if (dev->fe_status & FE_HAS_VITERBI) { |
828 | unsigned hierarchy, constellation; | 848 | unsigned hierarchy, constellation; |