summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Jr De Candia <michele.decandia@valueteam.com>2009-11-26 09:22:32 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-01-06 15:17:12 -0800
commit18ba31ab3db7b92c9ecb01229d983fd37173ab8f (patch)
tree2288d6d23fe47adc38622737c47eb0b594026cc4
parent3f6d77e001665a4d44ab9a70820d46a3e777dca8 (diff)
i2c/tsl2550: Fix lux value in extended mode
commit 5f5bfb09d81c9a1d26238ae6668e584c14ae3daf upstream. According to the TAOS Application Note 'Controlling a Backlight with the TSL2550 Ambient Light Sensor' (page 14), the actual lux value in extended mode should be obtained multiplying the calculated lux value by 5. Signed-off-by: Michele Jr De Candia <michele.decandia@valueteam.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/i2c/chips/tsl2550.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c
index b96f3025e588..ec0a7cab6c8b 100644
--- a/drivers/i2c/chips/tsl2550.c
+++ b/drivers/i2c/chips/tsl2550.c
@@ -277,6 +277,7 @@ static DEVICE_ATTR(operating_mode, S_IWUSR | S_IRUGO,
static ssize_t __tsl2550_show_lux(struct i2c_client *client, char *buf)
{
+ struct tsl2550_data *data = i2c_get_clientdata(client);
u8 ch0, ch1;
int ret;
@@ -296,6 +297,8 @@ static ssize_t __tsl2550_show_lux(struct i2c_client *client, char *buf)
ret = tsl2550_calculate_lux(ch0, ch1);
if (ret < 0)
return ret;
+ if (data->operating_mode == 1)
+ ret *= 5;
return sprintf(buf, "%d\n", ret);
}