diff options
author | Sang-Hun Lee <sanlee@nvidia.com> | 2013-05-12 17:46:52 -0700 |
---|---|---|
committer | Mandar Padmawar <mpadmawar@nvidia.com> | 2013-05-23 23:08:53 -0700 |
commit | fbaa987c3143381c22c7846718764a6e6110c723 (patch) | |
tree | 9c04fc12fa6e0a8a70370a510c5e92b516d1db37 | |
parent | e814ec48e8da73d71c59901918d41102fee4bb77 (diff) |
input: misc: inv: disable irq when powering off
Problem descritpion:
- Even after powering off the device through inv_set_power_state,
inv_read_fifo can be running in paralell, still talking to the
device
Fix description:
- When powering off the device, also disable the irq to avoid
talking to a powered off device
- As a side effect, this change will also ensure interrupts from gyro
do not result in a lock up of i2c bus during suspend even in case
of an interrupt storm
Bug 1285239
Change-Id: I42dfa094b645944e22d600b64abc18b10b7fb38b
Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com>
Reviewed-on: http://git-master/r/227781
(cherry picked from commit a2ce58ee6da12bbe3f9d18dfcef1e6a48a4572a9)
Reviewed-on: http://git-master/r/232274
Reviewed-by: Matt Wagner <mwagner@nvidia.com>
Tested-by: Matt Wagner <mwagner@nvidia.com>
GVS: Gerrit_Virtual_Submit
-rw-r--r-- | drivers/input/misc/mpu/inv_gyro.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/input/misc/mpu/inv_gyro.c b/drivers/input/misc/mpu/inv_gyro.c index c05a495220c8..d7cd0ea87ca4 100644 --- a/drivers/input/misc/mpu/inv_gyro.c +++ b/drivers/input/misc/mpu/inv_gyro.c @@ -228,10 +228,18 @@ static int set_power_itg(struct inv_gyro_state_s *st, unsigned char power_on) */ int inv_set_power_state(struct inv_gyro_state_s *st, unsigned char power_on) { + int ret; + if (!power_on) + disable_irq(st->trigger.irq); + if (INV_MPU3050 == st->chip_type) - return set_power_mpu3050(st, power_on); + ret = set_power_mpu3050(st, power_on); else - return set_power_itg(st, power_on); + ret = set_power_itg(st, power_on); + + if (power_on) + enable_irq(st->trigger.irq); + return ret; } /** |