All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation
@ 2023-01-23 21:17 Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 01/12] staging: iio: accel: adis16203: More conventional header ordering Jonathan Cameron
                   ` (11 more replies)
  0 siblings, 12 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Whilst taking a look at what we still have in staging, I noticed that this
driver was (probably) only still there due to the need to define some ABI
for the odd 180 degree offset channel (same as the other channel
minus 180 degrees).

Rather than leaving the driver in staging for ever, let us just drop that
channel and move on. The rest of the series is trivial driver cleanup.

Note this is only build tested, so would be great if people can take
a good look.  If anyone happens to have one of these that would be even
better (they are still marked for production use more than 12 years after
the driver was submitted).

There are lots of features we could support if anyone wanted to, but
it should be functional for basic channel reading without the bells
and whistles.  I've tried to incorporate the relevant device tree bindings
however (multiple interrupt lines, supplies and reset gpio).

Cc: Barry Song <baohua@kernel.org>
(mostly for comedy value, not expecting you to remember the driver :)

Jonathan Cameron (12):
  staging: iio: accel: adis16203: More conventional header ordering
  staging: iio: accel: adis16203: Drop excessive register comments
  staging: iio: accel: adis16203: Rename incli channel registers
  staging: iio: accel: adis16203: Drop the 180 degree offset channel
  staging: iio: accel: adis16203: Simplify handling of calibbias
  staging: iio: accel: adis16203: Drop driver name define
  staging: iio: accel: adis16203: Make units explicit in name of delay
    define
  staging: iio: accel: adis16203: Trivial whitespace cleanup
  staging: iio: accel: adis16203: Drop setting drvdata as nothing gets
    it
  staging: iio: accel: adis16203: Trivial style cleanup
  staging: iio: accel: adis16203: Move out of staging
  dt-bindings: iio: accel: Add ADIS16203 Inclinometer

 .../bindings/iio/accel/adi,adis16203.yaml     |  59 +++++
 drivers/iio/accel/Kconfig                     |  12 +
 drivers/iio/accel/Makefile                    |   1 +
 drivers/{staging => }/iio/accel/adis16203.c   | 212 ++++++------------
 drivers/staging/iio/accel/Kconfig             |  12 -
 drivers/staging/iio/accel/Makefile            |   1 -
 6 files changed, 136 insertions(+), 161 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml
 rename drivers/{staging => }/iio/accel/adis16203.c (51%)

-- 
2.39.1


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

* [PATCH 01/12] staging: iio: accel: adis16203: More conventional header ordering
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 02/12] staging: iio: accel: adis16203: Drop excessive register comments Jonathan Cameron
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

A common practice in IIO drivers it to have the headers in
alphabetical order with the exception of the more specific IIO
headers which come in their own block at the end.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index c0e4c9266b5f..dd02ceb00d40 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -6,14 +6,13 @@
  */
 
 #include <linux/device.h>
-
-#include <linux/iio/iio.h>
-#include <linux/iio/imu/adis.h>
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/spi/spi.h>
 
+#include <linux/iio/iio.h>
+#include <linux/iio/imu/adis.h>
+
 #define ADIS16203_STARTUP_DELAY 220 /* ms */
 
 /* Flash memory write count */
-- 
2.39.1


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

* [PATCH 02/12] staging: iio: accel: adis16203: Drop excessive register comments
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 01/12] staging: iio: accel: adis16203: More conventional header ordering Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 03/12] staging: iio: accel: adis16203: Rename incli channel registers Jonathan Cameron
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

A lot of these comments added very little that was not obvious
from the register/field name. In one case the polarity was the opposite
of what would be expected so rename that field (currently unused
in the driver)

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 71 +--------------------------
 1 file changed, 1 insertion(+), 70 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index dd02ceb00d40..60117aaf56d4 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -15,111 +15,42 @@
 
 #define ADIS16203_STARTUP_DELAY 220 /* ms */
 
-/* Flash memory write count */
 #define ADIS16203_FLASH_CNT      0x00
-
-/* Output, power supply */
 #define ADIS16203_SUPPLY_OUT     0x02
-
-/* Output, auxiliary ADC input */
 #define ADIS16203_AUX_ADC        0x08
-
-/* Output, temperature */
 #define ADIS16203_TEMP_OUT       0x0A
-
-/* Output, x-axis inclination */
 #define ADIS16203_XINCL_OUT      0x0C
-
-/* Output, y-axis inclination */
 #define ADIS16203_YINCL_OUT      0x0E
-
-/* Incline null calibration */
 #define ADIS16203_INCL_NULL      0x18
-
-/* Alarm 1 amplitude threshold */
 #define ADIS16203_ALM_MAG1       0x20
-
-/* Alarm 2 amplitude threshold */
 #define ADIS16203_ALM_MAG2       0x22
-
-/* Alarm 1, sample period */
 #define ADIS16203_ALM_SMPL1      0x24
-
-/* Alarm 2, sample period */
 #define ADIS16203_ALM_SMPL2      0x26
-
-/* Alarm control */
 #define ADIS16203_ALM_CTRL       0x28
-
-/* Auxiliary DAC data */
 #define ADIS16203_AUX_DAC        0x30
-
-/* General-purpose digital input/output control */
 #define ADIS16203_GPIO_CTRL      0x32
-
-/* Miscellaneous control */
 #define ADIS16203_MSC_CTRL       0x34
-
-/* Internal sample period (rate) control */
 #define ADIS16203_SMPL_PRD       0x36
-
-/* Operation, filter configuration */
 #define ADIS16203_AVG_CNT        0x38
-
-/* Operation, sleep mode control */
 #define ADIS16203_SLP_CNT        0x3A
-
-/* Diagnostics, system status register */
 #define ADIS16203_DIAG_STAT      0x3C
-
-/* Operation, system command register */
 #define ADIS16203_GLOB_CMD       0x3E
 
-/* MSC_CTRL */
-
-/* Self-test at power-on: 1 = disabled, 0 = enabled */
-#define ADIS16203_MSC_CTRL_PWRUP_SELF_TEST      BIT(10)
-
-/* Reverses rotation of both inclination outputs */
+#define ADIS16203_MSC_CTRL_PWRUP_SELF_TEST_DIS  BIT(10)
 #define ADIS16203_MSC_CTRL_REVERSE_ROT_EN       BIT(9)
-
-/* Self-test enable */
 #define ADIS16203_MSC_CTRL_SELF_TEST_EN         BIT(8)
-
-/* Data-ready enable: 1 = enabled, 0 = disabled */
 #define ADIS16203_MSC_CTRL_DATA_RDY_EN          BIT(2)
-
-/* Data-ready polarity: 1 = active high, 0 = active low */
 #define ADIS16203_MSC_CTRL_ACTIVE_HIGH          BIT(1)
-
-/* Data-ready line selection: 1 = DIO1, 0 = DIO0 */
 #define ADIS16203_MSC_CTRL_DATA_RDY_DIO1        BIT(0)
 
-/* DIAG_STAT */
-
-/* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */
 #define ADIS16203_DIAG_STAT_ALARM2        BIT(9)
-
-/* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */
 #define ADIS16203_DIAG_STAT_ALARM1        BIT(8)
-
-/* Self-test diagnostic error flag */
 #define ADIS16203_DIAG_STAT_SELFTEST_FAIL_BIT 5
-
-/* SPI communications failure */
 #define ADIS16203_DIAG_STAT_SPI_FAIL_BIT      3
-
-/* Flash update failure */
 #define ADIS16203_DIAG_STAT_FLASH_UPT_BIT     2
-
-/* Power supply above 3.625 V */
 #define ADIS16203_DIAG_STAT_POWER_HIGH_BIT    1
-
-/* Power supply below 2.975 V */
 #define ADIS16203_DIAG_STAT_POWER_LOW_BIT     0
 
-/* GLOB_CMD */
-
 #define ADIS16203_GLOB_CMD_SW_RESET     BIT(7)
 #define ADIS16203_GLOB_CMD_CLEAR_STAT   BIT(4)
 #define ADIS16203_GLOB_CMD_FACTORY_CAL  BIT(1)
-- 
2.39.1


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

* [PATCH 03/12] staging: iio: accel: adis16203: Rename incli channel registers
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 01/12] staging: iio: accel: adis16203: More conventional header ordering Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 02/12] staging: iio: accel: adis16203: Drop excessive register comments Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 04/12] staging: iio: accel: adis16203: Drop the 180 degree offset channel Jonathan Cameron
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This device has two such channels that are effectively reading the
same thing, just with a 180 degree offset.  First rename them
(later we will drop one of them as it is easier to apply an offset
in software).

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index 60117aaf56d4..8e5d1d2ea8e9 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -19,8 +19,8 @@
 #define ADIS16203_SUPPLY_OUT     0x02
 #define ADIS16203_AUX_ADC        0x08
 #define ADIS16203_TEMP_OUT       0x0A
-#define ADIS16203_XINCL_OUT      0x0C
-#define ADIS16203_YINCL_OUT      0x0E
+#define ADIS16203_INCL_OUT       0x0C
+#define ADIS16203_INCL_OUT_180   0x0E
 #define ADIS16203_INCL_NULL      0x18
 #define ADIS16203_ALM_MAG1       0x20
 #define ADIS16203_ALM_MAG2       0x22
@@ -138,10 +138,10 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
 static const struct iio_chan_spec adis16203_channels[] = {
 	ADIS_SUPPLY_CHAN(ADIS16203_SUPPLY_OUT, ADIS16203_SCAN_SUPPLY, 0, 12),
 	ADIS_AUX_ADC_CHAN(ADIS16203_AUX_ADC, ADIS16203_SCAN_AUX_ADC, 0, 12),
-	ADIS_INCLI_CHAN(X, ADIS16203_XINCL_OUT, ADIS16203_SCAN_INCLI_X,
+	ADIS_INCLI_CHAN(X, ADIS16203_INCL_OUT, ADIS16203_SCAN_INCLI_X,
 			BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14),
 	/* Fixme: Not what it appears to be - see data sheet */
-	ADIS_INCLI_CHAN(Y, ADIS16203_YINCL_OUT, ADIS16203_SCAN_INCLI_Y,
+	ADIS_INCLI_CHAN(Y, ADIS16203_INCL_OUT_180, ADIS16203_SCAN_INCLI_Y,
 			0, 0, 14),
 	ADIS_TEMP_CHAN(ADIS16203_TEMP_OUT, ADIS16203_SCAN_TEMP, 0, 12),
 	IIO_CHAN_SOFT_TIMESTAMP(5),
-- 
2.39.1


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

* [PATCH 04/12] staging: iio: accel: adis16203: Drop the 180 degree offset channel
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
                   ` (2 preceding siblings ...)
  2023-01-23 21:17 ` [PATCH 03/12] staging: iio: accel: adis16203: Rename incli channel registers Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 05/12] staging: iio: accel: adis16203: Simplify handling of calibbias Jonathan Cameron
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

There is no standard ABI suitable for this channel, which is blocking
the graduation of this driver from staging. It provides no obvious
benefit over applying a -180 degree offset in software. So drop the
channel.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index 8e5d1d2ea8e9..b59a003f3e26 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -59,7 +59,6 @@
 
 enum adis16203_scan {
 	 ADIS16203_SCAN_INCLI_X,
-	 ADIS16203_SCAN_INCLI_Y,
 	 ADIS16203_SCAN_SUPPLY,
 	 ADIS16203_SCAN_AUX_ADC,
 	 ADIS16203_SCAN_TEMP,
@@ -140,11 +139,8 @@ static const struct iio_chan_spec adis16203_channels[] = {
 	ADIS_AUX_ADC_CHAN(ADIS16203_AUX_ADC, ADIS16203_SCAN_AUX_ADC, 0, 12),
 	ADIS_INCLI_CHAN(X, ADIS16203_INCL_OUT, ADIS16203_SCAN_INCLI_X,
 			BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14),
-	/* Fixme: Not what it appears to be - see data sheet */
-	ADIS_INCLI_CHAN(Y, ADIS16203_INCL_OUT_180, ADIS16203_SCAN_INCLI_Y,
-			0, 0, 14),
 	ADIS_TEMP_CHAN(ADIS16203_TEMP_OUT, ADIS16203_SCAN_TEMP, 0, 12),
-	IIO_CHAN_SOFT_TIMESTAMP(5),
+	IIO_CHAN_SOFT_TIMESTAMP(4),
 };
 
 static const struct iio_info adis16203_info = {
-- 
2.39.1


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

* [PATCH 05/12] staging: iio: accel: adis16203: Simplify handling of calibbias
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
                   ` (3 preceding siblings ...)
  2023-01-23 21:17 ` [PATCH 04/12] staging: iio: accel: adis16203: Drop the 180 degree offset channel Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 06/12] staging: iio: accel: adis16203: Drop driver name define Jonathan Cameron
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Dropping the indirection on address lookup as there was only one
address enables several other minor cleanups.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index b59a003f3e26..67c0340d7097 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -5,6 +5,7 @@
  * Copyright 2010 Analog Devices Inc.
  */
 
+#include <linux/bitfield.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -57,6 +58,8 @@
 
 #define ADIS16203_ERROR_ACTIVE          BIT(14)
 
+#define ADIS16203_INCLI_NULL_MSK     GENMASK(13, 0)
+
 enum adis16203_scan {
 	 ADIS16203_SCAN_INCLI_X,
 	 ADIS16203_SCAN_SUPPLY,
@@ -66,10 +69,6 @@ enum adis16203_scan {
 
 #define DRIVER_NAME		"adis16203"
 
-static const u8 adis16203_addresses[] = {
-	[ADIS16203_SCAN_INCLI_X] = ADIS16203_INCL_NULL,
-};
-
 static int adis16203_write_raw(struct iio_dev *indio_dev,
 			       struct iio_chan_spec const *chan,
 			       int val,
@@ -77,10 +76,12 @@ static int adis16203_write_raw(struct iio_dev *indio_dev,
 			       long mask)
 {
 	struct adis *st = iio_priv(indio_dev);
-	/* currently only one writable parameter which keeps this simple */
-	u8 addr = adis16203_addresses[chan->scan_index];
 
-	return adis_write_reg_16(st, addr, val & 0x3FFF);
+	if (mask != IIO_CHAN_INFO_CALIBBIAS)
+		return -EINVAL;
+
+	return adis_write_reg_16(st, ADIS16203_INCL_NULL,
+				 FIELD_PREP(ADIS16203_INCLI_NULL_MSK, val));
 }
 
 static int adis16203_read_raw(struct iio_dev *indio_dev,
@@ -90,7 +91,7 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
 {
 	struct adis *st = iio_priv(indio_dev);
 	int ret;
-	u8 addr;
+
 	s16 val16;
 
 	switch (mask) {
@@ -123,8 +124,7 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
 		*val = 25000 / -470 - 1278; /* 25 C = 1278 */
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_CALIBBIAS:
-		addr = adis16203_addresses[chan->scan_index];
-		ret = adis_read_reg_16(st, addr, &val16);
+		ret = adis_read_reg_16(st, ADIS16203_INCL_NULL, &val16);
 		if (ret)
 			return ret;
 		*val = sign_extend32(val16, 13);
-- 
2.39.1


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

* [PATCH 06/12] staging: iio: accel: adis16203: Drop driver name define
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
                   ` (4 preceding siblings ...)
  2023-01-23 21:17 ` [PATCH 05/12] staging: iio: accel: adis16203: Simplify handling of calibbias Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 07/12] staging: iio: accel: adis16203: Make units explicit in name of delay define Jonathan Cameron
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

These defines just make it harder to see what strings are set
for which driver structure fields. Much better to just have the
string inline.  In this case it wasn't even used.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index 67c0340d7097..25342717539b 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -67,8 +67,6 @@ enum adis16203_scan {
 	 ADIS16203_SCAN_TEMP,
 };
 
-#define DRIVER_NAME		"adis16203"
-
 static int adis16203_write_raw(struct iio_dev *indio_dev,
 			       struct iio_chan_spec const *chan,
 			       int val,
@@ -196,7 +194,7 @@ static int adis16203_probe(struct spi_device *spi)
 	/* this is only used for removal purposes */
 	spi_set_drvdata(spi, indio_dev);
 
-	indio_dev->name = spi->dev.driver->name;
+	indio_dev->name = "adis16203";
 	indio_dev->channels = adis16203_channels;
 	indio_dev->num_channels = ARRAY_SIZE(adis16203_channels);
 	indio_dev->info = &adis16203_info;
-- 
2.39.1


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

* [PATCH 07/12] staging: iio: accel: adis16203: Make units explicit in name of delay define
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
                   ` (5 preceding siblings ...)
  2023-01-23 21:17 ` [PATCH 06/12] staging: iio: accel: adis16203: Drop driver name define Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 08/12] staging: iio: accel: adis16203: Trivial whitespace cleanup Jonathan Cameron
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

A postfix of _MS avoids the need for a comment that might bit rot.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index 25342717539b..271e560c41c0 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -14,7 +14,7 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/imu/adis.h>
 
-#define ADIS16203_STARTUP_DELAY 220 /* ms */
+#define ADIS16203_STARTUP_DELAY_MS		220
 
 #define ADIS16203_FLASH_CNT      0x00
 #define ADIS16203_SUPPLY_OUT     0x02
@@ -156,9 +156,9 @@ static const char * const adis16203_status_error_msgs[] = {
 };
 
 static const struct adis_timeout adis16203_timeouts = {
-	.reset_ms = ADIS16203_STARTUP_DELAY,
-	.sw_reset_ms = ADIS16203_STARTUP_DELAY,
-	.self_test_ms = ADIS16203_STARTUP_DELAY
+	.reset_ms = ADIS16203_STARTUP_DELAY_MS,
+	.sw_reset_ms = ADIS16203_STARTUP_DELAY_MS,
+	.self_test_ms = ADIS16203_STARTUP_DELAY_MS
 };
 
 static const struct adis_data adis16203_data = {
-- 
2.39.1


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

* [PATCH 08/12] staging: iio: accel: adis16203: Trivial whitespace cleanup
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
                   ` (6 preceding siblings ...)
  2023-01-23 21:17 ` [PATCH 07/12] staging: iio: accel: adis16203: Make units explicit in name of delay define Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 09/12] staging: iio: accel: adis16203: Drop setting drvdata as nothing gets it Jonathan Cameron
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Identation etc in this driver was inconsistent. Fix that.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 97 +++++++++++++--------------
 1 file changed, 46 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index 271e560c41c0..20e9c9eb9436 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -16,49 +16,49 @@
 
 #define ADIS16203_STARTUP_DELAY_MS		220
 
-#define ADIS16203_FLASH_CNT      0x00
-#define ADIS16203_SUPPLY_OUT     0x02
-#define ADIS16203_AUX_ADC        0x08
-#define ADIS16203_TEMP_OUT       0x0A
-#define ADIS16203_INCL_OUT       0x0C
-#define ADIS16203_INCL_OUT_180   0x0E
-#define ADIS16203_INCL_NULL      0x18
-#define ADIS16203_ALM_MAG1       0x20
-#define ADIS16203_ALM_MAG2       0x22
-#define ADIS16203_ALM_SMPL1      0x24
-#define ADIS16203_ALM_SMPL2      0x26
-#define ADIS16203_ALM_CTRL       0x28
-#define ADIS16203_AUX_DAC        0x30
-#define ADIS16203_GPIO_CTRL      0x32
-#define ADIS16203_MSC_CTRL       0x34
-#define ADIS16203_SMPL_PRD       0x36
-#define ADIS16203_AVG_CNT        0x38
-#define ADIS16203_SLP_CNT        0x3A
-#define ADIS16203_DIAG_STAT      0x3C
-#define ADIS16203_GLOB_CMD       0x3E
-
-#define ADIS16203_MSC_CTRL_PWRUP_SELF_TEST_DIS  BIT(10)
-#define ADIS16203_MSC_CTRL_REVERSE_ROT_EN       BIT(9)
-#define ADIS16203_MSC_CTRL_SELF_TEST_EN         BIT(8)
-#define ADIS16203_MSC_CTRL_DATA_RDY_EN          BIT(2)
-#define ADIS16203_MSC_CTRL_ACTIVE_HIGH          BIT(1)
-#define ADIS16203_MSC_CTRL_DATA_RDY_DIO1        BIT(0)
-
-#define ADIS16203_DIAG_STAT_ALARM2        BIT(9)
-#define ADIS16203_DIAG_STAT_ALARM1        BIT(8)
-#define ADIS16203_DIAG_STAT_SELFTEST_FAIL_BIT 5
-#define ADIS16203_DIAG_STAT_SPI_FAIL_BIT      3
-#define ADIS16203_DIAG_STAT_FLASH_UPT_BIT     2
-#define ADIS16203_DIAG_STAT_POWER_HIGH_BIT    1
-#define ADIS16203_DIAG_STAT_POWER_LOW_BIT     0
-
-#define ADIS16203_GLOB_CMD_SW_RESET     BIT(7)
-#define ADIS16203_GLOB_CMD_CLEAR_STAT   BIT(4)
-#define ADIS16203_GLOB_CMD_FACTORY_CAL  BIT(1)
-
-#define ADIS16203_ERROR_ACTIVE          BIT(14)
-
-#define ADIS16203_INCLI_NULL_MSK     GENMASK(13, 0)
+#define ADIS16203_FLASH_CNT			0x00
+#define ADIS16203_SUPPLY_OUT			0x02
+#define ADIS16203_AUX_ADC			0x08
+#define ADIS16203_TEMP_OUT			0x0A
+#define ADIS16203_INCL_OUT			0x0C
+#define ADIS16203_INCL_OUT_180			0x0E
+#define ADIS16203_INCL_NULL			0x18
+#define ADIS16203_ALM_MAG1			0x20
+#define ADIS16203_ALM_MAG2			0x22
+#define ADIS16203_ALM_SMPL1			0x24
+#define ADIS16203_ALM_SMPL2			0x26
+#define ADIS16203_ALM_CTRL			0x28
+#define ADIS16203_AUX_DAC			0x30
+#define ADIS16203_GPIO_CTRL			0x32
+#define ADIS16203_MSC_CTRL			0x34
+#define ADIS16203_SMPL_PRD			0x36
+#define ADIS16203_AVG_CNT			0x38
+#define ADIS16203_SLP_CNT			0x3A
+#define ADIS16203_DIAG_STAT			0x3C
+#define ADIS16203_GLOB_CMD			0x3E
+
+#define ADIS16203_MSC_CTRL_PWRUP_SELF_TEST_DIS	BIT(10)
+#define ADIS16203_MSC_CTRL_REVERSE_ROT_EN	BIT(9)
+#define ADIS16203_MSC_CTRL_SELF_TEST_EN		BIT(8)
+#define ADIS16203_MSC_CTRL_DATA_RDY_EN		BIT(2)
+#define ADIS16203_MSC_CTRL_ACTIVE_HIGH		BIT(1)
+#define ADIS16203_MSC_CTRL_DATA_RDY_DIO1	BIT(0)
+
+#define ADIS16203_DIAG_STAT_ALARM2		BIT(9)
+#define ADIS16203_DIAG_STAT_ALARM1		BIT(8)
+#define ADIS16203_DIAG_STAT_SELFTEST_FAIL_BIT	5
+#define ADIS16203_DIAG_STAT_SPI_FAIL_BIT	3
+#define ADIS16203_DIAG_STAT_FLASH_UPT_BIT	2
+#define ADIS16203_DIAG_STAT_POWER_HIGH_BIT	1
+#define ADIS16203_DIAG_STAT_POWER_LOW_BIT	0
+
+#define ADIS16203_GLOB_CMD_SW_RESET		BIT(7)
+#define ADIS16203_GLOB_CMD_CLEAR_STAT		BIT(4)
+#define ADIS16203_GLOB_CMD_FACTORY_CAL		BIT(1)
+
+#define ADIS16203_ERROR_ACTIVE			BIT(14)
+
+#define ADIS16203_INCLI_NULL_MSK		GENMASK(13, 0)
 
 enum adis16203_scan {
 	 ADIS16203_SCAN_INCLI_X,
@@ -69,9 +69,7 @@ enum adis16203_scan {
 
 static int adis16203_write_raw(struct iio_dev *indio_dev,
 			       struct iio_chan_spec const *chan,
-			       int val,
-			       int val2,
-			       long mask)
+			       int val, int val2, long mask)
 {
 	struct adis *st = iio_priv(indio_dev);
 
@@ -84,18 +82,16 @@ static int adis16203_write_raw(struct iio_dev *indio_dev,
 
 static int adis16203_read_raw(struct iio_dev *indio_dev,
 			      struct iio_chan_spec const *chan,
-			      int *val, int *val2,
-			      long mask)
+			      int *val, int *val2, long mask)
 {
 	struct adis *st = iio_priv(indio_dev);
 	int ret;
-
 	s16 val16;
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
 		return adis_single_conversion(indio_dev, chan,
-				ADIS16203_ERROR_ACTIVE, val);
+					      ADIS16203_ERROR_ACTIVE, val);
 	case IIO_CHAN_INFO_SCALE:
 		switch (chan->type) {
 		case IIO_VOLTAGE:
@@ -220,7 +216,6 @@ static const struct of_device_id adis16203_of_match[] = {
 	{ .compatible = "adi,adis16203" },
 	{ },
 };
-
 MODULE_DEVICE_TABLE(of, adis16203_of_match);
 
 static struct spi_driver adis16203_driver = {
-- 
2.39.1


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

* [PATCH 09/12] staging: iio: accel: adis16203: Drop setting drvdata as nothing gets it
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
                   ` (7 preceding siblings ...)
  2023-01-23 21:17 ` [PATCH 08/12] staging: iio: accel: adis16203: Trivial whitespace cleanup Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 10/12] staging: iio: accel: adis16203: Trivial style cleanup Jonathan Cameron
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

As commented, it is only useful for .remove() which doesn't exist, so
drop setting it and the comment.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index 20e9c9eb9436..9915b73454d2 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -187,8 +187,6 @@ static int adis16203_probe(struct spi_device *spi)
 	if (!indio_dev)
 		return -ENOMEM;
 	st = iio_priv(indio_dev);
-	/* this is only used for removal purposes */
-	spi_set_drvdata(spi, indio_dev);
 
 	indio_dev->name = "adis16203";
 	indio_dev->channels = adis16203_channels;
-- 
2.39.1


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

* [PATCH 10/12] staging: iio: accel: adis16203: Trivial style cleanup
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
                   ` (8 preceding siblings ...)
  2023-01-23 21:17 ` [PATCH 09/12] staging: iio: accel: adis16203: Drop setting drvdata as nothing gets it Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 11/12] staging: iio: accel: adis16203: Move out of staging Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer Jonathan Cameron
  11 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Drop a training comma after a null terminator and a comment
that says nothing beyond the obvious.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/accel/adis16203.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index 9915b73454d2..1aaf9815aa66 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -182,7 +182,6 @@ static int adis16203_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 	struct adis *st;
 
-	/* setup the industrialio driver allocated elements */
 	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
 	if (!indio_dev)
 		return -ENOMEM;
@@ -212,7 +211,7 @@ static int adis16203_probe(struct spi_device *spi)
 
 static const struct of_device_id adis16203_of_match[] = {
 	{ .compatible = "adi,adis16203" },
-	{ },
+	{ }
 };
 MODULE_DEVICE_TABLE(of, adis16203_of_match);
 
-- 
2.39.1


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

* [PATCH 11/12] staging: iio: accel: adis16203: Move out of staging
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
                   ` (9 preceding siblings ...)
  2023-01-23 21:17 ` [PATCH 10/12] staging: iio: accel: adis16203: Trivial style cleanup Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-24  9:44   ` Jonathan Cameron
  2023-01-23 21:17 ` [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer Jonathan Cameron
  11 siblings, 1 reply; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

The main blocker of this driver moving previously was non standard
ABI for the 180 degree offset channel. Now support for that channel
has been dropped, this simple driver can move out of staging.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/Kconfig                   | 12 ++++++++++++
 drivers/iio/accel/Makefile                  |  1 +
 drivers/{staging => }/iio/accel/adis16203.c |  0
 drivers/staging/iio/accel/Kconfig           | 12 ------------
 drivers/staging/iio/accel/Makefile          |  1 -
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index b6b45d359f28..88d4b18bd5e8 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -18,6 +18,18 @@ config ADIS16201
 	  To compile this driver as a module, say M here: the module will
 	  be called adis16201.
 
+config ADIS16203
+	tristate "Analog Devices ADIS16203 Programmable 360 Degrees Inclinometer"
+	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 adis16203 Programmable
+	  360 Degrees Inclinometer.
+
+	  To compile this driver as a module, say M here: the module will be
+	  called adis16203.
+
 config ADIS16209
 	tristate "Analog Devices ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer"
 	depends on SPI
diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
index 311ead9c3ef1..b6f0cee52659 100644
--- a/drivers/iio/accel/Makefile
+++ b/drivers/iio/accel/Makefile
@@ -5,6 +5,7 @@
 
 # When adding new entries keep the list in alphabetical order
 obj-$(CONFIG_ADIS16201) += adis16201.o
+obj-$(CONFIG_ADIS16203) += adis16203.o
 obj-$(CONFIG_ADIS16209) += adis16209.o
 obj-$(CONFIG_ADXL313) += adxl313_core.o
 obj-$(CONFIG_ADXL313_I2C) += adxl313_i2c.o
diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/iio/accel/adis16203.c
similarity index 100%
rename from drivers/staging/iio/accel/adis16203.c
rename to drivers/iio/accel/adis16203.c
diff --git a/drivers/staging/iio/accel/Kconfig b/drivers/staging/iio/accel/Kconfig
index 3318997a7009..3769af8719f3 100644
--- a/drivers/staging/iio/accel/Kconfig
+++ b/drivers/staging/iio/accel/Kconfig
@@ -4,18 +4,6 @@
 #
 menu "Accelerometers"
 
-config ADIS16203
-	tristate "Analog Devices ADIS16203 Programmable 360 Degrees Inclinometer"
-	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 adis16203 Programmable
-	  360 Degrees Inclinometer.
-
-	  To compile this driver as a module, say M here: the module will be
-	  called adis16203.
-
 config ADIS16240
 	tristate "Analog Devices ADIS16240 Programmable Impact Sensor and Recorder"
 	depends on SPI
diff --git a/drivers/staging/iio/accel/Makefile b/drivers/staging/iio/accel/Makefile
index 094cc9be35bd..b0beec471814 100644
--- a/drivers/staging/iio/accel/Makefile
+++ b/drivers/staging/iio/accel/Makefile
@@ -3,5 +3,4 @@
 # Makefile for industrial I/O accelerometer drivers
 #
 
-obj-$(CONFIG_ADIS16203) += adis16203.o
 obj-$(CONFIG_ADIS16240) += adis16240.o
-- 
2.39.1


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

* [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer
  2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
                   ` (10 preceding siblings ...)
  2023-01-23 21:17 ` [PATCH 11/12] staging: iio: accel: adis16203: Move out of staging Jonathan Cameron
@ 2023-01-23 21:17 ` Jonathan Cameron
  2023-01-24  1:22   ` Rob Herring
  2023-01-24  8:39   ` Krzysztof Kozlowski
  11 siblings, 2 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-23 21:17 UTC (permalink / raw)
  To: linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

There has been a driver in staging for quite a while.
Given we are now moving it to the main tree, time to make sure it
has binding documentation.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 .../bindings/iio/accel/adi,adis16203.yaml     | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml b/Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml
new file mode 100644
index 000000000000..05c095247e10
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/accel/adi,adis16203.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ADIS16203 Programmable 360 degree inclinometer
+
+maintainers:
+  - Jonathan Cameron <Jonathan.Cameron@huawei.com>
+
+properties:
+  compatible:
+    const: adi,adis16203
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 2
+
+  interrupt-names:
+    description:
+      Device has two configurable outputs, both of which may be used
+      as interrupt sources.
+    enum:
+      - dio0
+      - dio1
+
+  reset-gpios: true
+
+  vdd-supply: true
+
+required:
+  - compatible
+  - reg
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        accelerometer@0 {
+            compatible = "adi,adis16201";
+            reg = <0>;
+            spi-max-frequency = <2500000>;
+            interrupt-parent = <&gpio0>;
+            interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+            interrupt-names = "dio0";
+        };
+    };
+...
+
-- 
2.39.1


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

* Re: [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer
  2023-01-23 21:17 ` [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer Jonathan Cameron
@ 2023-01-24  1:22   ` Rob Herring
  2023-01-24  8:39   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 18+ messages in thread
From: Rob Herring @ 2023-01-24  1:22 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Jonathan Cameron, Krzysztof Kozlowski, devicetree,
	Rob Herring, Michael Hennerich, Lars-Peter Clausen, Barry Song


On Mon, 23 Jan 2023 21:17:58 +0000, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> There has been a driver in staging for quite a while.
> Given we are now moving it to the main tree, time to make sure it
> has binding documentation.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  .../bindings/iio/accel/adi,adis16203.yaml     | 59 +++++++++++++++++++
>  1 file changed, 59 insertions(+)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/accel/adi,adis16203.example.dtb: accelerometer@0: Unevaluated properties are not allowed ('interrupt-names' was unexpected)
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/accel/adi,adis16201.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230123211758.563383-13-jic23@kernel.org

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


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

* Re: [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer
  2023-01-23 21:17 ` [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer Jonathan Cameron
  2023-01-24  1:22   ` Rob Herring
@ 2023-01-24  8:39   ` Krzysztof Kozlowski
  2023-01-24  9:43     ` Jonathan Cameron
  1 sibling, 1 reply; 18+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-24  8:39 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, devicetree
  Cc: Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, Barry Song

On 23/01/2023 22:17, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> There has been a driver in staging for quite a while.
> Given we are now moving it to the main tree, time to make sure it
> has binding documentation.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  .../bindings/iio/accel/adi,adis16203.yaml     | 59 +++++++++++++++++++
>  1 file changed, 59 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml b/Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml
> new file mode 100644
> index 000000000000..05c095247e10
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml
> @@ -0,0 +1,59 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/accel/adi,adis16203.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: ADIS16203 Programmable 360 degree inclinometer
> +
> +maintainers:
> +  - Jonathan Cameron <Jonathan.Cameron@huawei.com>
> +
> +properties:
> +  compatible:
> +    const: adi,adis16203
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 2
> +
> +  interrupt-names:

maxItems (and probably minItems)

> +    description:
> +      Device has two configurable outputs, both of which may be used
> +      as interrupt sources.
> +    enum:

This won't work. It's an list. You need:
items:
  enum:
     .....

> +      - dio0
> +      - dio1
> +
> +  reset-gpios: true

maxItems: 1


> +
> +  vdd-supply: true
> +
> +required:
> +  - compatible
> +  - reg
> +
> +allOf:
> +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        accelerometer@0 {
> +            compatible = "adi,adis16201";
> +            reg = <0>;
> +            spi-max-frequency = <2500000>;
> +            interrupt-parent = <&gpio0>;
> +            interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
> +            interrupt-names = "dio0";

You require here two items, according to interrupts. Don't you miss
minItems?

Also... if you tested the binding it would complain here.

> +        };
> +    };
> +...
> +

Best regards,
Krzysztof


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

* Re: [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer
  2023-01-24  8:39   ` Krzysztof Kozlowski
@ 2023-01-24  9:43     ` Jonathan Cameron
  2023-02-01  9:29       ` Linus Walleij
  0 siblings, 1 reply; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-24  9:43 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, linux-iio, devicetree, Rob Herring,
	Krzysztof Kozlowski, Lars-Peter Clausen, Michael Hennerich,
	Barry Song

On Tue, 24 Jan 2023 09:39:10 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> On 23/01/2023 22:17, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > There has been a driver in staging for quite a while.
> > Given we are now moving it to the main tree, time to make sure it
> > has binding documentation.
> > 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > ---
> >  .../bindings/iio/accel/adi,adis16203.yaml     | 59 +++++++++++++++++++
> >  1 file changed, 59 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml b/Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml
> > new file mode 100644
> > index 000000000000..05c095247e10
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/accel/adi,adis16203.yaml
> > @@ -0,0 +1,59 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/accel/adi,adis16203.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: ADIS16203 Programmable 360 degree inclinometer
> > +
> > +maintainers:
> > +  - Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > +
> > +properties:
> > +  compatible:
> > +    const: adi,adis16203
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 2
> > +
> > +  interrupt-names:  
> 
> maxItems (and probably minItems
> 
> > +    description:
> > +      Device has two configurable outputs, both of which may be used
> > +      as interrupt sources.
> > +    enum:  
> 
> This won't work. It's an list. You need:
> items:
>   enum:
>      .....

Gah. I'm still rubbish at writing these things. I guess I just
don't do them often enough.

> 
> > +      - dio0
> > +      - dio1
> > +
> > +  reset-gpios: true  
> 
> maxItems: 1
> 
> 
> > +
> > +  vdd-supply: true
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +allOf:
> > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/irq.h>
> > +    spi {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +        accelerometer@0 {
> > +            compatible = "adi,adis16201";
> > +            reg = <0>;
> > +            spi-max-frequency = <2500000>;
> > +            interrupt-parent = <&gpio0>;
> > +            interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
> > +            interrupt-names = "dio0";  
> 
> You require here two items, according to interrupts. Don't you miss
> minItems?

Indeed.

> 
> Also... if you tested the binding it would complain here.

I thought I had tested it (and fixed a few issues that showed up).
I guess something went wrong with with the final test.  Will investigate.

Thanks and sorry for the waste of time with the silly errors!

Jonathan


> 
> > +        };
> > +    };
> > +...
> > +  
> 
> Best regards,
> Krzysztof
> 


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

* Re: [PATCH 11/12] staging: iio: accel: adis16203: Move out of staging
  2023-01-23 21:17 ` [PATCH 11/12] staging: iio: accel: adis16203: Move out of staging Jonathan Cameron
@ 2023-01-24  9:44   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2023-01-24  9:44 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, devicetree, Rob Herring, Krzysztof Kozlowski,
	Lars-Peter Clausen, Michael Hennerich, Barry Song

On Mon, 23 Jan 2023 21:17:57 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> The main blocker of this driver moving previously was non standard
> ABI for the 180 degree offset channel. Now support for that channel
> has been dropped, this simple driver can move out of staging.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
I forgot my own rules of posting graduations with move detection turned off.
I'm going to be doing a v2 anyway to fix the issues Rob's bot and
Krysztof pointed out in the binding so will hopefully remember to
turn move detection off for that.

> ---
>  drivers/iio/accel/Kconfig                   | 12 ++++++++++++
>  drivers/iio/accel/Makefile                  |  1 +
>  drivers/{staging => }/iio/accel/adis16203.c |  0
>  drivers/staging/iio/accel/Kconfig           | 12 ------------
>  drivers/staging/iio/accel/Makefile          |  1 -
>  5 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> index b6b45d359f28..88d4b18bd5e8 100644
> --- a/drivers/iio/accel/Kconfig
> +++ b/drivers/iio/accel/Kconfig
> @@ -18,6 +18,18 @@ config ADIS16201
>  	  To compile this driver as a module, say M here: the module will
>  	  be called adis16201.
>  
> +config ADIS16203
> +	tristate "Analog Devices ADIS16203 Programmable 360 Degrees Inclinometer"
> +	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 adis16203 Programmable
> +	  360 Degrees Inclinometer.
> +
> +	  To compile this driver as a module, say M here: the module will be
> +	  called adis16203.
> +
>  config ADIS16209
>  	tristate "Analog Devices ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer"
>  	depends on SPI
> diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
> index 311ead9c3ef1..b6f0cee52659 100644
> --- a/drivers/iio/accel/Makefile
> +++ b/drivers/iio/accel/Makefile
> @@ -5,6 +5,7 @@
>  
>  # When adding new entries keep the list in alphabetical order
>  obj-$(CONFIG_ADIS16201) += adis16201.o
> +obj-$(CONFIG_ADIS16203) += adis16203.o
>  obj-$(CONFIG_ADIS16209) += adis16209.o
>  obj-$(CONFIG_ADXL313) += adxl313_core.o
>  obj-$(CONFIG_ADXL313_I2C) += adxl313_i2c.o
> diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/iio/accel/adis16203.c
> similarity index 100%
> rename from drivers/staging/iio/accel/adis16203.c
> rename to drivers/iio/accel/adis16203.c
> diff --git a/drivers/staging/iio/accel/Kconfig b/drivers/staging/iio/accel/Kconfig
> index 3318997a7009..3769af8719f3 100644
> --- a/drivers/staging/iio/accel/Kconfig
> +++ b/drivers/staging/iio/accel/Kconfig
> @@ -4,18 +4,6 @@
>  #
>  menu "Accelerometers"
>  
> -config ADIS16203
> -	tristate "Analog Devices ADIS16203 Programmable 360 Degrees Inclinometer"
> -	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 adis16203 Programmable
> -	  360 Degrees Inclinometer.
> -
> -	  To compile this driver as a module, say M here: the module will be
> -	  called adis16203.
> -
>  config ADIS16240
>  	tristate "Analog Devices ADIS16240 Programmable Impact Sensor and Recorder"
>  	depends on SPI
> diff --git a/drivers/staging/iio/accel/Makefile b/drivers/staging/iio/accel/Makefile
> index 094cc9be35bd..b0beec471814 100644
> --- a/drivers/staging/iio/accel/Makefile
> +++ b/drivers/staging/iio/accel/Makefile
> @@ -3,5 +3,4 @@
>  # Makefile for industrial I/O accelerometer drivers
>  #
>  
> -obj-$(CONFIG_ADIS16203) += adis16203.o
>  obj-$(CONFIG_ADIS16240) += adis16240.o


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

* Re: [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer
  2023-01-24  9:43     ` Jonathan Cameron
@ 2023-02-01  9:29       ` Linus Walleij
  0 siblings, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2023-02-01  9:29 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Krzysztof Kozlowski, Jonathan Cameron, linux-iio, devicetree,
	Rob Herring, Krzysztof Kozlowski, Lars-Peter Clausen,
	Michael Hennerich, Barry Song

On Tue, Jan 24, 2023 at 10:43 AM Jonathan Cameron
<Jonathan.Cameron@huawei.com> wrote:

> > This won't work. It's an list. You need:
> > items:
> >   enum:
> >      .....
>
> Gah. I'm still rubbish at writing these things. I guess I just
> don't do them often enough.

No the dtschema YAML is just really hard. Don't beat yourself up about it.

Yours,
Linus Walleij

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

end of thread, other threads:[~2023-02-01  9:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 21:17 [PATCH 00/12] staging: iio: accel: adis16203 Inclinometer cleanup and graduation Jonathan Cameron
2023-01-23 21:17 ` [PATCH 01/12] staging: iio: accel: adis16203: More conventional header ordering Jonathan Cameron
2023-01-23 21:17 ` [PATCH 02/12] staging: iio: accel: adis16203: Drop excessive register comments Jonathan Cameron
2023-01-23 21:17 ` [PATCH 03/12] staging: iio: accel: adis16203: Rename incli channel registers Jonathan Cameron
2023-01-23 21:17 ` [PATCH 04/12] staging: iio: accel: adis16203: Drop the 180 degree offset channel Jonathan Cameron
2023-01-23 21:17 ` [PATCH 05/12] staging: iio: accel: adis16203: Simplify handling of calibbias Jonathan Cameron
2023-01-23 21:17 ` [PATCH 06/12] staging: iio: accel: adis16203: Drop driver name define Jonathan Cameron
2023-01-23 21:17 ` [PATCH 07/12] staging: iio: accel: adis16203: Make units explicit in name of delay define Jonathan Cameron
2023-01-23 21:17 ` [PATCH 08/12] staging: iio: accel: adis16203: Trivial whitespace cleanup Jonathan Cameron
2023-01-23 21:17 ` [PATCH 09/12] staging: iio: accel: adis16203: Drop setting drvdata as nothing gets it Jonathan Cameron
2023-01-23 21:17 ` [PATCH 10/12] staging: iio: accel: adis16203: Trivial style cleanup Jonathan Cameron
2023-01-23 21:17 ` [PATCH 11/12] staging: iio: accel: adis16203: Move out of staging Jonathan Cameron
2023-01-24  9:44   ` Jonathan Cameron
2023-01-23 21:17 ` [PATCH 12/12] dt-bindings: iio: accel: Add ADIS16203 Inclinometer Jonathan Cameron
2023-01-24  1:22   ` Rob Herring
2023-01-24  8:39   ` Krzysztof Kozlowski
2023-01-24  9:43     ` Jonathan Cameron
2023-02-01  9:29       ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.