From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lorenzo Bianconi Subject: Re: [PATCH 9/9] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state() Date: Sun, 16 Jul 2017 11:45:15 +0200 Message-ID: References: <20170709165704.26311-1-lorenzo.bianconi@st.com> <20170709165704.26311-10-lorenzo.bianconi@st.com> <20170709194123.39fd6914@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jonathan Cameron Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Lorenzo BIANCONI List-Id: devicetree@vger.kernel.org >> On Sun, 9 Jul 2017 18:57:04 +0200 >> Lorenzo Bianconi wrote: >> >>> Move data-ready configuration in hts221_buffer.c since it is only related >>> to trigger logic >>> >>> Signed-off-by: Lorenzo Bianconi >> The rest of the series looks good to me. We are early in the cycle >> so should have plenty of time to pin down the question on how to handle >> irq line inversion visibility to the kernel. > > Fine, pretty interesting stuff :) > Regards, > Lorenzo Hi Jonathan, I added all suggested changes in v2. What is the best way to support that possibility (irq line inversion visibility)? Is it up to hts221? Regards, Lorenzo > >> >> Jonathan >>> --- >>> drivers/iio/humidity/hts221.h | 1 - >>> drivers/iio/humidity/hts221_buffer.c | 8 +++++++- >>> drivers/iio/humidity/hts221_core.c | 14 -------------- >>> 3 files changed, 7 insertions(+), 16 deletions(-) >>> >>> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h >>> index 0fbc89fe213d..2b4e5246447a 100644 >>> --- a/drivers/iio/humidity/hts221.h >>> +++ b/drivers/iio/humidity/hts221.h >>> @@ -66,7 +66,6 @@ struct hts221_hw { >>> >>> extern const struct dev_pm_ops hts221_pm_ops; >>> >>> -int hts221_config_drdy(struct hts221_hw *hw, bool enable); >>> int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val); >>> int hts221_probe(struct iio_dev *iio_dev); >>> int hts221_set_enable(struct hts221_hw *hw, bool enable); >>> 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 = { >>> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c >>> index dfacf64a6f2e..12c2bc5954e4 100644 >>> --- a/drivers/iio/humidity/hts221_core.c >>> +++ b/drivers/iio/humidity/hts221_core.c >>> @@ -23,7 +23,6 @@ >>> >>> #define HTS221_REG_CNTRL1_ADDR 0x20 >>> #define HTS221_REG_CNTRL2_ADDR 0x21 >>> -#define HTS221_REG_CNTRL3_ADDR 0x22 >>> >>> #define HTS221_REG_AVG_ADDR 0x10 >>> #define HTS221_REG_H_OUT_L 0x28 >>> @@ -36,9 +35,6 @@ >>> #define HTS221_BDU_MASK BIT(2) >>> #define HTS221_ENABLE_MASK BIT(7) >>> >>> -#define HTS221_DRDY_MASK BIT(2) >>> - >>> - >>> /* calibration registers */ >>> #define HTS221_REG_0RH_CAL_X_H 0x36 >>> #define HTS221_REG_1RH_CAL_X_H 0x3a >>> @@ -180,16 +176,6 @@ static int hts221_check_whoami(struct hts221_hw *hw) >>> return 0; >>> } >>> >>> -int hts221_config_drdy(struct hts221_hw *hw, bool enable) >>> -{ >>> - int err; >>> - >>> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR, >>> - HTS221_DRDY_MASK, enable); >>> - >>> - return err < 0 ? err : 0; >>> -} >>> - >>> static int hts221_update_odr(struct hts221_hw *hw, u8 odr) >>> { >>> int i, err; >> > > > > -- > UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch; > unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; > umount; make clean; sleep -- UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; sleep -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 In-Reply-To: References: <20170709165704.26311-1-lorenzo.bianconi@st.com> <20170709165704.26311-10-lorenzo.bianconi@st.com> <20170709194123.39fd6914@kernel.org> From: Lorenzo Bianconi Date: Sun, 16 Jul 2017 11:45:15 +0200 Message-ID: Subject: Re: [PATCH 9/9] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state() To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Lorenzo BIANCONI Content-Type: text/plain; charset="UTF-8" List-ID: >> On Sun, 9 Jul 2017 18:57:04 +0200 >> Lorenzo Bianconi wrote: >> >>> Move data-ready configuration in hts221_buffer.c since it is only related >>> to trigger logic >>> >>> Signed-off-by: Lorenzo Bianconi >> The rest of the series looks good to me. We are early in the cycle >> so should have plenty of time to pin down the question on how to handle >> irq line inversion visibility to the kernel. > > Fine, pretty interesting stuff :) > Regards, > Lorenzo Hi Jonathan, I added all suggested changes in v2. What is the best way to support that possibility (irq line inversion visibility)? Is it up to hts221? Regards, Lorenzo > >> >> Jonathan >>> --- >>> drivers/iio/humidity/hts221.h | 1 - >>> drivers/iio/humidity/hts221_buffer.c | 8 +++++++- >>> drivers/iio/humidity/hts221_core.c | 14 -------------- >>> 3 files changed, 7 insertions(+), 16 deletions(-) >>> >>> diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h >>> index 0fbc89fe213d..2b4e5246447a 100644 >>> --- a/drivers/iio/humidity/hts221.h >>> +++ b/drivers/iio/humidity/hts221.h >>> @@ -66,7 +66,6 @@ struct hts221_hw { >>> >>> extern const struct dev_pm_ops hts221_pm_ops; >>> >>> -int hts221_config_drdy(struct hts221_hw *hw, bool enable); >>> int hts221_write_with_mask(struct hts221_hw *hw, u8 addr, u8 mask, u8 val); >>> int hts221_probe(struct iio_dev *iio_dev); >>> int hts221_set_enable(struct hts221_hw *hw, bool enable); >>> 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 = { >>> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c >>> index dfacf64a6f2e..12c2bc5954e4 100644 >>> --- a/drivers/iio/humidity/hts221_core.c >>> +++ b/drivers/iio/humidity/hts221_core.c >>> @@ -23,7 +23,6 @@ >>> >>> #define HTS221_REG_CNTRL1_ADDR 0x20 >>> #define HTS221_REG_CNTRL2_ADDR 0x21 >>> -#define HTS221_REG_CNTRL3_ADDR 0x22 >>> >>> #define HTS221_REG_AVG_ADDR 0x10 >>> #define HTS221_REG_H_OUT_L 0x28 >>> @@ -36,9 +35,6 @@ >>> #define HTS221_BDU_MASK BIT(2) >>> #define HTS221_ENABLE_MASK BIT(7) >>> >>> -#define HTS221_DRDY_MASK BIT(2) >>> - >>> - >>> /* calibration registers */ >>> #define HTS221_REG_0RH_CAL_X_H 0x36 >>> #define HTS221_REG_1RH_CAL_X_H 0x3a >>> @@ -180,16 +176,6 @@ static int hts221_check_whoami(struct hts221_hw *hw) >>> return 0; >>> } >>> >>> -int hts221_config_drdy(struct hts221_hw *hw, bool enable) >>> -{ >>> - int err; >>> - >>> - err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR, >>> - HTS221_DRDY_MASK, enable); >>> - >>> - return err < 0 ? err : 0; >>> -} >>> - >>> static int hts221_update_odr(struct hts221_hw *hw, u8 odr) >>> { >>> int i, err; >> > > > > -- > UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch; > unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; > umount; make clean; sleep -- UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; sleep