From 361fff778b7c4d2c78f28833415335148d86a1aa Mon Sep 17 00:00:00 2001 From: merge Date: Fri, 5 Dec 2008 09:59:34 +0000 Subject: MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-build-fix-path-to-toolchain-on-1228470136 pending-tracking-hist top was MERGE-via-stable-tracking-build-fix-path-to-toolchain-on-1228470136 / 21b67ab8e79998b0a534263282dab1dda0f11b00 ... parent commitmessage: From: merge MERGE-via-stable-tracking-hist-build-fix-path-to-toolchain-on stable-tracking-hist top was build-fix-path-to-toolchain-on / ca14ba894df9b28822066c578dde48d7dbe931de ... parent commitmessage: From: Andy Green build-fix-path-to-toolchain-one-at-last.patch Signed-off-by: Andy Green --- drivers/mfd/pcf50633-adc.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'drivers/mfd/pcf50633-adc.c') diff --git a/drivers/mfd/pcf50633-adc.c b/drivers/mfd/pcf50633-adc.c index ebd3792e778..e3d4eb1c03f 100644 --- a/drivers/mfd/pcf50633-adc.c +++ b/drivers/mfd/pcf50633-adc.c @@ -23,6 +23,11 @@ * MA 02111-1307 USA */ +/* + * NOTE: This driver does not yet support subtractive ADC mode, which means + * you can do only one measurement per read request. + */ + #include #include @@ -115,7 +120,7 @@ int pcf50633_adc_sync_read(struct pcf50633 *pcf, int mux, int avg) struct pcf50633_adc_request *req; int result; - /* req is freed when the result is ready, in pcf50633_work*/ + /* req is freed when the result is ready, in interrupt handler */ req = kzalloc(sizeof(*req), GFP_KERNEL); if (!req) return -ENOMEM; @@ -141,7 +146,7 @@ int pcf50633_adc_async_read(struct pcf50633 *pcf, int mux, int avg, { struct pcf50633_adc_request *req; - /* req is freed when the result is ready, in pcf50633_work*/ + /* req is freed when the result is ready, in interrupt handler */ req = kmalloc(sizeof(*req), GFP_KERNEL); if (!req) return -ENOMEM; @@ -159,12 +164,16 @@ EXPORT_SYMBOL_GPL(pcf50633_adc_async_read); static int adc_result(struct pcf50633 *pcf) { - u16 ret = (pcf50633_reg_read(pcf, PCF50633_REG_ADCS1) << 2) | - (pcf50633_reg_read(pcf, PCF50633_REG_ADCS3) & - PCF50633_ADCS3_ADCDAT1L_MASK); - dev_info(pcf->dev, "adc result = %d\n", ret); + u8 adcs1, adcs3; + u16 result; + + adcs1 = pcf50633_reg_read(pcf, PCF50633_REG_ADCS1); + adcs3 = pcf50633_reg_read(pcf, PCF50633_REG_ADCS3); + result = (adcs1 << 2) | (adcs3 & PCF50633_ADCS3_ADCDAT1L_MASK); - return ret; + dev_info(pcf->dev, "adc result = %d\n", result); + + return result; } static void pcf50633_adc_irq(struct pcf50633 *pcf, int irq, void *unused) -- cgit v1.2.3