Skip to contentSkip to conversation

tsl2550: fix lux1_input error in low light

PATCH New Matt Ranostay 1 participant 1 message Jun 14, 2013 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/misc/tsl2550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/tsl2550.c +1 -1
index 1dfde4d..e58620b 100644
@@ -178,7 +178,7 @@ static int tsl2550_calculate_lux(u8 ch0, u8 ch1)
 		} else
 			lux = 0;
 	else
-		return -EAGAIN;
+		return 0;
 
 	/* LUX range check */
 	return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux;
Signature · 1 line
1.8.2.rc3.6.g407929c