diff options
author | Jemma Denson <jdenson@gmail.com> | 2015-05-20 11:57:49 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-05-30 08:12:39 -0300 |
commit | bf8de2d38a4ba82a69db221915375199c9e5d761 (patch) | |
tree | 71cc464b09a829fe9e9a8029019f0a8b763c8df6 /drivers/media | |
parent | 2a80f296422a01178d0a993479369e94f5830127 (diff) | |
download | blackbird-obmc-linux-bf8de2d38a4ba82a69db221915375199c9e5d761.tar.gz blackbird-obmc-linux-bf8de2d38a4ba82a69db221915375199c9e5d761.zip |
[media] cx24120: Assume ucb registers is a counter
The ucblocks register is probably a counter and not a rate; assume
it is so and change the calculations as required.
Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb-frontends/cx24120.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/dvb-frontends/cx24120.c b/drivers/media/dvb-frontends/cx24120.c index a14d0f1cc71e..10a948ef8440 100644 --- a/drivers/media/dvb-frontends/cx24120.c +++ b/drivers/media/dvb-frontends/cx24120.c @@ -154,7 +154,7 @@ struct cx24120_state { u32 bitrate; u32 berw_usecs; u32 ber_prev; - u32 per_prev; + u32 ucb_offset; unsigned long ber_jiffies_stats; unsigned long per_jiffies_stats; }; @@ -698,8 +698,12 @@ static void cx24120_get_stats(struct cx24120_state *state) ucb |= cx24120_readreg(state, CX24120_REG_UCB_L); dev_dbg(&state->i2c->dev, "ucblocks = %d\n", ucb); + /* handle reset */ + if (ucb < state->ucb_offset) + state->ucb_offset = c->block_error.stat[0].uvalue; + c->block_error.stat[0].scale = FE_SCALE_COUNTER; - c->block_error.stat[0].uvalue += ucb; + c->block_error.stat[0].uvalue = ucb + state->ucb_offset; c->block_count.stat[0].scale = FE_SCALE_COUNTER; c->block_count.stat[0].uvalue += state->bitrate / 8 / 208; @@ -1541,8 +1545,7 @@ static int cx24120_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) return 0; } - *ucblocks = c->block_error.stat[0].uvalue - state->per_prev; - state->per_prev = c->block_error.stat[0].uvalue; + *ucblocks = c->block_error.stat[0].uvalue - state->ucb_offset; return 0; } |