Commit 7a9d85d5 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] dib8000: Fix UCB measure with DVBv5 stats

On dib8000, the block error count is a monotonic 32 bits register.
With DVBv5 stats, we use a 64 bits counter, that it is reset
when a new channel is tuned.

Change the UCB counting start from 0 and to be returned with
64 bits, just like the API requests.
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: default avatarPatrick Boettcher <pboettcher@kernellabs.com>
parent 42ff76bd
...@@ -119,6 +119,7 @@ struct dib8000_state { ...@@ -119,6 +119,7 @@ struct dib8000_state {
u8 longest_intlv_layer; u8 longest_intlv_layer;
u16 output_mode; u16 output_mode;
s64 init_ucb;
#ifdef DIB8000_AGC_FREEZE #ifdef DIB8000_AGC_FREEZE
u16 agc1_max; u16 agc1_max;
u16 agc1_min; u16 agc1_min;
...@@ -986,10 +987,13 @@ static u16 dib8000_identify(struct i2c_device *client) ...@@ -986,10 +987,13 @@ static u16 dib8000_identify(struct i2c_device *client)
return value; return value;
} }
static int dib8000_read_unc_blocks(struct dvb_frontend *fe, u32 *unc);
static void dib8000_reset_stats(struct dvb_frontend *fe) static void dib8000_reset_stats(struct dvb_frontend *fe)
{ {
struct dib8000_state *state = fe->demodulator_priv; struct dib8000_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &state->fe[0]->dtv_property_cache; struct dtv_frontend_properties *c = &state->fe[0]->dtv_property_cache;
u32 ucb;
memset(&c->strength, 0, sizeof(c->strength)); memset(&c->strength, 0, sizeof(c->strength));
memset(&c->cnr, 0, sizeof(c->cnr)); memset(&c->cnr, 0, sizeof(c->cnr));
...@@ -1010,6 +1014,9 @@ static void dib8000_reset_stats(struct dvb_frontend *fe) ...@@ -1010,6 +1014,9 @@ static void dib8000_reset_stats(struct dvb_frontend *fe)
c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
dib8000_read_unc_blocks(fe, &ucb);
state->init_ucb = -ucb;
} }
static int dib8000_reset(struct dvb_frontend *fe) static int dib8000_reset(struct dvb_frontend *fe)
...@@ -3989,14 +3996,12 @@ static int dib8000_get_stats(struct dvb_frontend *fe, fe_status_t stat) ...@@ -3989,14 +3996,12 @@ static int dib8000_get_stats(struct dvb_frontend *fe, fe_status_t stat)
c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER;
c->post_bit_count.stat[0].uvalue += 100000000; c->post_bit_count.stat[0].uvalue += 100000000;
/*
* FIXME: this is refreshed on every second, but a time
* drift between dib8000 and PC clock may cause troubles
*/
dib8000_read_unc_blocks(fe, &val); dib8000_read_unc_blocks(fe, &val);
if (val < state->init_ucb)
state->init_ucb += 1L << 32;
c->block_error.stat[0].scale = FE_SCALE_COUNTER; c->block_error.stat[0].scale = FE_SCALE_COUNTER;
c->block_error.stat[0].uvalue += val; c->block_error.stat[0].uvalue = val + state->init_ucb;
if (state->revision < 0x8002) if (state->revision < 0x8002)
return 0; return 0;
......
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