From: Shehryar Ahmad <shehryar.amd@gmail.com>
To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux@analog.com
Cc: "Shehryar Ahmad" <shehryar.amd@gmail.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Michael Hennerich" <Michael.Hennerich@analog.com>
Subject: [PATCH v3 5/7] iio: accel: adis16201: add ADIS16203 support
Date: Wed, 16 Sep 2026 10:55:35 +0500 [thread overview]
Message-ID: <20260916055547.15206-6-shehryar.amd@gmail.com> (raw)
In-Reply-To: <20260916055547.15206-1-shehryar.amd@gmail.com>
Add ADIS16203 from staging to mainline ADIS16201. ADIS16203 shares same
SPI protocol and register addresses. Differing parameters are handled by
adis16201_chip_info structure.
ADIS16203 specific support includes DIAG_STAT_SELFTEST_FAIL_BIT, which
is supported only on ADIS16203, a separate channel array and separate
adis_data struct.
Kconfig is updated accordingly.
Signed-off-by: Shehryar Ahmad <shehryar.amd@gmail.com>
---
drivers/iio/accel/Kconfig | 7 +++---
drivers/iio/accel/adis16201.c | 46 +++++++++++++++++++++++++++++++++--
2 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index 4094299e2..141ac9842 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -7,13 +7,14 @@
menu "Accelerometers"
config ADIS16201
- tristate "Analog Devices ADIS16201 Dual-Axis Digital Inclinometer and Accelerometer"
+ tristate "ADIS16201 Digital Inclinometer and similar"
depends on SPI
select IIO_ADIS_LIB
select IIO_ADIS_LIB_BUFFER if IIO_BUFFER
help
- Say Y here to build support for Analog Devices adis16201 dual-axis
- digital inclinometer and accelerometer.
+ Say Y here to build support for Analog Devices Digital Inclinometers:
+ - ADIS16201
+ - ADIS16203
To compile this driver as a module, say M here: the module will
be called adis16201.
diff --git a/drivers/iio/accel/adis16201.c b/drivers/iio/accel/adis16201.c
index 592dc6451..6d5a7b696 100644
--- a/drivers/iio/accel/adis16201.c
+++ b/drivers/iio/accel/adis16201.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * ADIS16201 Dual-Axis Digital Inclinometer and Accelerometer
+ * ADIS16201 Digital Inclinometer and similar
*
* Copyright 2010 Analog Devices Inc.
*/
@@ -63,6 +63,7 @@
#define ADIS16201_DIAG_STAT_REG 0x3C
#define ADIS16201_DIAG_STAT_ALARM2 BIT(9)
#define ADIS16201_DIAG_STAT_ALARM1 BIT(8)
+#define ADIS16203_DIAG_STAT_SELFTEST_FAIL_BIT 5
#define ADIS16201_DIAG_STAT_SPI_FAIL_BIT 3
#define ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT 2
/* Power supply above 3.625 V */
@@ -231,6 +232,15 @@ static const struct iio_chan_spec adis16201_channels[] = {
IIO_CHAN_SOFT_TIMESTAMP(7),
};
+static const struct iio_chan_spec adis16203_channels[] = {
+ ADIS_INCLI_CHAN(X, ADIS16201_XINCL_OUT_REG, ADIS16201_SCAN_INCLI_X,
+ BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14),
+ ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT_REG, ADIS16201_SCAN_SUPPLY, 0, 12),
+ ADIS_AUX_ADC_CHAN(ADIS16201_AUX_ADC_REG, ADIS16201_SCAN_AUX_ADC, 0, 12),
+ ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT_REG, ADIS16201_SCAN_TEMP, 0, 12),
+ IIO_CHAN_SOFT_TIMESTAMP(7),
+};
+
static const struct iio_info adis16201_info = {
.read_raw = adis16201_read_raw,
.write_raw = adis16201_write_raw,
@@ -238,6 +248,7 @@ static const struct iio_info adis16201_info = {
};
static const char * const adis16201_status_error_msgs[] = {
+ [ADIS16203_DIAG_STAT_SELFTEST_FAIL_BIT] = "Self test failure",
[ADIS16201_DIAG_STAT_SPI_FAIL_BIT] = "SPI failure",
[ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT] = "Flash update failed",
[ADIS16201_DIAG_STAT_POWER_HIGH_BIT] = "Power supply above 3.625V",
@@ -268,6 +279,25 @@ static const struct adis_data adis16201_data = {
BIT(ADIS16201_DIAG_STAT_POWER_LOW_BIT),
};
+static const struct adis_data adis16203_data = {
+ .read_delay = 20,
+ .msc_ctrl_reg = ADIS16201_MSC_CTRL_REG,
+ .glob_cmd_reg = ADIS16201_GLOB_CMD_REG,
+ .diag_stat_reg = ADIS16201_DIAG_STAT_REG,
+
+ .self_test_mask = ADIS16201_MSC_CTRL_SELF_TEST_EN,
+ .self_test_reg = ADIS16201_MSC_CTRL_REG,
+ .self_test_no_autoclear = true,
+ .timeouts = &adis16201_timeouts,
+
+ .status_error_msgs = adis16201_status_error_msgs,
+ .status_error_mask = BIT(ADIS16203_DIAG_STAT_SELFTEST_FAIL_BIT) |
+ BIT(ADIS16201_DIAG_STAT_SPI_FAIL_BIT) |
+ BIT(ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT) |
+ BIT(ADIS16201_DIAG_STAT_POWER_HIGH_BIT) |
+ BIT(ADIS16201_DIAG_STAT_POWER_LOW_BIT),
+};
+
static const struct adis16201_chip_info adis16201_chip_data = {
.arr_channels = adis16201_channels,
.incli_scale_val2 = 100000,
@@ -278,6 +308,16 @@ static const struct adis16201_chip_info adis16201_chip_data = {
.data = &adis16201_data,
};
+static const struct adis16201_chip_info adis16203_chip_data = {
+ .arr_channels = adis16203_channels,
+ .incli_scale_val2 = 25000,
+ .write_mask_incli = GENMASK(13, 0),
+ .read_bits_incli = 14,
+ .num_channels = ARRAY_SIZE(adis16203_channels),
+ .name = "adis16203",
+ .data = &adis16203_data,
+};
+
static int adis16201_probe(struct spi_device *spi)
{
struct iio_dev *indio_dev;
@@ -318,12 +358,14 @@ static int adis16201_probe(struct spi_device *spi)
static const struct of_device_id adis16201_of_match[] = {
{ .compatible = "adi,adis16201", .data = &adis16201_chip_data },
+ { .compatible = "adi,adis16203", .data = &adis16203_chip_data },
{ }
};
MODULE_DEVICE_TABLE(of, adis16201_of_match);
static const struct spi_device_id adis16201_ids[] = {
{ .name = "adis16201", .driver_data = (kernel_ulong_t)&adis16201_chip_data },
+ { .name = "adis16203", .driver_data = (kernel_ulong_t)&adis16203_chip_data },
{ }
};
MODULE_DEVICE_TABLE(spi, adis16201_ids);
@@ -339,6 +381,6 @@ static struct spi_driver adis16201_driver = {
module_spi_driver(adis16201_driver);
MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
-MODULE_DESCRIPTION("Analog Devices ADIS16201 Dual-Axis Digital Inclinometer and Accelerometer");
+MODULE_DESCRIPTION("Analog Devices ADIS16201 Inclinometer and similar");
MODULE_LICENSE("GPL v2");
MODULE_IMPORT_NS("IIO_ADISLIB");
--
2.43.0
next prev parent reply other threads:[~2026-09-16 6:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260916055547.15206-1-shehryar.amd@gmail.com>
2026-09-16 5:55 ` [PATCH v3 1/7] iio: accel: adis16201: fix channel order for buffer mode Shehryar Ahmad
2026-09-16 5:55 ` [PATCH v3 2/7] iio: accel: adis16201: add SPI device ID table Shehryar Ahmad
2026-09-16 5:55 ` [PATCH v3 3/7] iio: accel: adis16201: add OF " Shehryar Ahmad
2026-09-16 5:55 ` [PATCH v3 4/7] iio: accel: adis16201: prepare driver to support additional parts Shehryar Ahmad
2026-09-16 5:55 ` Shehryar Ahmad [this message]
2026-09-16 5:55 ` [PATCH v3 6/7] staging: iio: accel: remove adis16203, merged into mainline adis16201 driver Shehryar Ahmad
2026-09-16 5:55 ` [PATCH v3 7/7] dt-bindings: iio: accel: adi,adis16201: add adis16203 compatible Shehryar Ahmad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260916055547.15206-6-shehryar.amd@gmail.com \
--to=shehryar.amd@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®