]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mfd: ab8500-gpadc: Reread on failure
authorJonas Aaberg <jonas.aberg@stericsson.com>
Tue, 17 Apr 2012 14:10:46 +0000 (16:10 +0200)
committerLee Jones <lee.jones@linaro.org>
Thu, 7 Mar 2013 04:27:10 +0000 (12:27 +0800)
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>
drivers/mfd/ab8500-gpadc.c

index 9ed3afc31d11821abcf4df94b76fab9554ff8947..7f39479c1afc5495892d273e01eb40385fab6d56 100644 (file)
@@ -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;