Commit f6f58d9d authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Jonathan Cameron

iio: humidity: hts221: do not overwrite reserved data during power-down

GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
reserved. Do not changed the original value (not declared in the
datasheet) during power-down/suspend routines.

Fixes: e4a70e3e (iio: humidity: add support to hts221 rh/temp device)
Fixes: b7079eea (iio: humidity: hts221: add power management support)
Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 2ede2740
...@@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw) ...@@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw)
int hts221_power_off(struct hts221_hw *hw) int hts221_power_off(struct hts221_hw *hw)
{ {
__le16 data = 0;
int err; int err;
err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data), err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
(u8 *)&data); HTS221_ENABLE_MASK, false);
if (err < 0) if (err < 0)
return err; return err;
...@@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev) ...@@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev)
{ {
struct iio_dev *iio_dev = dev_get_drvdata(dev); struct iio_dev *iio_dev = dev_get_drvdata(dev);
struct hts221_hw *hw = iio_priv(iio_dev); struct hts221_hw *hw = iio_priv(iio_dev);
__le16 data = 0;
int err; int err;
err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data), err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
(u8 *)&data); HTS221_ENABLE_MASK, false);
return err < 0 ? err : 0; return err < 0 ? err : 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment