aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd/pcf50633-adc.c
diff options
context:
space:
mode:
authormerge <null@invalid>2008-12-05 09:59:34 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-12-05 09:59:34 +0000
commit361fff778b7c4d2c78f28833415335148d86a1aa (patch)
treee616c940a691b9ff548b1aaeb747eae8a1342509 /drivers/mfd/pcf50633-adc.c
parent5adc83c203167f77dd9b975ee275e3014287d6c7 (diff)
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 <null@invalid> 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 <andy@openmoko.com> build-fix-path-to-toolchain-one-at-last.patch Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/mfd/pcf50633-adc.c')
-rw-r--r--drivers/mfd/pcf50633-adc.c23
1 files changed, 16 insertions, 7 deletions
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 <linux/mfd/pcf50633/core.h>
#include <linux/mfd/pcf50633/adc.h>
@@ -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)