aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/mn88472.c
diff options
context:
space:
mode:
authorAntti Palosaari2017-03-17 13:45:48 -0300
committerMauro Carvalho Chehab2017-04-10 12:44:26 -0300
commit0fc66c1949f93417f5995c623ad0876bbb1e6c60 (patch)
tree061309a877a5126e182aa0fe980a8d58f8e0fe34 /drivers/media/dvb-frontends/mn88472.c
parentc635a5e2cf66444b8904e0b253ea0869be697f92 (diff)
[media] mn88472: implement PER statistics
Implement DVBv5 PER. 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/mn88472.c')
-rw-r--r--drivers/media/dvb-frontends/mn88472.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/mn88472.c b/drivers/media/dvb-frontends/mn88472.c
index c7e5f6302dc6..f6938f9607ac 100644
--- a/drivers/media/dvb-frontends/mn88472.c
+++ b/drivers/media/dvb-frontends/mn88472.c
@@ -179,6 +179,26 @@ static int mn88472_read_status(struct dvb_frontend *fe, enum fe_status *status)
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
}
+ /* PER */
+ if (*status & FE_HAS_SYNC) {
+ ret = regmap_bulk_read(dev->regmap[0], 0xe1, buf, 4);
+ if (ret)
+ goto err;
+
+ utmp1 = buf[0] << 8 | buf[1] << 0;
+ utmp2 = buf[2] << 8 | buf[3] << 0;
+ dev_dbg(&client->dev, "block_error=%u block_count=%u\n",
+ utmp1, utmp2);
+
+ c->block_error.stat[0].scale = FE_SCALE_COUNTER;
+ c->block_error.stat[0].uvalue += utmp1;
+ c->block_count.stat[0].scale = FE_SCALE_COUNTER;
+ c->block_count.stat[0].uvalue += utmp2;
+ } else {
+ c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
+ c->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
+ }
+
return 0;
err:
dev_dbg(&client->dev, "failed=%d\n", ret);
@@ -654,6 +674,8 @@ static int mn88472_probe(struct i2c_client *client,
c = &dev->fe.dtv_property_cache;
c->strength.len = 1;
c->cnr.len = 1;
+ c->block_error.len = 1;
+ c->block_count.len = 1;
/* Setup callbacks */
pdata->get_dvb_frontend = mn88472_get_dvb_frontend;