[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251109165055.404d0417@jic23-huawei>
Date: Sun, 9 Nov 2025 16:50:55 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Jonathan Santos <Jonathan.Santos@...log.com>
Cc: <linux-iio@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <Michael.Hennerich@...log.com>,
<ramona.gradinariu@...log.com>, <antoniu.miclaus@...log.com>,
<dlechner@...libre.com>, <nuno.sa@...log.com>, <andy@...nel.org>,
<robh@...nel.org>, <krzk+dt@...nel.org>, <conor+dt@...nel.org>
Subject: Re: [PATCH 2/2] iio: accel: adxl380: add support for ADXL318 and
ADXL319
On Wed, 5 Nov 2025 09:40:34 -0300
Jonathan Santos <Jonathan.Santos@...log.com> wrote:
> The ADXL318 and ADXL319 are low noise density, low power, 3-axis
> accelerometers based on ADXL380 and ADXL382, respectively. The main
> difference between the new parts and the existing ones are the absence
> of interrupts and events like tap detection, activity/inactivity, and
> free-fall detection.
>
> Other differences in the new parts are fewer power modes, basically
> allowing only idle and measurement modes, and the removal of the 12-bit
> SAR ADC path for the 3-axis signals (known as lower signal chain),
> being excluisive for the temperature sensor in the ADXL318/319.
>
> Signed-off-by: Jonathan Santos <Jonathan.Santos@...log.com>
Only comments are about numeric order, similar to the comments on
the dt-binding.
Thanks,
Jonathan
> ---
> drivers/iio/accel/adxl380.c | 134 ++++++++++++++++++++++----------
> drivers/iio/accel/adxl380.h | 4 +
> drivers/iio/accel/adxl380_i2c.c | 4 +
> drivers/iio/accel/adxl380_spi.c | 4 +
> 4 files changed, 107 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/iio/accel/adxl380.c b/drivers/iio/accel/adxl380.c
> index 0cf3c6815829..7733a0902afa 100644
> --- a/drivers/iio/accel/adxl380.c
> +++ b/drivers/iio/accel/adxl380.c
> @@ -27,6 +27,8 @@
>
> #define ADXL380_ID_VAL 380
> #define ADXL382_ID_VAL 382
> +#define ADXL318_ID_VAL 380
> +#define ADXL319_ID_VAL 382
Similar to the binding. Sort these by number.
>
> #define ADXL380_DEVID_AD_REG 0x00
> #define ADLX380_PART_ID_REG 0x02
> @@ -178,41 +180,6 @@ enum adxl380_tap_time_type {
> +
> +const struct adxl380_chip_info adxl382_chip_info = {
> + .name = "adxl382",
> + .chip_id = ADXL382_ID_VAL,
> + .scale_tbl = {
> + [ADXL382_OP_MODE_15G_RANGE] = { 0, 4903325 },
> + [ADXL382_OP_MODE_30G_RANGE] = { 0, 9806650 },
> + [ADXL382_OP_MODE_60G_RANGE] = { 0, 19613300 },
> + },
> + .samp_freq_tbl = { 16000, 32000, 64000 },
> + /*
> + * The datasheet defines an intercept of 570 LSB at 25 degC
> + * and a sensitivity of 10.2 LSB/C.
> + */
> + .temp_offset = 25 * 102 / 10 - 570,
> + .has_low_power = true,
> + .info = &adxl380_info,
> +};
> +EXPORT_SYMBOL_NS_GPL(adxl382_chip_info, "IIO_ADXL380");
> +
> +const struct adxl380_chip_info adxl318_chip_info = {
> + .name = "adxl318",
> + .chip_id = ADXL318_ID_VAL,
> + .scale_tbl = {
> + [ADXL380_OP_MODE_4G_RANGE] = { 0, 1307226 },
> + [ADXL380_OP_MODE_8G_RANGE] = { 0, 2615434 },
> + [ADXL380_OP_MODE_16G_RANGE] = { 0, 5229886 },
> + },
> + .samp_freq_tbl = { 8000, 16000, 32000 },
> + /*
> + * The datasheet defines an intercept of 550 LSB at 25 degC
> + * and a sensitivity of 10.2 LSB/C.
> + */
> + .temp_offset = 25 * 102 / 10 - 550,
> + .info = &adxl318_info,
> +};
> +EXPORT_SYMBOL_NS_GPL(adxl318_chip_info, "IIO_ADXL380");
> +
> +const struct adxl380_chip_info adxl319_chip_info = {
Numeric order preferred for these structures as well.
There might have been some argument for grouping by ID but that
doesn't seem to be the case either here.
> + .name = "adxl319",
> + .chip_id = ADXL319_ID_VAL,
> + .scale_tbl = {
> + [ADXL382_OP_MODE_15G_RANGE] = { 0, 4903325 },
> + [ADXL382_OP_MODE_30G_RANGE] = { 0, 9806650 },
> + [ADXL382_OP_MODE_60G_RANGE] = { 0, 19613300 },
> + },
> + .samp_freq_tbl = { 16000, 32000, 64000 },
> + /*
> + * The datasheet defines an intercept of 550 LSB at 25 degC
> + * and a sensitivity of 10.2 LSB/C.
> + */
> + .temp_offset = 25 * 102 / 10 - 550,
> + .info = &adxl318_info,
> +};
> +EXPORT_SYMBOL_NS_GPL(adxl319_chip_info, "IIO_ADXL380");
> diff --git a/drivers/iio/accel/adxl380.h b/drivers/iio/accel/adxl380.h
> index a683625d897a..5d88c111d616 100644
> --- a/drivers/iio/accel/adxl380.h
> +++ b/drivers/iio/accel/adxl380.h
>
> extern const struct adxl380_chip_info adxl380_chip_info;
> extern const struct adxl380_chip_info adxl382_chip_info;
> +extern const struct adxl380_chip_info adxl318_chip_info;
> +extern const struct adxl380_chip_info adxl319_chip_info;
Sort numerically.
Powered by blists - more mailing lists