[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240602122733.5935da67@jic23-huawei>
Date: Sun, 2 Jun 2024 12:27:33 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Gustavo Silva <gustavograzs@...il.com>
Cc: robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
lars@...afoo.de, christophe.jaillet@...adoo.fr, devicetree@...r.kernel.org,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/6] iio: chemical: ens160: add triggered buffer
support
On Tue, 28 May 2024 21:14:21 -0300
Gustavo Silva <gustavograzs@...il.com> wrote:
> ENS160 supports a data ready interrupt. Use it in combination with
> triggered buffer for continuous data readings.
>
> Signed-off-by: Gustavo Silva <gustavograzs@...il.com>
A couple of really minor comments inline.
Thanks,
Jonathan
> #endif
> diff --git a/drivers/iio/chemical/ens160_core.c b/drivers/iio/chemical/ens160_core.c
> index a535f62c4..74ef7f150 100644
> --- a/drivers/iio/chemical/ens160_core.c
> +++ b/drivers/iio/chemical/ens160_core.c
> @@ -10,6 +10,9 @@
>
> #include <linux/bitfield.h>
> #include <linux/iio/iio.h>
> +#include <linux/iio/trigger.h>
> +#include <linux/iio/trigger_consumer.h>
> +#include <linux/iio/triggered_buffer.h>
> #include <linux/module.h>
> #include <linux/regmap.h>
>
> @@ -19,9 +22,14 @@
>
> #define ENS160_BOOTING_TIME_MS 10U
>
> -#define ENS160_REG_PART_ID 0x00
move this in earlier patch so no need to realign here.
> +#define ENS160_REG_PART_ID 0x00
>
> -#define ENS160_REG_OPMODE 0x10
> +#define ENS160_REG_OPMODE 0x10
> +
> +#define ENS160_REG_CONFIG 0x11
> +#define ENS160_REG_CONFIG_INTEN BIT(0)
> +#define ENS160_REG_CONFIG_INTDAT BIT(1)
> +#define ENS160_REG_CONFIG_INT_CFG BIT(5)
>
> #define ENS160_REG_MODE_DEEP_SLEEP 0x00
> #define ENS160_REG_MODE_IDLE 0x01
> @@ -48,7 +56,12 @@
>
> struct ens160_data {
> struct regmap *regmap;
> - u8 fw_version[3] __aligned(IIO_DMA_MINALIGN);
> + struct mutex mutex;
Mutex needs a comment to say what data it is protecting.
> + struct {
> + __le16 chans[2];
> + s64 timestamp __aligned(8);
> + } scan __aligned(IIO_DMA_MINALIGN);
> + u8 fw_version[3];
> __le16 buf;
> };
Powered by blists - more mailing lists