Linux IIO development
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: accel: fxls8962af: fixup buffer scan element type
@ 2023-06-05 10:32 Sean Nyekjaer
  2023-06-05 10:32 ` [PATCH 2/2] iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF Sean Nyekjaer
  2023-06-05 19:04 ` [PATCH 1/2] iio: accel: fxls8962af: fixup buffer scan element type Jonathan Cameron
  0 siblings, 2 replies; 4+ messages in thread
From: Sean Nyekjaer @ 2023-06-05 10:32 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Sean Nyekjaer,
	Andy Shevchenko
  Cc: stable, Jonathan Cameron, linux-iio, linux-kernel

Scan elements for x,y,z channels is little endian and requires no bit shifts.
LE vs. BE is controlled in register SENS_CONFIG2 and bit LE_BE, default
value is LE.

Fixes: a3e0b51884ee ("iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers")
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Cc: stable@vger.kernel.org
---
 drivers/iio/accel/fxls8962af-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
index 0d672b1469e8..bf7949e51e6c 100644
--- a/drivers/iio/accel/fxls8962af-core.c
+++ b/drivers/iio/accel/fxls8962af-core.c
@@ -724,8 +724,8 @@ static const struct iio_event_spec fxls8962af_event[] = {
 		.sign = 's', \
 		.realbits = 12, \
 		.storagebits = 16, \
-		.shift = 4, \
-		.endianness = IIO_BE, \
+		.shift = 0, \
+		.endianness = IIO_LE, \
 	}, \
 	.event_spec = fxls8962af_event, \
 	.num_event_specs = ARRAY_SIZE(fxls8962af_event), \
-- 
2.40.0


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

* [PATCH 2/2] iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF
  2023-06-05 10:32 [PATCH 1/2] iio: accel: fxls8962af: fixup buffer scan element type Sean Nyekjaer
@ 2023-06-05 10:32 ` Sean Nyekjaer
  2023-06-05 19:06   ` Jonathan Cameron
  2023-06-05 19:04 ` [PATCH 1/2] iio: accel: fxls8962af: fixup buffer scan element type Jonathan Cameron
  1 sibling, 1 reply; 4+ messages in thread
From: Sean Nyekjaer @ 2023-06-05 10:32 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Sean Nyekjaer
  Cc: stable, Jonathan Cameron, linux-iio, linux-kernel

Remove special errata handling if FXLS8964AF is used.

Fixes: af959b7b96b8 ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Cc: stable@vger.kernel.org
---
 drivers/iio/accel/fxls8962af-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
index bf7949e51e6c..3f27834ef04c 100644
--- a/drivers/iio/accel/fxls8962af-core.c
+++ b/drivers/iio/accel/fxls8962af-core.c
@@ -904,9 +904,10 @@ static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 	int total_length = samples * sample_length;
 	int ret;
 
-	if (i2c_verify_client(dev))
+	if (i2c_verify_client(dev) &&
+	    data->chip_info->chip_id == FXLS8962AF_DEVICE_ID)
 		/*
-		 * Due to errata bug:
+		 * Due to errata bug (only applicable on fxls8962af):
 		 * E3: FIFO burst read operation error using I2C interface
 		 * We have to avoid burst reads on I2C..
 		 */
-- 
2.40.0


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

* Re: [PATCH 1/2] iio: accel: fxls8962af: fixup buffer scan element type
  2023-06-05 10:32 [PATCH 1/2] iio: accel: fxls8962af: fixup buffer scan element type Sean Nyekjaer
  2023-06-05 10:32 ` [PATCH 2/2] iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF Sean Nyekjaer
@ 2023-06-05 19:04 ` Jonathan Cameron
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2023-06-05 19:04 UTC (permalink / raw)
  To: Sean Nyekjaer
  Cc: Lars-Peter Clausen, Andy Shevchenko, stable, Jonathan Cameron,
	linux-iio, linux-kernel

On Mon,  5 Jun 2023 12:32:21 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> Scan elements for x,y,z channels is little endian and requires no bit shifts.
> LE vs. BE is controlled in register SENS_CONFIG2 and bit LE_BE, default
> value is LE.
> 
> Fixes: a3e0b51884ee ("iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers")
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> Cc: stable@vger.kernel.org

Hmm. I'm not going to ask how this didn't come up in testing before now...

> ---
>  drivers/iio/accel/fxls8962af-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
> index 0d672b1469e8..bf7949e51e6c 100644
> --- a/drivers/iio/accel/fxls8962af-core.c
> +++ b/drivers/iio/accel/fxls8962af-core.c
> @@ -724,8 +724,8 @@ static const struct iio_event_spec fxls8962af_event[] = {
>  		.sign = 's', \
>  		.realbits = 12, \
>  		.storagebits = 16, \
> -		.shift = 4, \
> -		.endianness = IIO_BE, \
> +		.shift = 0, \

We'd normally not explicitly specify shift = 0 as that's both the obvious default and
what C will give us for free.

I'll tidy that up whilst applying.

Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> +		.endianness = IIO_LE, \
>  	}, \
>  	.event_spec = fxls8962af_event, \
>  	.num_event_specs = ARRAY_SIZE(fxls8962af_event), \


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

* Re: [PATCH 2/2] iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF
  2023-06-05 10:32 ` [PATCH 2/2] iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF Sean Nyekjaer
@ 2023-06-05 19:06   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2023-06-05 19:06 UTC (permalink / raw)
  To: Sean Nyekjaer
  Cc: Lars-Peter Clausen, stable, Jonathan Cameron, linux-iio,
	linux-kernel

On Mon,  5 Jun 2023 12:32:22 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> Remove special errata handling if FXLS8964AF is used.
> 
> Fixes: af959b7b96b8 ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> Cc: stable@vger.kernel.org

Applied to the fixes-togreg branch of iio.git

Thanks,

Jonathan

> ---
>  drivers/iio/accel/fxls8962af-core.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
> index bf7949e51e6c..3f27834ef04c 100644
> --- a/drivers/iio/accel/fxls8962af-core.c
> +++ b/drivers/iio/accel/fxls8962af-core.c
> @@ -904,9 +904,10 @@ static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
>  	int total_length = samples * sample_length;
>  	int ret;
>  
> -	if (i2c_verify_client(dev))
> +	if (i2c_verify_client(dev) &&
> +	    data->chip_info->chip_id == FXLS8962AF_DEVICE_ID)
>  		/*
> -		 * Due to errata bug:
> +		 * Due to errata bug (only applicable on fxls8962af):
>  		 * E3: FIFO burst read operation error using I2C interface
>  		 * We have to avoid burst reads on I2C..
>  		 */


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

end of thread, other threads:[~2023-06-05 19:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-05 10:32 [PATCH 1/2] iio: accel: fxls8962af: fixup buffer scan element type Sean Nyekjaer
2023-06-05 10:32 ` [PATCH 2/2] iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF Sean Nyekjaer
2023-06-05 19:06   ` Jonathan Cameron
2023-06-05 19:04 ` [PATCH 1/2] iio: accel: fxls8962af: fixup buffer scan element type Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox