]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
staging: iio: light: jsa1127: fix workq scheduling
authorSri Krishna chowdary <schowdary@nvidia.com>
Tue, 3 Dec 2013 08:08:52 +0000 (13:38 +0530)
committerSachin Nikam <snikam@nvidia.com>
Wed, 4 Dec 2013 05:45:02 +0000 (21:45 -0800)
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>
drivers/staging/iio/light/jsa1127.c

index a1c086a668bdcc90e5f58764ae7b6bb3007d77df..7b1c14db665c73ecca2337d0b8fd202549cbac5d 100644 (file)
@@ -52,6 +52,7 @@ enum als_state {
 #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;
@@ -205,8 +206,9 @@ static ssize_t jsa1127_chan_enable(struct iio_dev *indio_dev,
        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;
        }