From d89cc5aad109d20d10d228ba52d86e0adca62461 Mon Sep 17 00:00:00 2001 From: Jonas Aaberg Date: Tue, 17 Apr 2012 16:10:46 +0200 Subject: [PATCH] mfd: ab8500-gpadc: Reread on failure Reread the gpadc once upon failure. Signed-off-by: Jonas Aaberg Signed-off-by: Lee Jones Reviewed-by: Mattias WALLIN Acked-by: Samuel Ortiz --- drivers/mfd/ab8500-gpadc.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.39.5