提交 ce054546 编写于 作者: M Matt Ranostay 提交者: Greg Kroah-Hartman

tsl2550: fix lux1_input error in low light

ADC channel 0 photodiode detects both infrared + visible light,
but ADC channel 1 just detects infrared. However, the latter is a bit
more sensitive in that range so complete darkness or low light causes
a error condition in which the chan0 - chan1 is negative that
results in a -EAGAIN.

This patch changes the resulting lux1_input sysfs attribute message from
"Resource temporarily unavailable" to a user-grokable lux value of 0.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NMatt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 6051e79b
...@@ -177,7 +177,7 @@ static int tsl2550_calculate_lux(u8 ch0, u8 ch1) ...@@ -177,7 +177,7 @@ static int tsl2550_calculate_lux(u8 ch0, u8 ch1)
} else } else
lux = 0; lux = 0;
else else
return -EAGAIN; return 0;
/* LUX range check */ /* LUX range check */
return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux; return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册