diff options
author | Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> | 2017-07-17 19:39:05 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2017-07-25 20:03:04 +0100 |
commit | f3f0ae16f0ce2a11067b958c7cf2a48c32ea6d60 (patch) | |
tree | fa9d8efafa80faf1c0579851c59ea112cbc0c7f7 /drivers/iio/humidity/hts221_buffer.c | |
parent | 21d841b2a417bfe4cce9b1266bb851ba0da89d37 (diff) | |
download | lwn-f3f0ae16f0ce2a11067b958c7cf2a48c32ea6d60.tar.gz lwn-f3f0ae16f0ce2a11067b958c7cf2a48c32ea6d60.zip |
iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state()
Move data-ready configuration in hts221_buffer.c since it is only related
to trigger logic
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/humidity/hts221_buffer.c')
-rw-r--r-- | drivers/iio/humidity/hts221_buffer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c index f29f01a22375..9690dfe9a844 100644 --- a/drivers/iio/humidity/hts221_buffer.c +++ b/drivers/iio/humidity/hts221_buffer.c @@ -28,6 +28,8 @@ #define HTS221_REG_DRDY_HL_MASK BIT(7) #define HTS221_REG_DRDY_PP_OD_ADDR 0x22 #define HTS221_REG_DRDY_PP_OD_MASK BIT(6) +#define HTS221_REG_DRDY_EN_ADDR 0x22 +#define HTS221_REG_DRDY_EN_MASK BIT(2) #define HTS221_REG_STATUS_ADDR 0x27 #define HTS221_RH_DRDY_MASK BIT(1) #define HTS221_TEMP_DRDY_MASK BIT(0) @@ -36,8 +38,12 @@ static int hts221_trig_set_state(struct iio_trigger *trig, bool state) { struct iio_dev *iio_dev = iio_trigger_get_drvdata(trig); struct hts221_hw *hw = iio_priv(iio_dev); + int err; + + err = hts221_write_with_mask(hw, HTS221_REG_DRDY_EN_ADDR, + HTS221_REG_DRDY_EN_MASK, state); - return hts221_config_drdy(hw, state); + return err < 0 ? err : 0; } static const struct iio_trigger_ops hts221_trigger_ops = { |