CTRL1 register (ODR & BDU settings) gets reset after system comes back from suspend, causing subsequent reads from the sensor to fail. This patch restores the CTRL1 register after resume. Based on: git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git iio-fixes-for-4.14b Since 4.17.rc1, this driver uses REGMAP; I'll send a separate patch to address this issue. Cc: stable@xxxxxxxxxxxxxxx Fixes: ffebe74b7c95 (iio: humidity: hts221: avoid useless ODR reconfiguration) Signed-off-by: Shrirang Bagul <shrirang.bagul@xxxxxxxxxxxxx> --- drivers/iio/humidity/hts221_core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c index 32524a8dc66f..fed2da64fa3b 100644 --- a/drivers/iio/humidity/hts221_core.c +++ b/drivers/iio/humidity/hts221_core.c @@ -674,11 +674,15 @@ static int __maybe_unused hts221_resume(struct device *dev) struct hts221_hw *hw = iio_priv(iio_dev); int err = 0; - if (hw->enabled) - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR, - HTS221_ENABLE_MASK, true); + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR, + HTS221_BDU_MASK, 1); + if (err < 0) + goto fail_err; - return err; + err = hts221_update_odr(hw, hw->odr); + +fail_err: + return err < 0 ? err : 0; } const struct dev_pm_ops hts221_pm_ops = { -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html