summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ab8500-gpadc.c
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2012-04-17 16:10:46 +0200
committerLee Jones <lee.jones@linaro.org>2013-03-07 12:27:10 +0800
commitd89cc5aad109d20d10d228ba52d86e0adca62461 (patch)
treeabcd430bbf213c291184d405d6bcfc86a80d07e0 /drivers/mfd/ab8500-gpadc.c
parent774c50abae2456af492728aee8d282ba5079b744 (diff)
downloadlinux-d89cc5aad109d20d10d228ba52d86e0adca62461.tar.bz2
mfd: ab8500-gpadc: Reread on failure
Reread the gpadc once upon failure. Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/ab8500-gpadc.c')
-rw-r--r--drivers/mfd/ab8500-gpadc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index 9ed3afc31d11..7f39479c1afc 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -256,6 +256,11 @@ int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel)
int voltage;
ad_value = ab8500_gpadc_read_raw(gpadc, channel);
+
+ /* On failure retry a second time */
+ if (ad_value < 0)
+ ad_value = ab8500_gpadc_read_raw(gpadc, channel);
+
if (ad_value < 0) {
dev_err(gpadc->dev, "GPADC raw value failed ch: %d\n", channel);
return ad_value;