s3c_adc_battery: Average over more than one adc sample
authorHeiko Stübner <heiko@sntech.de>
Thu, 29 Dec 2011 11:52:07 +0000 (12:52 +0100)
committerAnton Vorontsov <cbouatmailru@gmail.com>
Fri, 6 Jan 2012 02:13:35 +0000 (06:13 +0400)
commit34aed73df3a9e75e313a7510b201f6755ae3e6bc
tree3ded8d8b8019eb5b7eff82ab1e4267ad5df789ab
parentded7fc7b055055427d0d04958482dbe3d23e087d
s3c_adc_battery: Average over more than one adc sample

Some sources for adc battery information provide only inaccurate results
where the read value differs from the real value with positive and negative
offsets. For such sources it can be more accurate to collect two or more
value sample and use the average of all collected values.

This patch adds pdata options volt_samples, current_samples and
backup_volt_samples to specifiy the number of samples to collect,
reads the specified number of samples and calculates the average of those.
For unset sample-number-values a default of 1 is assumed.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
drivers/power/s3c_adc_battery.c
include/linux/s3c_adc_battery.h