There are 2 issues here
1. After entering os idle display off, execution of a pengin work
leads to i2c errors
- fix this by waiting gor it to complete when disabling
- This assumes that android sensoservice thread de activates the sensor,
which is true.
2. While exiting os idle display off, sensor's power rail is
just turned on but sensor itself is not yet ready for i2c
communication which causes i2c errors
- fix this by scheduling the delayed work after JSA1127_POWER_ON_DELAY.
- JSA1127_POWER_ON_DELAY is found by trail and error method.
Bug
1410461
Change-Id: I3ea65270dba2f3521574b0e0b2d451ea8ba882d5
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/337674
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
#define JSA1127_CMD_START_INTERGATION 0x08
#define JSA1127_CMD_STOP_INTERGATION 0x30
#define JSA1127_CMD_STANDBY 0x8C
+#define JSA1127_POWER_ON_DELAY 60 /* msec */
struct jsa1127_chip {
struct i2c_client *client;
if (enable) {
chip->als_raw_value = 0;
chip->als_state = CHIP_POWER_ON_ALS_ON;
- queue_delayed_work(chip->wq, &chip->dw, 0);
+ queue_delayed_work(chip->wq, &chip->dw, JSA1127_POWER_ON_DELAY);
} else {
+ cancel_delayed_work_sync(&chip->dw);
chip->als_state = CHIP_POWER_ON_ALS_OFF;
}