Lines Matching refs:avg

109 	int avg;  member
386 struct ab8500_fg_avg_cap *avg = &di->avg_cap; in ab8500_fg_add_cap_sample() local
389 avg->sum += sample - avg->samples[avg->pos]; in ab8500_fg_add_cap_sample()
390 avg->samples[avg->pos] = sample; in ab8500_fg_add_cap_sample()
391 avg->time_stamps[avg->pos] = now; in ab8500_fg_add_cap_sample()
392 avg->pos++; in ab8500_fg_add_cap_sample()
394 if (avg->pos == NBR_AVG_SAMPLES) in ab8500_fg_add_cap_sample()
395 avg->pos = 0; in ab8500_fg_add_cap_sample()
397 if (avg->nbr_samples < NBR_AVG_SAMPLES) in ab8500_fg_add_cap_sample()
398 avg->nbr_samples++; in ab8500_fg_add_cap_sample()
404 } while (now - VALID_CAPACITY_SEC > avg->time_stamps[avg->pos]); in ab8500_fg_add_cap_sample()
406 avg->avg = avg->sum / avg->nbr_samples; in ab8500_fg_add_cap_sample()
408 return avg->avg; in ab8500_fg_add_cap_sample()
420 struct ab8500_fg_avg_cap *avg = &di->avg_cap; in ab8500_fg_clear_cap_samples() local
422 avg->pos = 0; in ab8500_fg_clear_cap_samples()
423 avg->nbr_samples = 0; in ab8500_fg_clear_cap_samples()
424 avg->sum = 0; in ab8500_fg_clear_cap_samples()
425 avg->avg = 0; in ab8500_fg_clear_cap_samples()
428 avg->samples[i] = 0; in ab8500_fg_clear_cap_samples()
429 avg->time_stamps[i] = 0; in ab8500_fg_clear_cap_samples()
444 struct ab8500_fg_avg_cap *avg = &di->avg_cap; in ab8500_fg_fill_cap_sample() local
449 avg->samples[i] = sample; in ab8500_fg_fill_cap_sample()
450 avg->time_stamps[i] = now; in ab8500_fg_fill_cap_sample()
453 avg->pos = 0; in ab8500_fg_fill_cap_sample()
454 avg->nbr_samples = NBR_AVG_SAMPLES; in ab8500_fg_fill_cap_sample()
455 avg->sum = sample * NBR_AVG_SAMPLES; in ab8500_fg_fill_cap_sample()
456 avg->avg = sample; in ab8500_fg_fill_cap_sample()