MPU6050: Disable irq when suspend all sensors
Hunk Lin [Mon, 30 Jul 2012 16:19:09 +0000 (00:19 +0800)]
When we suspend all sensors, MPU6050 continue generating irqs.
So set MPUREG_INT_ENABLE to 0 for saving power.

Bug 1021448

Signed-off-by: Hunk Lin <hulin@nvidia.com>
Change-Id: I90acb0b5e297c61c205a20b8eb54e6164a4d5b32
Reviewed-on: http://git-master/r/119344
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Prem Sasidharan <psasidharan@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
(cherry picked from commit 420cba2c46f70f77945653be51656b6ae89d5397)
Reviewed-on: http://git-master/r/123477
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/misc/inv_mpu/mpu6050/mldl_cfg.c

index 22af0c2..920f4ae 100644 (file)
@@ -1786,6 +1786,16 @@ int inv_mpu_suspend(struct mldl_cfg *mldl_cfg,
                        return result;
                }
        }
+       /* Disable irq when suspend all sensors */
+       if (sensors == INV_ALL_SENSORS) {
+               result = inv_serial_single_write(
+                       gyro_handle, mldl_cfg->mpu_chip_info->addr,
+                       MPUREG_INT_ENABLE, 0);
+               if (result) {
+                       LOG_RESULT_LOCATION(result);
+                       return result;
+               }
+       }
        mldl_cfg->inv_mpu_cfg->requested_sensors = (~sensors) & INV_ALL_SENSORS;
 
        return result;