public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: iio: accel: adxl380: add new supported parts
@ 2025-11-05 12:40 Jonathan Santos
  2025-11-05 12:40 ` [PATCH 2/2] iio: accel: adxl380: add support for ADXL318 and ADXL319 Jonathan Santos
  2025-11-06  9:04 ` [PATCH 1/2] dt-bindings: iio: accel: adxl380: add new supported parts Krzysztof Kozlowski
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Santos @ 2025-11-05 12:40 UTC (permalink / raw)
  To: linux-iio, devicetree, linux-kernel
  Cc: Jonathan Santos, Michael.Hennerich, ramona.gradinariu,
	antoniu.miclaus, jic23, dlechner, nuno.sa, andy, robh, krzk+dt,
	conor+dt

Include ADXL318 and ADXL319 accelerometers to the documentation.
The ADXL318 is based on the ADXL380, while the ADXL319 is based on the
ADXL382. However, the ADXL318/319 do not support some built-in features
like single tap, double tap and triple tap detection, and also activity
and inactivity detection.

Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
---
 .../devicetree/bindings/iio/accel/adi,adxl380.yaml    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/accel/adi,adxl380.yaml b/Documentation/devicetree/bindings/iio/accel/adi,adxl380.yaml
index f1ff5ff4f478..f38f384dd818 100644
--- a/Documentation/devicetree/bindings/iio/accel/adi,adxl380.yaml
+++ b/Documentation/devicetree/bindings/iio/accel/adi,adxl380.yaml
@@ -11,18 +11,21 @@ maintainers:
   - Antoniu Miclaus <antoniu.miclaus@analog.com>
 
 description: |
-  The ADXL380/ADXL382 is a low noise density, low power, 3-axis
-  accelerometer with selectable measurement ranges. The ADXL380
-  supports the ±4 g, ±8 g, and ±16 g ranges, and the ADXL382 supports
-  ±15 g, ±30 g, and ±60 g ranges.
+  The ADXL380/ADXL382 and ADXL318/ADXL319 are low noise density,
+  low power, 3-axis accelerometers with selectable measurement ranges.
+  The ADXL380 and ADXL318 support the ±4 g, ±8 g, and ±16 g ranges,
+  while the ADXL382 and ADXL319 support ±15 g, ±30 g, and ±60 g ranges.
 
   https://www.analog.com/en/products/adxl380.html
+  https://www.analog.com/en/products/adxl318.html
 
 properties:
   compatible:
     enum:
       - adi,adxl380
       - adi,adxl382
+      - adi,adxl318
+      - adi,adxl319
 
   reg:
     maxItems: 1

base-commit: 70437bbd7529e9860fb7f0c92a89e0e6abaa994e
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] iio: accel: adxl380: add support for ADXL318 and ADXL319
  2025-11-05 12:40 [PATCH 1/2] dt-bindings: iio: accel: adxl380: add new supported parts Jonathan Santos
@ 2025-11-05 12:40 ` Jonathan Santos
  2025-11-05 15:11   ` Andy Shevchenko
  2025-11-09 16:50   ` Jonathan Cameron
  2025-11-06  9:04 ` [PATCH 1/2] dt-bindings: iio: accel: adxl380: add new supported parts Krzysztof Kozlowski
  1 sibling, 2 replies; 5+ messages in thread
From: Jonathan Santos @ 2025-11-05 12:40 UTC (permalink / raw)
  To: linux-iio, devicetree, linux-kernel
  Cc: Jonathan Santos, Michael.Hennerich, ramona.gradinariu,
	antoniu.miclaus, jic23, dlechner, nuno.sa, andy, robh, krzk+dt,
	conor+dt

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@analog.com>
---
 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
 
 #define ADXL380_DEVID_AD_REG			0x00
 #define ADLX380_PART_ID_REG			0x02
@@ -178,41 +180,6 @@ enum adxl380_tap_time_type {
 
 static const int adxl380_range_scale_factor_tbl[] = { 1, 2, 4 };
 
-const struct adxl380_chip_info adxl380_chip_info = {
-	.name = "adxl380",
-	.chip_id = ADXL380_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 470 LSB at 25 degC
-	 * and a sensitivity of 10.2 LSB/C.
-	 */
-	.temp_offset =  25 * 102 / 10 - 470,
-
-};
-EXPORT_SYMBOL_NS_GPL(adxl380_chip_info, "IIO_ADXL380");
-
-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,
-};
-EXPORT_SYMBOL_NS_GPL(adxl382_chip_info, "IIO_ADXL380");
-
 static const unsigned int adxl380_th_reg_high_addr[2] = {
 	[ADXL380_ACTIVITY] = ADXL380_THRESH_ACT_H_REG,
 	[ADXL380_INACTIVITY] = ADXL380_THRESH_INACT_H_REG,
@@ -276,9 +243,14 @@ static int adxl380_set_measure_en(struct adxl380_state *st, bool en)
 		if (ret)
 			return ret;
 
-		/* Activity/ Inactivity detection available only in VLP/ULP mode */
-		if (FIELD_GET(ADXL380_ACT_EN_MSK, act_inact_ctl) ||
-		    FIELD_GET(ADXL380_INACT_EN_MSK, act_inact_ctl))
+		/*
+		 * Activity/Inactivity detection available only in VLP/ULP
+		 * mode and for devices that support low power modes. Otherwise
+		 * go straight to measure mode (same bits as ADXL380_OP_MODE_HP).
+		 */
+		if (st->chip_info->has_low_power &&
+		    (FIELD_GET(ADXL380_ACT_EN_MSK, act_inact_ctl) ||
+		    FIELD_GET(ADXL380_INACT_EN_MSK, act_inact_ctl)))
 			op_mode = ADXL380_OP_MODE_VLP;
 		else
 			op_mode = ADXL380_OP_MODE_HP;
@@ -1632,6 +1604,90 @@ static const struct iio_info adxl380_info = {
 	.hwfifo_set_watermark = adxl380_set_watermark,
 };
 
+static const struct iio_info adxl318_info = {
+	.read_raw = adxl380_read_raw,
+	.read_avail = &adxl380_read_avail,
+	.write_raw = adxl380_write_raw,
+	.write_raw_get_fmt = adxl380_write_raw_get_fmt,
+	.debugfs_reg_access = &adxl380_reg_access,
+	.hwfifo_set_watermark = adxl380_set_watermark,
+};
+
+const struct adxl380_chip_info adxl380_chip_info = {
+	.name = "adxl380",
+	.chip_id = ADXL380_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 470 LSB at 25 degC
+	 * and a sensitivity of 10.2 LSB/C.
+	 */
+	.temp_offset =  25 * 102 / 10 - 470,
+	.has_low_power = true,
+	.info = &adxl380_info,
+
+};
+EXPORT_SYMBOL_NS_GPL(adxl380_chip_info, "IIO_ADXL380");
+
+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 = {
+	.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");
+
 static const struct iio_event_spec adxl380_events[] = {
 	{
 		.type = IIO_EV_TYPE_THRESH,
@@ -1866,7 +1922,7 @@ int adxl380_probe(struct device *dev, struct regmap *regmap,
 	indio_dev->channels = adxl380_channels;
 	indio_dev->num_channels = ARRAY_SIZE(adxl380_channels);
 	indio_dev->name = chip_info->name;
-	indio_dev->info = &adxl380_info;
+	indio_dev->info = chip_info->info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
 	ret = devm_regulator_get_enable(dev, "vddio");
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
@@ -14,10 +14,14 @@ struct adxl380_chip_info {
 	const int samp_freq_tbl[3];
 	const int temp_offset;
 	const u16 chip_id;
+	const struct iio_info *info;
+	const bool has_low_power;
 };
 
 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;
 
 int adxl380_probe(struct device *dev, struct regmap *regmap,
 		  const struct adxl380_chip_info *chip_info);
diff --git a/drivers/iio/accel/adxl380_i2c.c b/drivers/iio/accel/adxl380_i2c.c
index b4f86f972361..1851bef0b0d3 100644
--- a/drivers/iio/accel/adxl380_i2c.c
+++ b/drivers/iio/accel/adxl380_i2c.c
@@ -35,6 +35,8 @@ static int adxl380_i2c_probe(struct i2c_client *client)
 static const struct i2c_device_id adxl380_i2c_id[] = {
 	{ "adxl380", (kernel_ulong_t)&adxl380_chip_info },
 	{ "adxl382", (kernel_ulong_t)&adxl382_chip_info },
+	{ "adxl318", (kernel_ulong_t)&adxl318_chip_info },
+	{ "adxl319", (kernel_ulong_t)&adxl319_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, adxl380_i2c_id);
@@ -42,6 +44,8 @@ MODULE_DEVICE_TABLE(i2c, adxl380_i2c_id);
 static const struct of_device_id adxl380_of_match[] = {
 	{ .compatible = "adi,adxl380", .data = &adxl380_chip_info },
 	{ .compatible = "adi,adxl382", .data = &adxl382_chip_info },
+	{ .compatible = "adi,adxl318", .data = &adxl318_chip_info },
+	{ .compatible = "adi,adxl319", .data = &adxl319_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, adxl380_of_match);
diff --git a/drivers/iio/accel/adxl380_spi.c b/drivers/iio/accel/adxl380_spi.c
index 6edd0d211ffa..9076890bbb5f 100644
--- a/drivers/iio/accel/adxl380_spi.c
+++ b/drivers/iio/accel/adxl380_spi.c
@@ -37,6 +37,8 @@ static int adxl380_spi_probe(struct spi_device *spi)
 static const struct spi_device_id adxl380_spi_id[] = {
 	{ "adxl380", (kernel_ulong_t)&adxl380_chip_info },
 	{ "adxl382", (kernel_ulong_t)&adxl382_chip_info },
+	{ "adxl318", (kernel_ulong_t)&adxl318_chip_info },
+	{ "adxl319", (kernel_ulong_t)&adxl319_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(spi, adxl380_spi_id);
@@ -44,6 +46,8 @@ MODULE_DEVICE_TABLE(spi, adxl380_spi_id);
 static const struct of_device_id adxl380_of_match[] = {
 	{ .compatible = "adi,adxl380", .data = &adxl380_chip_info },
 	{ .compatible = "adi,adxl382", .data = &adxl382_chip_info },
+	{ .compatible = "adi,adxl318", .data = &adxl318_chip_info },
+	{ .compatible = "adi,adxl319", .data = &adxl319_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, adxl380_of_match);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iio: accel: adxl380: add support for ADXL318 and ADXL319
  2025-11-05 12:40 ` [PATCH 2/2] iio: accel: adxl380: add support for ADXL318 and ADXL319 Jonathan Santos
@ 2025-11-05 15:11   ` Andy Shevchenko
  2025-11-09 16:50   ` Jonathan Cameron
  1 sibling, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2025-11-05 15:11 UTC (permalink / raw)
  To: Jonathan Santos
  Cc: linux-iio, devicetree, linux-kernel, Michael.Hennerich,
	ramona.gradinariu, antoniu.miclaus, jic23, dlechner, nuno.sa,
	andy, robh, krzk+dt, conor+dt

On Wed, Nov 05, 2025 at 09:40:34AM -0300, Jonathan Santos 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.

...

> struct adxl380_chip_info {

>  	const int samp_freq_tbl[3];
>  	const int temp_offset;
>  	const u16 chip_id;
> +	const struct iio_info *info;
> +	const bool has_low_power;
>  };

You can save a few bytes here. Please, run `pahole` to see ways to improve
the layout.

Other than that, LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dt-bindings: iio: accel: adxl380: add new supported parts
  2025-11-05 12:40 [PATCH 1/2] dt-bindings: iio: accel: adxl380: add new supported parts Jonathan Santos
  2025-11-05 12:40 ` [PATCH 2/2] iio: accel: adxl380: add support for ADXL318 and ADXL319 Jonathan Santos
@ 2025-11-06  9:04 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-06  9:04 UTC (permalink / raw)
  To: Jonathan Santos
  Cc: linux-iio, devicetree, linux-kernel, Michael.Hennerich,
	ramona.gradinariu, antoniu.miclaus, jic23, dlechner, nuno.sa,
	andy, robh, krzk+dt, conor+dt

On Wed, Nov 05, 2025 at 09:40:24AM -0300, Jonathan Santos wrote:
> Include ADXL318 and ADXL319 accelerometers to the documentation.
> The ADXL318 is based on the ADXL380, while the ADXL319 is based on the
> ADXL382. However, the ADXL318/319 do not support some built-in features
> like single tap, double tap and triple tap detection, and also activity
> and inactivity detection.
> 
> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
> ---
>  .../devicetree/bindings/iio/accel/adi,adxl380.yaml    | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/accel/adi,adxl380.yaml b/Documentation/devicetree/bindings/iio/accel/adi,adxl380.yaml
> index f1ff5ff4f478..f38f384dd818 100644
> --- a/Documentation/devicetree/bindings/iio/accel/adi,adxl380.yaml
> +++ b/Documentation/devicetree/bindings/iio/accel/adi,adxl380.yaml
> @@ -11,18 +11,21 @@ maintainers:
>    - Antoniu Miclaus <antoniu.miclaus@analog.com>
>  
>  description: |
> -  The ADXL380/ADXL382 is a low noise density, low power, 3-axis
> -  accelerometer with selectable measurement ranges. The ADXL380
> -  supports the ±4 g, ±8 g, and ±16 g ranges, and the ADXL382 supports
> -  ±15 g, ±30 g, and ±60 g ranges.
> +  The ADXL380/ADXL382 and ADXL318/ADXL319 are low noise density,
> +  low power, 3-axis accelerometers with selectable measurement ranges.
> +  The ADXL380 and ADXL318 support the ±4 g, ±8 g, and ±16 g ranges,
> +  while the ADXL382 and ADXL319 support ±15 g, ±30 g, and ±60 g ranges.
>  
>    https://www.analog.com/en/products/adxl380.html
> +  https://www.analog.com/en/products/adxl318.html

318 < 380

>  
>  properties:
>    compatible:
>      enum:
>        - adi,adxl380
>        - adi,adxl382
> +      - adi,adxl318
> +      - adi,adxl319

Same here. Please keep this sorted.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iio: accel: adxl380: add support for ADXL318 and ADXL319
  2025-11-05 12:40 ` [PATCH 2/2] iio: accel: adxl380: add support for ADXL318 and ADXL319 Jonathan Santos
  2025-11-05 15:11   ` Andy Shevchenko
@ 2025-11-09 16:50   ` Jonathan Cameron
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2025-11-09 16:50 UTC (permalink / raw)
  To: Jonathan Santos
  Cc: linux-iio, devicetree, linux-kernel, Michael.Hennerich,
	ramona.gradinariu, antoniu.miclaus, dlechner, nuno.sa, andy, robh,
	krzk+dt, conor+dt

On Wed, 5 Nov 2025 09:40:34 -0300
Jonathan Santos <Jonathan.Santos@analog.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@analog.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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-09 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-05 12:40 [PATCH 1/2] dt-bindings: iio: accel: adxl380: add new supported parts Jonathan Santos
2025-11-05 12:40 ` [PATCH 2/2] iio: accel: adxl380: add support for ADXL318 and ADXL319 Jonathan Santos
2025-11-05 15:11   ` Andy Shevchenko
2025-11-09 16:50   ` Jonathan Cameron
2025-11-06  9:04 ` [PATCH 1/2] dt-bindings: iio: accel: adxl380: add new supported parts Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox