summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2016-12-09 11:11:32 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-01-31 10:26:52 -0200
commitc62d29c81736c6f3a6a9cc6ba2f5aad1cfa6afbc (patch)
tree0555dff3f8f5ff12781083208e311d6594276a9d /drivers/media/dvb-frontends
parent8393c00369f1fe68182295b7adca80a73646fdd3 (diff)
[media] si2168: implement ucb statistics
Implement DVBv5 UCB. Only uncorrected blocks are currently counted. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends')
-rw-r--r--drivers/media/dvb-frontends/si2168.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
index 5fbb6c12b766..680ba06c29fb 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -178,6 +178,28 @@ static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status)
c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
}
+ /* UCB */
+ if (*status & FE_HAS_SYNC) {
+ memcpy(cmd.args, "\x84\x01", 2);
+ cmd.wlen = 2;
+ cmd.rlen = 3;
+ ret = si2168_cmd_execute(client, &cmd);
+ if (ret)
+ goto err;
+
+ utmp1 = cmd.args[2] << 8 | cmd.args[1] << 0;
+ dev_dbg(&client->dev, "block_error=%u\n", utmp1);
+
+ /* Sometimes firmware returns bogus value */
+ if (utmp1 == 0xffff)
+ utmp1 = 0;
+
+ c->block_error.stat[0].scale = FE_SCALE_COUNTER;
+ c->block_error.stat[0].uvalue += utmp1;
+ } else {
+ c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
+ }
+
return 0;
err:
dev_dbg(&client->dev, "failed=%d\n", ret);
@@ -535,6 +557,8 @@ warm:
c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
c->post_bit_count.len = 1;
c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
+ c->block_error.len = 1;
+ c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
dev->active = true;