[PATCH 2/2] apds9802als: fix als sensing range value

From: Alan Cox
Date: Tue Sep 28 2010 - 09:09:43 EST


From: Hong Liu <hong.liu@xxxxxxxxx>

The 4K and 64K in the hw spec acutally means 4095 (12bit) and 65535 (16bit).

Signed-off-by: Hong Liu <hong.liu@xxxxxxxxx>
---

drivers/misc/apds9802als.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c
index cfd004a..a55a215 100644
--- a/drivers/misc/apds9802als.c
+++ b/drivers/misc/apds9802als.c
@@ -55,9 +55,9 @@ static ssize_t als_sensing_range_show(struct device *dev,
if (val < 0)
return val;
if (val & 1)
- return sprintf(buf, "4000\n");
+ return sprintf(buf, "4095\n");
else
- return sprintf(buf, "64000\n");
+ return sprintf(buf, "65535\n");
}

static ssize_t als_lux_output_data_show(struct device *dev,
@@ -111,7 +111,7 @@ static ssize_t als_sensing_range_store(struct device *dev,
/* Reset the bits before setting them */
ret_val = ret_val & 0xFA;

- if (val == 1) /* Setting the continous measurement up to 8k LUX */
+ if (val == 1) /* Setting the continous measurement up to 4k LUX */
ret_val = (ret_val | 0x05);
else /* Setting the continous measurement up to 64k LUX*/
ret_val = (ret_val | 0x04);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/