Skip to content

Commit

Permalink
i2c/tsl2550: Fix lux value in extended mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michele Jr De Candia authored and Jean Delvare committed Nov 26, 2009
1 parent a8a8a66 commit 5f5bfb0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/i2c/chips/tsl2550.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,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;

Expand All @@ -274,6 +275,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);
}
Expand Down

0 comments on commit 5f5bfb0

Please sign in to comment.