diff options
author | Johan Palsson <johan.palsson@stericsson.com> | 2011-02-03 11:24:59 +0100 |
---|---|---|
committer | Jonas ABERG <jonas.aberg@stericsson.com> | 2011-02-07 10:24:30 +0100 |
commit | 27646ade4b39f17c2040b836a9304cab2280939a (patch) | |
tree | f6d233c1c4219ac58820d572c360ac6fd03c6527 /drivers/hwmon | |
parent | ea0c5fc93a9679b4152e322b5672103a00ed41fb (diff) |
misc: ab8500_gpadc: Use calibrated ADC values from OTP
Three ADC channels are calibrated in factory and the parameters
are stored in OTP. These parameters are now read and used in
the GPADC driver. Also the function ab8500_gpadc_convert now returns
a voltage instead of a raw AD-value
ST-Ericsson ID: WP322611
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I600faf8b30122a6dd95048c1059b33623f37aeeb
Signed-off-by: Johan Palsson <johan.palsson@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/14191
Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/ab8500.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c index 8c27a289ebd..c6000fa42c0 100644 --- a/drivers/hwmon/ab8500.c +++ b/drivers/hwmon/ab8500.c @@ -133,11 +133,6 @@ static void gpadc_monitor(struct work_struct *work) dev_err(&data->pdev->dev, "GPADC read failed\n"); continue; } - /* - * 1350*x/1023 is the formula to convert from RAW GPADC data - * to voltage for AdcAux1 and AdcAux2 on the AB8500. - */ - val = (1350 * val) / 1023; mutex_lock(&data->lock); if (data->min[i] != 0) { @@ -344,15 +339,9 @@ static ssize_t show_input(struct device *dev, u8 gpadc_addr = data->gpadc_addr[attr->index - 1]; val = ab8500_gpadc_convert(data->ab8500->gpadc, gpadc_addr); - if (val < 0) { + if (val < 0) dev_err(&data->pdev->dev, "GPADC read failed\n"); - } else { - /* - * 1350*x/1023 is the formula to convert from RAW GPADC data - * to voltage for AdcAux1 and AdcAux2 on the AB8500. - */ - val = (1350 * val) / 1023; - } + return sprintf(buf, "%d\n", val); } |