Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>

+10 -5
+10 -5
drivers/media/dvb-frontends/dib8000.c
··· 119 119 u8 longest_intlv_layer; 120 120 u16 output_mode; 121 121 122 + s64 init_ucb; 122 123 #ifdef DIB8000_AGC_FREEZE 123 124 u16 agc1_max; 124 125 u16 agc1_min; ··· 987 986 return value; 988 987 } 989 988 989 + static int dib8000_read_unc_blocks(struct dvb_frontend *fe, u32 *unc); 990 + 990 991 static void dib8000_reset_stats(struct dvb_frontend *fe) 991 992 { 992 993 struct dib8000_state *state = fe->demodulator_priv; 993 994 struct dtv_frontend_properties *c = &state->fe[0]->dtv_property_cache; 995 + u32 ucb; 994 996 995 997 memset(&c->strength, 0, sizeof(c->strength)); 996 998 memset(&c->cnr, 0, sizeof(c->cnr)); ··· 1014 1010 c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; 1015 1011 c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; 1016 1012 c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; 1013 + 1014 + dib8000_read_unc_blocks(fe, &ucb); 1015 + state->init_ucb = -ucb; 1017 1016 } 1018 1017 1019 1018 static int dib8000_reset(struct dvb_frontend *fe) ··· 3996 3989 c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; 3997 3990 c->post_bit_count.stat[0].uvalue += 100000000; 3998 3991 3999 - /* 4000 - * FIXME: this is refreshed on every second, but a time 4001 - * drift between dib8000 and PC clock may cause troubles 4002 - */ 4003 3992 dib8000_read_unc_blocks(fe, &val); 3993 + if (val < state->init_ucb) 3994 + state->init_ucb += 1L << 32; 4004 3995 4005 3996 c->block_error.stat[0].scale = FE_SCALE_COUNTER; 4006 - c->block_error.stat[0].uvalue += val; 3997 + c->block_error.stat[0].uvalue = val + state->init_ucb; 4007 3998 4008 3999 if (state->revision < 0x8002) 4009 4000 return 0;