Skip to contentSkip to conversation

iio: accel: fxls8962af: fixup buffer scan element type

PATCH Applied Sean Nyekjaer 2 participants 4 messages Jun 5, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 iio: accel: fxls8962af: fixup buffer scan element type

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")
---
 drivers/iio/accel/fxls8962af-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/fxls8962af-core.c +2 -2
index 0d672b1469e8..bf7949e51e6c 100644
@@ -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), \
Signature · 1 line
2.40.0
#1 lore raw

PATCH 2/2 iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF

Remove special errata handling if FXLS8964AF is used.

Fixes af959b7b96b8 ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")
---
 drivers/iio/accel/fxls8962af-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/accel/fxls8962af-core.c +3 -2
index bf7949e51e6c..3f27834ef04c 100644
@@ -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..
 		 */
Signature · 1 line
2.40.0
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF

Quoted 5 lines · On Mon, 5 Jun 2023 12:32:22 +0200 Sean Nyekjaer <[email protected]> wrote:

Remove special errata handling if FXLS8964AF is used.

Fixes af959b7b96b8 ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")

Applied to the fixes-togreg branch of iio.git

Thanks,

Jonathan

Quoted 21 lines
---
 drivers/iio/accel/fxls8962af-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/accel/fxls8962af-core.c +3 -2
index bf7949e51e6c..3f27834ef04c 100644
@@ -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..
 		 */
maintainer Applied
#3 lore raw
In reply to Sean Nyekjaer
Quoted 7 lines · On Mon, 5 Jun 2023 12:32:21 +0200 Sean Nyekjaer <[email protected]> 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")

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

Quoted 9 lines
---
 drivers/iio/accel/fxls8962af-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/fxls8962af-core.c +0 -0
index 0d672b1469e8..bf7949e51e6c 100644

drivers/iio/accel/fxls8962af-core.c static const struct iio_event_spec fxls8962af_event[] = { · line 727

Quoted 6 lines
drivers/iio/accel/fxls8962af-core.c +1 -2
@@ -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

Quoted 4 lines
drivers/iio/accel/fxls8962af-core.c +1 -0
+		.endianness = IIO_LE, \
 	}, \
 	.event_spec = fxls8962af_event, \
 	.num_event_specs = ARRAY_SIZE(fxls8962af_event), \