diff options
author | Antti Palosaari <crope@iki.fi> | 2014-09-02 07:01:10 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-21 18:46:01 -0400 |
commit | 204f4319289fcd45ae2d059a4cfc200c7754b050 (patch) | |
tree | f9d24e31d02c6d97ce0e07529e7eb5dcfb0bb6a6 | |
parent | 6b45778609dbe4e7d03abe9482a1a5621e2a3e64 (diff) |
[media] af9033: implement DVBv5 stat block counters
Implement following API commands:
DTV_STAT_ERROR_BLOCK_COUNT
DTV_STAT_TOTAL_BLOCK_COUNT
These returns total and uncorrected error packets from outer FEC.
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/af9033.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index 4c2061676bbe..7b853469bb3b 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c | |||
@@ -38,6 +38,8 @@ struct af9033_dev { | |||
38 | fe_status_t fe_status; | 38 | fe_status_t fe_status; |
39 | u32 ber; | 39 | u32 ber; |
40 | u32 ucb; | 40 | u32 ucb; |
41 | u64 error_block_count; | ||
42 | u64 total_block_count; | ||
41 | struct delayed_work stat_work; | 43 | struct delayed_work stat_work; |
42 | unsigned long last_stat_check; | 44 | unsigned long last_stat_check; |
43 | }; | 45 | }; |
@@ -1015,7 +1017,7 @@ static void af9033_stat_work(struct work_struct *work) | |||
1015 | struct af9033_dev *dev = container_of(work, struct af9033_dev, stat_work.work); | 1017 | struct af9033_dev *dev = container_of(work, struct af9033_dev, stat_work.work); |
1016 | struct dtv_frontend_properties *c = &dev->fe.dtv_property_cache; | 1018 | struct dtv_frontend_properties *c = &dev->fe.dtv_property_cache; |
1017 | int ret, tmp, i, len; | 1019 | int ret, tmp, i, len; |
1018 | u8 u8tmp, buf[3]; | 1020 | u8 u8tmp, buf[7]; |
1019 | 1021 | ||
1020 | dev_dbg(&dev->client->dev, "\n"); | 1022 | dev_dbg(&dev->client->dev, "\n"); |
1021 | 1023 | ||
@@ -1087,6 +1089,35 @@ static void af9033_stat_work(struct work_struct *work) | |||
1087 | c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; | 1089 | c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
1088 | } | 1090 | } |
1089 | 1091 | ||
1092 | /* UCB/PER/BER */ | ||
1093 | if (dev->fe_status & FE_HAS_LOCK) { | ||
1094 | /* outer FEC, 204 byte packets */ | ||
1095 | u16 abort_packet_count, rsd_packet_count; | ||
1096 | |||
1097 | /* | ||
1098 | * Packet count used for measurement is 10000 | ||
1099 | * (rsd_packet_count). Maybe it should be increased? | ||
1100 | */ | ||
1101 | |||
1102 | ret = af9033_rd_regs(dev, 0x800032, buf, 7); | ||
1103 | if (ret) | ||
1104 | goto err; | ||
1105 | |||
1106 | abort_packet_count = (buf[1] << 8) | (buf[0] << 0); | ||
1107 | rsd_packet_count = (buf[6] << 8) | (buf[5] << 0); | ||
1108 | |||
1109 | dev->error_block_count += abort_packet_count; | ||
1110 | dev->total_block_count += rsd_packet_count; | ||
1111 | |||
1112 | c->block_count.len = 1; | ||
1113 | c->block_count.stat[0].scale = FE_SCALE_COUNTER; | ||
1114 | c->block_count.stat[0].uvalue = dev->total_block_count; | ||
1115 | |||
1116 | c->block_error.len = 1; | ||
1117 | c->block_error.stat[0].scale = FE_SCALE_COUNTER; | ||
1118 | c->block_error.stat[0].uvalue = dev->error_block_count; | ||
1119 | } | ||
1120 | |||
1090 | err_schedule_delayed_work: | 1121 | err_schedule_delayed_work: |
1091 | schedule_delayed_work(&dev->stat_work, msecs_to_jiffies(2000)); | 1122 | schedule_delayed_work(&dev->stat_work, msecs_to_jiffies(2000)); |
1092 | return; | 1123 | return; |