All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	lorenzo.bianconi@st.com
Subject: Re: [PATCH v2 10/10] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state()
Date: Tue, 25 Jul 2017 20:03:35 +0100	[thread overview]
Message-ID: <20170725200335.224f0c35@kernel.org> (raw)
In-Reply-To: <20170717173905.8209-11-lorenzo.bianconi@st.com>

On Mon, 17 Jul 2017 19:39:05 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:

> 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>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks

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 c3de6e494f8c..51d021966222 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -60,7 +60,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 25fcb9993998..32524a8dc66f 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
> @@ -181,16 +177,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;


WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Lorenzo Bianconi
	<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	lorenzo.bianconi-qxv4g6HH51o@public.gmane.org
Subject: Re: [PATCH v2 10/10] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state()
Date: Tue, 25 Jul 2017 20:03:35 +0100	[thread overview]
Message-ID: <20170725200335.224f0c35@kernel.org> (raw)
In-Reply-To: <20170717173905.8209-11-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>

On Mon, 17 Jul 2017 19:39:05 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Move data-ready configuration in hts221_buffer.c since it is only related
> to trigger logic
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks

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 c3de6e494f8c..51d021966222 100644
> --- a/drivers/iio/humidity/hts221.h
> +++ b/drivers/iio/humidity/hts221.h
> @@ -60,7 +60,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 25fcb9993998..32524a8dc66f 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
> @@ -181,16 +177,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;

  reply	other threads:[~2017-07-25 19:03 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 17:38 [PATCH v2 00/10] hts221: add new features and fix power-off procedure Lorenzo Bianconi
2017-07-17 17:38 ` Lorenzo Bianconi
2017-07-17 17:38 ` [PATCH v2 01/10] iio: humidity: hts221: refactor write_with_mask code Lorenzo Bianconi
2017-07-17 17:38   ` Lorenzo Bianconi
2017-07-22 17:57   ` Jonathan Cameron
2017-07-22 17:57     ` Jonathan Cameron
2017-07-17 17:38 ` [PATCH v2 02/10] iio: humidity: hts221: move BDU configuration in probe routine Lorenzo Bianconi
2017-07-17 17:38   ` Lorenzo Bianconi
2017-07-22 17:58   ` Jonathan Cameron
2017-07-22 17:58     ` Jonathan Cameron
2017-07-17 17:38 ` [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down Lorenzo Bianconi
2017-07-17 17:38   ` Lorenzo Bianconi
2017-07-22 18:02   ` Jonathan Cameron
2017-07-22 18:02     ` Jonathan Cameron
2017-08-11 19:54     ` Lorenzo Bianconi
2017-08-12 11:07       ` Jonathan Cameron
2017-08-12 16:28         ` Lorenzo Bianconi
2017-07-17 17:38 ` [PATCH v2 04/10] iio: humidity: hts221: avoid useless ODR reconfiguration Lorenzo Bianconi
2017-07-17 17:38   ` Lorenzo Bianconi
2017-07-22 20:19   ` Jonathan Cameron
2017-07-22 20:19     ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 05/10] iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable Lorenzo Bianconi
2017-07-17 17:39   ` Lorenzo Bianconi
2017-07-22 20:21   ` Jonathan Cameron
2017-07-22 20:21     ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 06/10] iio: humidity: hts221: support active-low interrupts Lorenzo Bianconi
2017-07-17 17:39   ` Lorenzo Bianconi
2017-07-22 20:22   ` Jonathan Cameron
2017-07-22 20:22     ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 07/10] dt-bindings: " Lorenzo Bianconi
2017-07-17 17:39   ` Lorenzo Bianconi
2017-07-22 20:23   ` Jonathan Cameron
2017-07-22 20:23     ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 08/10] iio: humidity: hts221: support open drain mode Lorenzo Bianconi
2017-07-17 17:39   ` Lorenzo Bianconi
2017-07-22 20:25   ` Jonathan Cameron
2017-07-22 20:25     ` Jonathan Cameron
2017-07-25 19:01     ` Jonathan Cameron
2017-07-25 19:01       ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 09/10] dt-bindings: " Lorenzo Bianconi
2017-07-17 17:39   ` Lorenzo Bianconi
2017-07-24 17:48   ` Rob Herring
2017-07-24 17:48     ` Rob Herring
2017-07-25 19:02     ` Jonathan Cameron
2017-07-25 19:02       ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 10/10] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state() Lorenzo Bianconi
2017-07-17 17:39   ` Lorenzo Bianconi
2017-07-25 19:03   ` Jonathan Cameron [this message]
2017-07-25 19:03     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170725200335.224f0c35@kernel.org \
    --to=jic23@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=lorenzo.bianconi@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.