iio: accel: adxl372: Fix/remove limitation for FIFO samples
Subsystems (3)
PATCH v2 1/3 iio: accel: adxl372: Fix/remove limitation for FIFO samples
Currently, the driver sets the FIFO_SAMPLES register with the number of sample sets (maximum of 170 for 3 axis data, 256 for 2-axis and 512 for single axis). However, the FIFO_SAMPLES register should store the number of samples, regardless of how the FIFO format is configured.
---
Changes in v2:
- st->watermark needs to store the number of sample sets, the total number of samples is computed in adxl372_configure_fifo() func.
drivers/iio/accel/adxl372.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/iio/accel/adxl372.c +8 -3
@@ -474,12 +474,17 @@ static int adxl372_configure_fifo(struct adxl372_state *st)if (ret <0 )return ret; - fifo_samples = st->watermark &0xFF ; +/* +* watermak stores the number of sets; we need to write the FIFO +* registers with the number of samples +*/ + fifo_samples = (st->watermark * st->fifo_set_size); fifo_ctl =ADXL372_FIFO_CTL_FORMAT_MODE (st->fifo_format) |ADXL372_FIFO_CTL_MODE_MODE (st->fifo_mode) | -ADXL372_FIFO_CTL_SAMPLES_MODE (st->watermark); +ADXL372_FIFO_CTL_SAMPLES_MODE (fifo_samples); - ret =regmap_write (st->regmap,ADXL372_FIFO_SAMPLES , fifo_samples); + ret =regmap_write (st->regmap, +ADXL372_FIFO_SAMPLES , fifo_samples &0xFF );if (ret <0 )return ret;
Signature · 1 line
2.7.4
Quoted 6 lines · On Tue, 10 Sep 2019 17:43:32 +0300 Stefan Popa <[email protected]> wrote:
Currently, the driver sets the
FIFO_SAMPLESregister with the number of sample sets (maximum of 170 for 3 axis data, 256 for 2-axis and 512 for single axis). However, theFIFO_SAMPLESregister should store the number of samples, regardless of how the FIFO format is configured.Signed-off-by Stefan Popa <[email protected]>
Fixes tags? I think it's
Check I got that right though.
One trivial inline that I have tidied up whilst applying.
Applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
Quoted 14 lines
---
Changes in v2:
-st->watermarkneeds to store the number of sample sets, the total number of samples is computed inadxl372_configure_fifo()func.drivers/iio/accel/adxl372.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/iio/accel/adxl372.c +0
-0
drivers/iio/accel/adxl372.c static int adxl372_configure_fifo(struct adxl372_state *st) · line 478
Quoted 6 lines
drivers/iio/accel/adxl372.c +2
-1@@ -474,12 +474,17 @@ static int adxl372_configure_fifo(struct adxl372_state *st)if (ret <0 )return ret; - fifo_samples = st->watermark &0xFF ; +/* +* watermak stores the number of sets; we need to write the FIFO
watermark
Quoted 14 lines
drivers/iio/accel/adxl372.c +6
-2+* registers with the number of samples +*/ + fifo_samples = (st->watermark * st->fifo_set_size); fifo_ctl =ADXL372_FIFO_CTL_FORMAT_MODE (st->fifo_format) |ADXL372_FIFO_CTL_MODE_MODE (st->fifo_mode) | -ADXL372_FIFO_CTL_SAMPLES_MODE (st->watermark); +ADXL372_FIFO_CTL_SAMPLES_MODE (fifo_samples); - ret =regmap_write (st->regmap,ADXL372_FIFO_SAMPLES , fifo_samples); + ret =regmap_write (st->regmap, +ADXL372_FIFO_SAMPLES , fifo_samples &0xFF );if (ret <0 )return ret;
Quoted 10 lines · Jonathan Cameron
Quoted 4 lines · On Tue, 10 Sep 2019 17:43:32 +0300 Stefan Popa <[email protected]> wrote:
Quoted 7 lines
Quoted 7 lines
Currently, the driver sets the
FIFO_SAMPLESregister with the number of sample sets (maximum of 170 for 3 axis data, 256 for 2-axis and 512 for single axis). However, theFIFO_SAMPLESregister should store the number
of samples, regardless of how the FIFO format is configured.Signed-off-by Stefan Popa <[email protected]>
Hi Jonathan,
Quoted 7 lines
Fixes tags? I think it's
Fixes f4f55ce38e5f ("iio:adxl372: Add FIFO and interrupts support")Check I got that right though.
Yes, that's right! Thank you!
-Stefan
Quoted 60 lines
One trivial inline that I have tidied up whilst applying.
Applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
Quoted 25 lines
---
Changes in v2:
-st->watermarkneeds to store the number of sample sets, the total number of samples is computed inadxl372_configure_fifo()func.drivers/iio/accel/adxl372.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)drivers/iio/accel/adxl372.c +0
-0@@ -474,12 +474,17 @@ static int adxl372_configure_fifo(struct adxl372_state *st) if (ret < 0) return ret;drivers/iio/accel/adxl372.c +2
-1- fifo_samples = st->watermark &0xFF ; +/* +* watermak stores the number of sets; we need to write the Quoted 1 line
FIFO
watermark
Quoted 19 lines
drivers/iio/accel/adxl372.c +3
-0+* registers with the number of samples +*/ + fifo_samples = (st->watermark * st->fifo_set_size);
fifo_ctl=ADXL372_FIFO_CTL_FORMAT_MODE(st->fifo_format)|ADXL372_FIFO_CTL_MODE_MODE(st->fifo_mode)|drivers/iio/accel/adxl372.c +1
-1- ADXL372_FIFO_CTL_SAMPLES_MODE(st->watermark); + ADXL372_FIFO_CTL_SAMPLES_MODE(fifo_samples);drivers/iio/accel/adxl372.c +0
-1- ret = regmap_write(st->regmap, ADXL372_FIFO_SAMPLES,
fifo_samples);drivers/iio/accel/adxl372.c +2
-0+ ret =regmap_write (st->regmap, + ADXL372_FIFO_SAMPLES, fifo_samples & 0xFF);if (ret < 0)
return ret;