Commit fc443284 authored by Jemma Denson's avatar Jemma Denson Committed by Mauro Carvalho Chehab

[media] cx24120: Convert read_ber to retrieve from cache

Instead of reading BER again for DVBv3 call, use the value from the cache.
Signed-off-by: default avatarJemma Denson <jdenson@gmail.com>
Signed-off-by: default avatarPatrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent ddcb252e
...@@ -152,6 +152,7 @@ struct cx24120_state { ...@@ -152,6 +152,7 @@ struct cx24120_state {
/* ber stats calulations */ /* ber stats calulations */
u32 berw_usecs; u32 berw_usecs;
u32 ber_prev;
unsigned long ber_jiffies_stats; unsigned long ber_jiffies_stats;
}; };
...@@ -338,12 +339,15 @@ static int cx24120_read_snr(struct dvb_frontend *fe, u16 *snr) ...@@ -338,12 +339,15 @@ static int cx24120_read_snr(struct dvb_frontend *fe, u16 *snr)
static int cx24120_read_ber(struct dvb_frontend *fe, u32 *ber) static int cx24120_read_ber(struct dvb_frontend *fe, u32 *ber)
{ {
struct cx24120_state *state = fe->demodulator_priv; struct cx24120_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
if (c->post_bit_error.stat[0].scale != FE_SCALE_COUNTER) {
*ber = 0;
return 0;
}
*ber = (cx24120_readreg(state, CX24120_REG_BER_HH) << 24) | *ber = c->post_bit_error.stat[0].uvalue - state->ber_prev;
(cx24120_readreg(state, CX24120_REG_BER_HL) << 16) | state->ber_prev = c->post_bit_error.stat[0].uvalue;
(cx24120_readreg(state, CX24120_REG_BER_LH) << 8) |
cx24120_readreg(state, CX24120_REG_BER_LL);
dev_dbg(&state->i2c->dev, "read BER index = %d\n", *ber);
return 0; return 0;
} }
...@@ -661,9 +665,11 @@ static void cx24120_get_stats(struct cx24120_state *state) ...@@ -661,9 +665,11 @@ static void cx24120_get_stats(struct cx24120_state *state)
msecs = (state->berw_usecs + 500) / 1000; msecs = (state->berw_usecs + 500) / 1000;
state->ber_jiffies_stats = jiffies + msecs_to_jiffies(msecs); state->ber_jiffies_stats = jiffies + msecs_to_jiffies(msecs);
ret = cx24120_read_ber(fe, &ber); ber = cx24120_readreg(state, CX24120_REG_BER_HH) << 24;
if (ret != 0) ber |= cx24120_readreg(state, CX24120_REG_BER_HL) << 16;
return; ber |= cx24120_readreg(state, CX24120_REG_BER_LH) << 8;
ber |= cx24120_readreg(state, CX24120_REG_BER_LL);
dev_dbg(&state->i2c->dev, "read BER index = %d\n", ber);
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
c->post_bit_error.stat[0].uvalue += ber; c->post_bit_error.stat[0].uvalue += ber;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment