All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration
@ 2018-08-30 20:38 ` Lorenzo Bianconi
  2018-08-31  8:44   ` Lorenzo Bianconi
  2018-09-02 20:19   ` Jonathan Cameron
  0 siblings, 2 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2018-08-30 20:38 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio

Take into account hw timer samples in pattern length computation used
in st_lsm6dsx_update_watermark routine for watermark configuration

Fixes: 213451076bd3 ("iio: imu: st_lsm6dsx: add hw timestamp support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index 7589f2ad1dae..2b49d928f4c0 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -187,9 +187,10 @@ static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor,
 
 int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark)
 {
-	u16 fifo_watermark = ~0, cur_watermark, sip = 0, fifo_th_mask;
+	u16 fifo_watermark = ~0, cur_watermark, fifo_th_mask;
 	struct st_lsm6dsx_hw *hw = sensor->hw;
 	struct st_lsm6dsx_sensor *cur_sensor;
+	u16 sip = hw->ts_sip;
 	int i, err, data;
 	__le16 wdata;
 
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration
  2018-08-30 20:38 ` [PATCH] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration Lorenzo Bianconi
@ 2018-08-31  8:44   ` Lorenzo Bianconi
  2018-09-02 20:19   ` Jonathan Cameron
  1 sibling, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2018-08-31  8:44 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio

> Take into account hw timer samples in pattern length computation used
> in st_lsm6dsx_update_watermark routine for watermark configuration
> 
> Fixes: 213451076bd3 ("iio: imu: st_lsm6dsx: add hw timestamp support")
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> index 7589f2ad1dae..2b49d928f4c0 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> @@ -187,9 +187,10 @@ static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor,
>  
>  int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark)
>  {
> -	u16 fifo_watermark = ~0, cur_watermark, sip = 0, fifo_th_mask;
> +	u16 fifo_watermark = ~0, cur_watermark, fifo_th_mask;
>  	struct st_lsm6dsx_hw *hw = sensor->hw;
>  	struct st_lsm6dsx_sensor *cur_sensor;
> +	u16 sip = hw->ts_sip;
>  	int i, err, data;
>  	__le16 wdata;
>  
> -- 
> 2.18.0
> 

Hi Jonathan,

please drop this patch, I am sending a v2 for this issue.

Regards,
Lorenzo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration
       [not found] <cover.1535705166.git.lorenzo.bianconi@redhat.com>
  2018-08-30 20:38 ` [PATCH] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration Lorenzo Bianconi
@ 2018-08-31  8:51 ` Lorenzo Bianconi
  1 sibling, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2018-08-31  8:51 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio

Take into account hw timer samples in pattern length computation done
in st_lsm6dsx_update_watermark routine for watermark configuration.
Moreover use samples in pattern (sip) already computed in
st_lsm6dsx_update_decimators routine

Fixes: 213451076bd3 ("iio: imu: st_lsm6dsx: add hw timestamp support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
Changes since v1:
- use samples in pattern already computed in st_lsm6dsx_update_decimators
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index 7589f2ad1dae..631360b14ca7 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -187,12 +187,15 @@ static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor,
 
 int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark)
 {
-	u16 fifo_watermark = ~0, cur_watermark, sip = 0, fifo_th_mask;
+	u16 fifo_watermark = ~0, cur_watermark, fifo_th_mask;
 	struct st_lsm6dsx_hw *hw = sensor->hw;
 	struct st_lsm6dsx_sensor *cur_sensor;
 	int i, err, data;
 	__le16 wdata;
 
+	if (!hw->sip)
+		return 0;
+
 	for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) {
 		cur_sensor = iio_priv(hw->iio_devs[i]);
 
@@ -203,14 +206,10 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark)
 						       : cur_sensor->watermark;
 
 		fifo_watermark = min_t(u16, fifo_watermark, cur_watermark);
-		sip += cur_sensor->sip;
 	}
 
-	if (!sip)
-		return 0;
-
-	fifo_watermark = max_t(u16, fifo_watermark, sip);
-	fifo_watermark = (fifo_watermark / sip) * sip;
+	fifo_watermark = max_t(u16, fifo_watermark, hw->sip);
+	fifo_watermark = (fifo_watermark / hw->sip) * hw->sip;
 	fifo_watermark = fifo_watermark * hw->settings->fifo_ops.th_wl;
 
 	err = regmap_read(hw->regmap, hw->settings->fifo_ops.fifo_th.addr + 1,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration
  2018-08-30 20:38 ` [PATCH] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration Lorenzo Bianconi
  2018-08-31  8:44   ` Lorenzo Bianconi
@ 2018-09-02 20:19   ` Jonathan Cameron
  2018-09-03  8:48     ` Jonathan Cameron
  1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2018-09-02 20:19 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: linux-iio

On Thu, 30 Aug 2018 22:38:59 +0200
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:

> Take into account hw timer samples in pattern length computation used
> in st_lsm6dsx_update_watermark routine for watermark configuration
> 
> Fixes: 213451076bd3 ("iio: imu: st_lsm6dsx: add hw timestamp support")
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> index 7589f2ad1dae..2b49d928f4c0 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> @@ -187,9 +187,10 @@ static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor,
>  
>  int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark)
>  {
> -	u16 fifo_watermark = ~0, cur_watermark, sip = 0, fifo_th_mask;
> +	u16 fifo_watermark = ~0, cur_watermark, fifo_th_mask;
>  	struct st_lsm6dsx_hw *hw = sensor->hw;
>  	struct st_lsm6dsx_sensor *cur_sensor;
> +	u16 sip = hw->ts_sip;
>  	int i, err, data;
>  	__le16 wdata;
>  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration
  2018-09-02 20:19   ` Jonathan Cameron
@ 2018-09-03  8:48     ` Jonathan Cameron
  2018-09-03 11:51       ` Lorenzo Bianconi
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2018-09-03  8:48 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Lorenzo Bianconi, linux-iio

On Sun, 2 Sep 2018 21:19:42 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Thu, 30 Aug 2018 22:38:59 +0200
> Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:
> 
> > Take into account hw timer samples in pattern length computation used
> > in st_lsm6dsx_update_watermark routine for watermark configuration
> > 
> > Fixes: 213451076bd3 ("iio: imu: st_lsm6dsx: add hw timestamp support")
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>  
> Applied to the fixes-togreg branch of iio.git and marked for stable.
> 
Oops. I actually applied V2 and replied to the wrong email.

> Thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> > index 7589f2ad1dae..2b49d928f4c0 100644
> > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> > @@ -187,9 +187,10 @@ static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor,
> >  
> >  int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark)
> >  {
> > -	u16 fifo_watermark = ~0, cur_watermark, sip = 0, fifo_th_mask;
> > +	u16 fifo_watermark = ~0, cur_watermark, fifo_th_mask;
> >  	struct st_lsm6dsx_hw *hw = sensor->hw;
> >  	struct st_lsm6dsx_sensor *cur_sensor;
> > +	u16 sip = hw->ts_sip;
> >  	int i, err, data;
> >  	__le16 wdata;
> >    
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration
  2018-09-03  8:48     ` Jonathan Cameron
@ 2018-09-03 11:51       ` Lorenzo Bianconi
  0 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2018-09-03 11:51 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Jonathan Cameron, linux-iio

> On Sun, 2 Sep 2018 21:19:42 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > On Thu, 30 Aug 2018 22:38:59 +0200
> > Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:
> > 
> > > Take into account hw timer samples in pattern length computation used
> > > in st_lsm6dsx_update_watermark routine for watermark configuration
> > > 
> > > Fixes: 213451076bd3 ("iio: imu: st_lsm6dsx: add hw timestamp support")
> > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>  
> > Applied to the fixes-togreg branch of iio.git and marked for stable.
> > 
> Oops. I actually applied V2 and replied to the wrong email.
> 

No worries, I had already double-checked :)

Regards,
Lorenzo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-09-03 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1535705166.git.lorenzo.bianconi@redhat.com>
2018-08-30 20:38 ` [PATCH] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration Lorenzo Bianconi
2018-08-31  8:44   ` Lorenzo Bianconi
2018-09-02 20:19   ` Jonathan Cameron
2018-09-03  8:48     ` Jonathan Cameron
2018-09-03 11:51       ` Lorenzo Bianconi
2018-08-31  8:51 ` [PATCH v2] " Lorenzo Bianconi

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.