iio: imu: inv_mpu6050: fix suspend/resume with runtime power
authorJean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Tue, 31 Mar 2020 13:38:50 +0000 (15:38 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 19 Apr 2020 16:50:02 +0000 (17:50 +0100)
commit0a2bf9200aeaa8c1dd23ec65af30af3643ace887
tree1a937a9ca4f5b436880a21b5f79fef151989813c
parente450e07c14abae563ad13b064cbce9fdccc6bc8d
iio: imu: inv_mpu6050: fix suspend/resume with runtime power

Suspend/resume were not working correctly with pm runtime.
Now suspend check if the chip is already suspended, and
resume put runtime pm in the correct state.

Issues seen prior to this were:

When entering suspend, there was an error in logs because we
were disabling vddio regulator although it was already disabled.
And when resuming, the chip was pull back to full power but the
pm_runtime state was not updated. So it was believing it was
still suspended.

Fixes: 4599cac84614 ("iio: imu: inv_mpu6050: use runtime pm with autosuspend")
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c