[PATCH] TSL2550: extended mode bugfix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
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.
The following patch should fix the lux calculation in this case.

Regards,
Michele De Candia
--

Signed-off-by: Michele Jr De Candia <michele.decandia@xxxxxxxxxxxxx>

drivers/i2c/chips/tsl2550.c |    7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c
index b96f302..04b87e0 100644
--- a/drivers/i2c/chips/tsl2550.c
+++ b/drivers/i2c/chips/tsl2550.c
@@ -279,7 +279,7 @@ static ssize_t __tsl2550_show_lux(struct i2c_client
*client, char *buf)
{
    u8 ch0, ch1;
    int ret;
-
+    struct tsl2550_data *data = i2c_get_clientdata(client);
    ret = tsl2550_get_adc_value(client, TSL2550_READ_ADC0);
    if (ret < 0)
        return ret;
@@ -293,7 +293,10 @@ static ssize_t __tsl2550_show_lux(struct i2c_client
*client, char *buf)
    ch1 = ret;

    /* Do the job */
-    ret = tsl2550_calculate_lux(ch0, ch1);
+    if (!data->operating_mode)
+        ret = tsl2550_calculate_lux(ch0, ch1);
+    else
+        ret = tsl2550_calculate_lux(ch0, ch1) * 5;
    if (ret < 0)
        return ret;


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

[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux