Commit 2ede2740 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Jonathan Cameron

iio: humidity: hts221: move BDU configuration in probe routine

Enable Block Data Update in hts221_probe() in order to avoid to reconfigure
it every time the sensor is enabled
Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent bd49302a
...@@ -203,12 +203,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr) ...@@ -203,12 +203,6 @@ static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
if (i == ARRAY_SIZE(hts221_odr_table)) if (i == ARRAY_SIZE(hts221_odr_table))
return -EINVAL; return -EINVAL;
/* enable Block Data Update */
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
HTS221_BDU_MASK, 1);
if (err < 0)
return err;
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR, err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
HTS221_ODR_MASK, hts221_odr_table[i].val); HTS221_ODR_MASK, hts221_odr_table[i].val);
if (err < 0) if (err < 0)
...@@ -644,6 +638,12 @@ int hts221_probe(struct iio_dev *iio_dev) ...@@ -644,6 +638,12 @@ int hts221_probe(struct iio_dev *iio_dev)
iio_dev->name = HTS221_DEV_NAME; iio_dev->name = HTS221_DEV_NAME;
iio_dev->info = &hts221_info; iio_dev->info = &hts221_info;
/* enable Block Data Update */
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
HTS221_BDU_MASK, 1);
if (err < 0)
return err;
/* configure humidity sensor */ /* configure humidity sensor */
err = hts221_parse_rh_caldata(hw); err = hts221_parse_rh_caldata(hw);
if (err < 0) { if (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