Skip to contentSkip to conversation

iio: imu: adis16480: add devices to adis16480 driver

PATCH Superseded Darius Berghe 2 participants 4 messages Nov 1, 2024

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 iio: imu: adis16480: add devices to adis16480 driver

Add support for adis16486, adis16487 and adis16489 Six Degrees of Freedom Inertial Sensors into the existing adis16480 iio subsystem driver. The adis16487 is functionally equivalent to the already supported adis16485. The others have slight differences in terms of channels and scales with the already supported devices.

---
 drivers/iio/imu/adis16480.c | 75 +++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
drivers/iio/imu/adis16480.c +75 -0
index 7bfda7133a96..03a2f21dd779 100644
@@ -912,6 +912,24 @@ static const struct iio_chan_spec adis16485_channels[] = {
 	ADIS16480_DELTVEL_CHANNEL_NO_SCAN(Z),
 };
 
+static const struct iio_chan_spec adis16489_channels[] = {
+	ADIS16480_GYRO_CHANNEL(X),
+	ADIS16480_GYRO_CHANNEL(Y),
+	ADIS16480_GYRO_CHANNEL(Z),
+	ADIS16480_ACCEL_CHANNEL(X),
+	ADIS16480_ACCEL_CHANNEL(Y),
+	ADIS16480_ACCEL_CHANNEL(Z),
+	ADIS16480_PRESSURE_CHANNEL(),
+	ADIS16480_TEMP_CHANNEL(),
+	IIO_CHAN_SOFT_TIMESTAMP(8),
+	ADIS16480_DELTANG_CHANNEL_NO_SCAN(X),
+	ADIS16480_DELTANG_CHANNEL_NO_SCAN(Y),
+	ADIS16480_DELTANG_CHANNEL_NO_SCAN(Z),
+	ADIS16480_DELTVEL_CHANNEL_NO_SCAN(X),
+	ADIS16480_DELTVEL_CHANNEL_NO_SCAN(Y),
+	ADIS16480_DELTVEL_CHANNEL_NO_SCAN(Z),
+};
+
 static const struct iio_chan_spec adis16495_channels[] = {
 	ADIS16480_GYRO_CHANNEL(X),
 	ADIS16480_GYRO_CHANNEL(Y),
@@ -952,7 +970,10 @@ enum adis16480_variant {
 	ADIS16375,
 	ADIS16480,
 	ADIS16485,
+	ADIS16486,
+	ADIS16487,
 	ADIS16488,
+	ADIS16489,
 	ADIS16490,
 	ADIS16495_1,
 	ADIS16495_2,
@@ -1108,6 +1129,38 @@ static const struct adis16480_chip_info adis16480_chip_info[] = {
 		.filter_freqs = adis16480_def_filter_freqs,
 		.adis_data = ADIS16480_DATA(16485, &adis16485_timeouts, 0, 0),
 	},
+	[ADIS16486] = {
+		.channels = adis16485_channels,
+		.num_channels = ARRAY_SIZE(adis16485_channels),
+		.gyro_max_val = 22500 << 16,
+		.gyro_max_scale = IIO_DEGREE_TO_RAD(450),
+		.accel_max_val = IIO_M_S_2_TO_G(20000 << 16),
+		.accel_max_scale = 18,
+		.temp_scale = 5650, /* 5.65 milli degree Celsius */
+		.deltang_max_val = IIO_DEGREE_TO_RAD(720),
+		.deltvel_max_val = 200,
+		.int_clk = 2460000,
+		.max_dec_rate = 2048,
+		.has_sleep_cnt = true,
+		.filter_freqs = adis16480_def_filter_freqs,
+		.adis_data = ADIS16480_DATA(16486, &adis16480_timeouts, 0, 0),
+	},
+	[ADIS16487] = {
+		.channels = adis16485_channels,
+		.num_channels = ARRAY_SIZE(adis16485_channels),
+		.gyro_max_val = 22500 << 16,
+		.gyro_max_scale = IIO_DEGREE_TO_RAD(450),
+		.accel_max_val = IIO_M_S_2_TO_G(20000 << 16),
+		.accel_max_scale = 5,
+		.temp_scale = 5650, /* 5.65 milli degree Celsius */
+		.deltang_max_val = IIO_DEGREE_TO_RAD(720),
+		.deltvel_max_val = 50,
+		.int_clk = 2460000,
+		.max_dec_rate = 2048,
+		.has_sleep_cnt = true,
+		.filter_freqs = adis16480_def_filter_freqs,
+		.adis_data = ADIS16480_DATA(16487, &adis16485_timeouts, 0, 0),
+	},
 	[ADIS16488] = {
 		.channels = adis16480_channels,
 		.num_channels = ARRAY_SIZE(adis16480_channels),
@@ -1124,6 +1177,22 @@ static const struct adis16480_chip_info adis16480_chip_info[] = {
 		.filter_freqs = adis16480_def_filter_freqs,
 		.adis_data = ADIS16480_DATA(16488, &adis16485_timeouts, 0, 0),
 	},
+	[ADIS16489] = {
+		.channels = adis16489_channels,
+		.num_channels = ARRAY_SIZE(adis16489_channels),
+		.gyro_max_val = 22500 << 16,
+		.gyro_max_scale = IIO_DEGREE_TO_RAD(450),
+		.accel_max_val = IIO_M_S_2_TO_G(20000 << 16),
+		.accel_max_scale = 18,
+		.temp_scale = 5650, /* 5.65 milli degree Celsius */
+		.deltang_max_val = IIO_DEGREE_TO_RAD(720),
+		.deltvel_max_val = 200,
+		.int_clk = 2460000,
+		.max_dec_rate = 2048,
+		.has_sleep_cnt = true,
+		.filter_freqs = adis16480_def_filter_freqs,
+		.adis_data = ADIS16480_DATA(16489, &adis16480_timeouts, 0, 0),
+	},
 	[ADIS16490] = {
 		.channels = adis16485_channels,
 		.num_channels = ARRAY_SIZE(adis16485_channels),
@@ -1841,7 +1910,10 @@ static const struct spi_device_id adis16480_ids[] = {
 	{ "adis16375", ADIS16375 },
 	{ "adis16480", ADIS16480 },
 	{ "adis16485", ADIS16485 },
+	{ "adis16486", ADIS16486 },
+	{ "adis16487", ADIS16487 },
 	{ "adis16488", ADIS16488 },
+	{ "adis16489", ADIS16489 },
 	{ "adis16490", ADIS16490 },
 	{ "adis16495-1", ADIS16495_1 },
 	{ "adis16495-2", ADIS16495_2 },
@@ -1863,7 +1935,10 @@ static const struct of_device_id adis16480_of_match[] = {
 	{ .compatible = "adi,adis16375" },
 	{ .compatible = "adi,adis16480" },
 	{ .compatible = "adi,adis16485" },
+	{ .compatible = "adi,adis16486" },
+	{ .compatible = "adi,adis16487" },
 	{ .compatible = "adi,adis16488" },
+	{ .compatible = "adi,adis16489" },
 	{ .compatible = "adi,adis16490" },
 	{ .compatible = "adi,adis16495-1" },
 	{ .compatible = "adi,adis16495-2" },
Signature · 1 line
2.46.1
#2 lore raw

PATCH 3/3 dt-bindings: iio: adis16480: add devices to adis16480

Add the adis16486, adis16487 and adis16489 Six Degrees of Freedom Inertial Sensors to the list of compatible devices of the adis16480 iio subsystem driver.

---
 Documentation/devicetree/bindings/iio/imu/adi,adis16480.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/iio/imu/adi,adis16480.yaml +3 -0
index e3eec38897bf..5bef2878a0df 100644
@@ -15,7 +15,10 @@ properties:
       - adi,adis16375
       - adi,adis16480
       - adi,adis16485
+      - adi,adis16486
+      - adi,adis16487
       - adi,adis16488
+      - adi,adis16489
       - adi,adis16490
       - adi,adis16495-1
       - adi,adis16495-2
Signature · 1 line
2.46.1
#1 lore raw

PATCH 2/3 iio: imu: adis16480: add devices to adis16480 - docs

In reply to Darius Berghe

Add datasheet links for adis16486, adis16487 and adis16489 Six Degrees of Freedom Inertial Sensors into the existing adis16480 driver documentation. The adis16487 is functionally equivalent to the already supported adis16485. The others have slight differences in terms of channels and scales with the already supported devices.

---
 Documentation/iio/adis16480.rst | 3 +++
 1 file changed, 3 insertions(+)
Documentation/iio/adis16480.rst +3 -0
index e3cc64ddc8f6..d911131c613c 100644
@@ -12,7 +12,10 @@ This driver supports Analog Device's IMUs on SPI bus.
 * `ADIS16375 <https://www.analog.com/ADIS16375>`_
 * `ADIS16480 <https://www.analog.com/ADIS16480>`_
 * `ADIS16485 <https://www.analog.com/ADIS16485>`_
+* `ADIS16486 <https://www.analog.com/ADIS16486>`_
+* `ADIS16487 <https://www.analog.com/ADIS16487>`_
 * `ADIS16488 <https://www.analog.com/ADIS16488>`_
+* `ADIS16489 <https://www.analog.com/ADIS16489>`_
 * `ADIS16490 <https://www.analog.com/ADIS16490>`_
 * `ADIS16495 <https://www.analog.com/ADIS16495>`_
 * `ADIS16497 <https://www.analog.com/ADIS16497>`_
Signature · 1 line
2.46.1
maintainer
#3 lore raw

Re: [PATCH 3/3] dt-bindings: iio: adis16480: add devices to adis16480

In reply to Darius Berghe
Quoted 3 lines · On Fri, 1 Nov 2024 15:07:42 +0200 Darius Berghe <[email protected]>…

Add the adis16486, adis16487 and adis16489 Six Degrees of Freedom Inertial Sensors to the list of compatible devices of the adis16480 iio subsystem driver.

Hi Darius

Please give a brief statement of what differs between these and the many other compatibles in this binding (beyond the ID register)?

(usually scales, features etc)

In particularly you state in the docs patch that one of them is functionally equivalent to an existing part so there a fallback compatible is appropriate.

See how the st,lsm6dsx does it. The reason to do this it allows the potential for an old kernel driver to work fine with a newer device tree.

Other than that the series looks good to me.

Given we have a case where data could be shared, longer term breaking up the chip_info array into individual structures would allow sharing of the data.

The name handling in here isn't ideal as it relies on matching in the spi_device_id table which is fragile. Doing that more cleanly might break the sharing of structures. Oh well, not relevant for this set anyway.

Jonathan

Quoted 21 lines
---
 Documentation/devicetree/bindings/iio/imu/adi,adis16480.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/iio/imu/adi,adis16480.yaml +3 -0
index e3eec38897bf..5bef2878a0df 100644
@@ -15,7 +15,10 @@ properties:
       - adi,adis16375
       - adi,adis16480
       - adi,adis16485
+      - adi,adis16486
+      - adi,adis16487
       - adi,adis16488
+      - adi,adis16489
       - adi,adis16490
       - adi,adis16495-1
       - adi,adis16495-2