diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-07-29 20:28:08 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-07-29 20:28:08 +0200 |
commit | b4093d6235b7e4249616651ee328600ced48a18a (patch) | |
tree | 9f5b8e466e2d26fbe13ee7934f9e939a09815bd5 /drivers/i2c | |
parent | d9ab77161d811ffb0bccf396f7155cc905c1b9e1 (diff) | |
parent | 7d3e91b8a1f5179d56a7412d4b499f2d5fc6b25d (diff) | |
download | linux-3.10-b4093d6235b7e4249616651ee328600ced48a18a.tar.gz linux-3.10-b4093d6235b7e4249616651ee328600ced48a18a.tar.bz2 linux-3.10-b4093d6235b7e4249616651ee328600ced48a18a.zip |
Merge branch 'master' into for-linus
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/chips/tsl2550.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c index 1a9cc135219..b96f3025e58 100644 --- a/drivers/i2c/chips/tsl2550.c +++ b/drivers/i2c/chips/tsl2550.c @@ -27,7 +27,7 @@ #include <linux/delay.h> #define TSL2550_DRV_NAME "tsl2550" -#define DRIVER_VERSION "1.1.1" +#define DRIVER_VERSION "1.1.2" /* * Defines @@ -189,13 +189,16 @@ static int tsl2550_calculate_lux(u8 ch0, u8 ch1) u8 r = 128; /* Avoid division by 0 and count 1 cannot be greater than count 0 */ - if (c0 && (c1 <= c0)) - r = c1 * 128 / c0; + if (c1 <= c0) + if (c0) { + r = c1 * 128 / c0; + + /* Calculate LUX */ + lux = ((c0 - c1) * ratio_lut[r]) / 256; + } else + lux = 0; else - return -1; - - /* Calculate LUX */ - lux = ((c0 - c1) * ratio_lut[r]) / 256; + return -EAGAIN; /* LUX range check */ return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux; |