aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ab8500-gpadc.c
diff options
context:
space:
mode:
authorKarl Komierowski <karl.komierowski@stericsson.com>2011-03-05 05:46:45 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2011-03-23 05:42:04 -0400
commit4aad5a918c919c04b6c3136f3c4dcafada3b6319 (patch)
tree80d6e137f2dabefd908ef32f4eaa86566181d3dc /drivers/mfd/ab8500-gpadc.c
parent586f3318adceee4857e82cafc3610070368754e3 (diff)
mfd: Fix ab8500-gpadc to measure charger current
The GPADC in the AB8500 was incorrectly configured when a charger current channel was selected. Signed-off-by: Karl Komierowski <karl.komierowski@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/ab8500-gpadc.c')
-rw-r--r--drivers/mfd/ab8500-gpadc.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index a70201a74729..2ad3115f7772 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -56,6 +56,7 @@
56#define DIS_GPADC 0x00 56#define DIS_GPADC 0x00
57#define SW_AVG_16 0x60 57#define SW_AVG_16 0x60
58#define ADC_SW_CONV 0x04 58#define ADC_SW_CONV 0x04
59#define EN_ICHAR 0x80
59#define EN_BUF 0x40 60#define EN_BUF 0x40
60#define DIS_ZERO 0x00 61#define DIS_ZERO 0x00
61#define GPADC_BUSY 0x01 62#define GPADC_BUSY 0x01
@@ -281,9 +282,23 @@ int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 input)
281 "gpadc_conversion: set avg samples failed\n"); 282 "gpadc_conversion: set avg samples failed\n");
282 goto out; 283 goto out;
283 } 284 }
284 /* Enable ADC, Buffering and select rising edge, start Conversion */ 285 /*
285 ret = abx500_mask_and_set_register_interruptible(gpadc->dev, 286 * Enable ADC, buffering, select rising edge and enable ADC path
286 AB8500_GPADC, AB8500_GPADC_CTRL1_REG, EN_BUF, EN_BUF); 287 * charging current sense if it needed
288 */
289 switch (input) {
290 case MAIN_CHARGER_C:
291 case USB_CHARGER_C:
292 ret = abx500_mask_and_set_register_interruptible(gpadc->dev,
293 AB8500_GPADC, AB8500_GPADC_CTRL1_REG,
294 EN_BUF | EN_ICHAR,
295 EN_BUF | EN_ICHAR);
296 break;
297 default:
298 ret = abx500_mask_and_set_register_interruptible(gpadc->dev,
299 AB8500_GPADC, AB8500_GPADC_CTRL1_REG, EN_BUF, EN_BUF);
300 break;
301 }
287 if (ret < 0) { 302 if (ret < 0) {
288 dev_err(gpadc->dev, 303 dev_err(gpadc->dev,
289 "gpadc_conversion: select falling edge failed\n"); 304 "gpadc_conversion: select falling edge failed\n");