summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSang-Hun Lee <sanlee@nvidia.com>2013-10-09 14:14:24 -0700
committerHarshada Kale <hkale@nvidia.com>2013-10-10 04:28:32 -0700
commitfb4a444dc777c9c8ca9e7d6d50ccc1ec93841751 (patch)
treee5d0f6e9c519f2245246f9722c11aea7587f9ecd
parent810f9b671e1764f101bf6c0bfa4797edf1f707dc (diff)
input: misc: inv: prevent IRQ revival
Problem description: - nvi_work_function may revive IRQ which was disabled during suspend and shutdown Fix description: - Add a flag stop_workqueue which is set during suspend and shutdown - If the flag is set, make workqueue not revive the IRQ Bug 1361923 Change-Id: I498091602ef9c43b75c0a17d7fe0837624271959 Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com> Reviewed-on: http://git-master/r/284347 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Robert Collins <rcollins@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r--drivers/input/misc/mpu/inv_gyro.c6
-rw-r--r--drivers/input/misc/mpu/inv_gyro.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/input/misc/mpu/inv_gyro.c b/drivers/input/misc/mpu/inv_gyro.c
index d1c2bcd93868..0b024d84dc44 100644
--- a/drivers/input/misc/mpu/inv_gyro.c
+++ b/drivers/input/misc/mpu/inv_gyro.c
@@ -4378,6 +4378,7 @@ static int nvi_suspend(struct device *dev)
if (!inf->irq_disabled)
disable_irq_nosync(inf->i2c->irq);
inf->irq_disabled = true;
+ inf->stop_workqueue = true;
spin_unlock_irqrestore(&inf->time_stamp_lock, flags);
synchronize_irq(inf->i2c->irq);
@@ -4403,6 +4404,7 @@ static int nvi_resume(struct device *dev)
if (inf->irq_disabled)
enable_irq(inf->i2c->irq);
inf->irq_disabled = false;
+ inf->stop_workqueue = false;
spin_unlock_irqrestore(&inf->time_stamp_lock, flags);
mutex_lock(&inf->mutex);
@@ -4432,6 +4434,7 @@ static void nvi_shutdown(struct i2c_client *client)
if (!inf->irq_disabled)
disable_irq_nosync(client->irq);
inf->irq_disabled = true;
+ inf->stop_workqueue = true;
spin_unlock_irqrestore(&inf->time_stamp_lock, flags);
synchronize_irq(inf->i2c->irq);
@@ -4489,7 +4492,8 @@ static void nvi_work_func(struct work_struct *work)
}
spin_lock_irqsave(&inf->time_stamp_lock, flags);
- if (inf->irq_disabled && !(inf->suspend || inf->shutdown)) {
+ if (inf->irq_disabled && !inf->stop_workqueue
+ && !(inf->suspend || inf->shutdown)) {
enable_irq(inf->i2c->irq);
inf->irq_disabled = false;
}
diff --git a/drivers/input/misc/mpu/inv_gyro.h b/drivers/input/misc/mpu/inv_gyro.h
index c6cd46c2c05e..1bfc8bcdc510 100644
--- a/drivers/input/misc/mpu/inv_gyro.h
+++ b/drivers/input/misc/mpu/inv_gyro.h
@@ -438,6 +438,7 @@ struct inv_gyro_state_s {
u16 fifo_sample_size;
bool shutdown;
bool suspend;
+ bool stop_workqueue;
bool fifo_reset_3050;
bool mot_det_en;
s64 fifo_ts;