• Brian Masney's avatar
    staging: iio: tsl2x7x: correct integration time and lux equation · 498efcd0
    Brian Masney authored
    The integration_time sysfs attribute did not report the correct
    time. Changing the integration time would cause the reported lux to
    change wildly. Once the integration time was corrected, all of the
    equations, and lux tables needed to be corrected to match what the
    data sheets expected. This patch corrects all of this, and adds some
    more comments about how some of the constants were derived. Here are
    the results from testing a TSL2772 hooked up to a Raspberry Pi 2:
    
    # cat in_intensity0_integration_time
    0.002730
    # watch -n .1 cat in_illuminance0_input
    ; Lux hovers around 55
    # echo 0.65 > in_intensity0_integration_time
    # cat in_intensity0_integration_time
    0.649740
    # watch -n .1 cat in_illuminance0_input
    ; Lux hovers around 55 with noticeable lag to lux changes in watch
    ; process.
    
    ; Now test the ALS calibration routine.
    # cat in_intensity0_calibbias
    1000
    # cat in_illuminance0_target_input
    150
    # echo 1 > in_illuminance0_calibrate
    # cat in_intensity0_calibbias
    2777
    # watch -n .1 cat in_illuminance0_input
    ; Lux now hovers around 150-155
    
    The returned lux values were tested on a TSL2772 in various lighting
    conditions and the results are within the lux ranges described at
    https://en.wikipedia.org/wiki/Lux.
    
    The driver was primarily tested using a TSL2772, however some quick tests
    were also ran against the devices TSL2771, TSL2572, and TMD2772.
    Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    498efcd0
tsl2x7x.h 3.71 KB