i2c/tsl2550: Fix lux value in dark environment
commit16d2e0f5c770906a47f610bd9b74ef2dd6d46798
authorMichele Jr De Candia <michele.decandia@valueteam.com>
Tue, 28 Jul 2009 14:33:03 +0000 (28 16:33 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 16 Aug 2009 21:18:51 +0000 (16 14:18 -0700)
tree5a8595972a905fa4d203d95676da3d20744ff0cf
parent555bb17d1898ead697a5dc3fc06c174e606626ef
i2c/tsl2550: Fix lux value in dark environment

commit 96f699ad09c8b3c55cd229506a9add0047838e3e upstream.

I've tested TSL2550 driver and I've found a bug: when light is off,
returned value from tsl2550_calculate_lux function is -1 when it should
be 0 (sensor correctly read that light was off).

I think the bug is that a zero c0 value (approximated value of ch0) is
misinterpreted as an error.

Signed-off-by: Michele Jr De Candia <michele.decandia@valueteam.com>
Acked-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/i2c/chips/tsl2550.c