[PATCH v7 5/7] iio: adc: mcp3911: Add support for spi-device-addr

Janani Sunil <[email protected]> Wed, 22 Jul 2026 09:54:17 +0200
Newsgroups org.kernel.vger.linux-spi,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-doc,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Read the generic spi-device-addr property when determining the hardware
device address. Fall back to the deprecated microchip,device-addr
property and then to the historical device-addr property to preserve
compatibility with existing devicetrees.

The device address remains 0 when none of the properties are present.

Signed-off-by: Janani Sunil <[email protected]>
---
 drivers/iio/adc/mcp3911.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
index ddc3721f3f68..3919a326b4db 100644
--- a/drivers/iio/adc/mcp3911.c
+++ b/drivers/iio/adc/mcp3911.c
@@ -740,10 +740,13 @@ static int mcp3911_probe(struct spi_device *spi)
 	}
 
 	/*
-	 * Fallback to "device-addr" due to historical mismatch between
-	 * dt-bindings and implementation.
+	 * Fall back to the vendor-specific property, then to "device-addr"
+	 * due to a historical mismatch between the binding and implementation.
 	 */
-	ret = device_property_read_u32(dev, "microchip,device-addr", &adc->dev_addr);
+	ret = device_property_read_u32(dev, "spi-device-addr", &adc->dev_addr);
+	if (ret)
+		ret = device_property_read_u32(dev, "microchip,device-addr",
+					       &adc->dev_addr);
 	if (ret)
 		device_property_read_u32(dev, "device-addr", &adc->dev_addr);
 	if (adc->dev_addr > 3) {

-- 
2.43.0