[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250525132652.0167f617@jic23-huawei>
Date: Sun, 25 May 2025 13:26:52 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org,
corbet@....net, lucas.p.stankus@...il.com, lars@...afoo.de,
Michael.Hennerich@...log.com, linux-iio@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 05/12] iio: accel: adxl313: add function to enable
measurement
On Fri, 23 May 2025 22:35:16 +0000
Lothar Rubusch <l.rubusch@...il.com> wrote:
> Add a function to enable measurement. The data-sheet recomments turning of
> measurement while modifying certain config registers. This is a preparatory
> step.
>
> Signed-off-by: Lothar Rubusch <l.rubusch@...il.com>
> ---
> drivers/iio/accel/adxl313.h | 3 +--
> drivers/iio/accel/adxl313_core.c | 10 +++++++---
> 2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/accel/adxl313.h b/drivers/iio/accel/adxl313.h
> index fc937bdf83b6..9bf2facdbf87 100644
> --- a/drivers/iio/accel/adxl313.h
> +++ b/drivers/iio/accel/adxl313.h
> @@ -36,8 +36,7 @@
> #define ADXL313_RATE_MSK GENMASK(3, 0)
> #define ADXL313_RATE_BASE 6
>
> -#define ADXL313_POWER_CTL_MSK GENMASK(3, 2)
> -#define ADXL313_MEASUREMENT_MODE BIT(3)
> +#define ADXL313_POWER_CTL_MSK BIT(3)
>
> #define ADXL313_RANGE_MSK GENMASK(1, 0)
> #define ADXL313_RANGE_MAX 3
> diff --git a/drivers/iio/accel/adxl313_core.c b/drivers/iio/accel/adxl313_core.c
> index 0c893c286017..6170c9daa30f 100644
> --- a/drivers/iio/accel/adxl313_core.c
> +++ b/drivers/iio/accel/adxl313_core.c
> @@ -63,6 +63,12 @@ bool adxl313_is_volatile_reg(struct device *dev, unsigned int reg)
> }
> EXPORT_SYMBOL_NS_GPL(adxl313_is_volatile_reg, "IIO_ADXL313");
>
> +static int adxl313_set_measure_en(struct adxl313_data *data, bool en)
> +{
> + return regmap_assign_bits(data->regmap, ADXL313_REG_POWER_CTL,
> + ADXL313_POWER_CTL_MSK, en);
> +}
> +
> static int adxl312_check_id(struct device *dev,
> struct adxl313_data *data)
> {
> @@ -410,9 +416,7 @@ static int adxl313_setup(struct device *dev, struct adxl313_data *data,
> }
>
> /* Enables measurement mode */
> - return regmap_update_bits(data->regmap, ADXL313_REG_POWER_CTL,
> - ADXL313_POWER_CTL_MSK,
> - ADXL313_MEASUREMENT_MODE);
> + return adxl313_set_measure_en(data, true);
The original code is also clearing the sleep bit.
I'd expect the patch description to have stated why no longer doing that
is fine. I guess no one ever sets it?
> }
>
> /**
Powered by blists - more mailing lists