diff mbox series

[v8,1/7] iio: accel: adxl345: add function to switch measuring mode

Message ID 20241225181338.69672-2-l.rubusch@gmail.com (mailing list archive)
State Accepted
Headers show
Series iio: accel: adxl345: add FIFO operating with IRQ triggered watermark events | expand

Commit Message

Lothar Rubusch Dec. 25, 2024, 6:13 p.m. UTC
Replace the powerup / powerdown functions by a generic function to put
the sensor in STANDBY, or MEASURE mode. When configuring the FIFO for
several features of the accelerometer, it is recommended to put
measuring in STANDBY mode.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
---
Please squash with a3fb9f5202c3de0ca84848a475f59a0e0584d9fc

Just introduces a cosmetic simplification to the already applied
commit, under the same title.

 drivers/iio/accel/adxl345_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jonathan Cameron Dec. 28, 2024, 2:29 p.m. UTC | #1
On Wed, 25 Dec 2024 18:13:32 +0000
Lothar Rubusch <l.rubusch@gmail.com> wrote:

> Replace the powerup / powerdown functions by a generic function to put
> the sensor in STANDBY, or MEASURE mode. When configuring the FIFO for
> several features of the accelerometer, it is recommended to put
> measuring in STANDBY mode.
> 
> Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
> ---
> Please squash with a3fb9f5202c3de0ca84848a475f59a0e0584d9fc
Even when just sending something you'd like squashed please give
meaningful title etc because it might not get squashed and so may need
to stand on it's own.

Anyhow, I have squashed it so no problem this time.

Jonathan

> 
> Just introduces a cosmetic simplification to the already applied
> commit, under the same title.
> 
>  drivers/iio/accel/adxl345_core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c
> index b48bc838c..27d70a1f0 100644
> --- a/drivers/iio/accel/adxl345_core.c
> +++ b/drivers/iio/accel/adxl345_core.c
> @@ -153,9 +153,8 @@ static int adxl345_write_raw_get_fmt(struct iio_dev *indio_dev,
>   */
>  static int adxl345_set_measure_en(struct adxl345_state *st, bool en)
>  {
> -	unsigned int val = 0;
> +	unsigned int val = en ? ADXL345_POWER_CTL_MEASURE : ADXL345_POWER_CTL_STANDBY;
>  
> -	val = (en) ? ADXL345_POWER_CTL_MEASURE : ADXL345_POWER_CTL_STANDBY;
>  	return regmap_write(st->regmap, ADXL345_REG_POWER_CTL, val);
>  }
>
diff mbox series

Patch

diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c
index b48bc838c..27d70a1f0 100644
--- a/drivers/iio/accel/adxl345_core.c
+++ b/drivers/iio/accel/adxl345_core.c
@@ -153,9 +153,8 @@  static int adxl345_write_raw_get_fmt(struct iio_dev *indio_dev,
  */
 static int adxl345_set_measure_en(struct adxl345_state *st, bool en)
 {
-	unsigned int val = 0;
+	unsigned int val = en ? ADXL345_POWER_CTL_MEASURE : ADXL345_POWER_CTL_STANDBY;
 
-	val = (en) ? ADXL345_POWER_CTL_MEASURE : ADXL345_POWER_CTL_STANDBY;
 	return regmap_write(st->regmap, ADXL345_REG_POWER_CTL, val);
 }