[PATCH v2 4/4] iio: adc: ltc2309: Add LTC2305 support

Carlos Jones Jr posted 4 patches 1 week, 5 days ago
[PATCH v2 4/4] iio: adc: ltc2309: Add LTC2305 support
Posted by Carlos Jones Jr 1 week, 5 days ago
Add support for the LTC2305, a 2-channel, 12-bit SAR ADC that shares
the same I2C interface as the LTC2309.

The LTC2305 differs from the LTC2309 in:
- Channel configuration: 2 single-ended + 2 differential vs 8
  single-ended + 8 differential
- Read timing: Requires 2μs delay (1.6μs rounded up)
  between I2C write and read operations

Device tree binding added in previous commit.

Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com>
---
 drivers/iio/adc/Kconfig   |  8 +++++---
 drivers/iio/adc/ltc2309.c | 25 +++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index a9dedbb8eb46..860c0909dbbb 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -915,11 +915,13 @@ config LPC32XX_ADC
 	  via sysfs.
 
 config LTC2309
-	tristate "Linear Technology LTC2309 ADC driver"
+	tristate "Linear Technology LTC2309 and similar ADC driver"
 	depends on I2C
 	help
-	  Say yes here to build support for Linear Technology LTC2309, a low
-	  noise, low power, 8-channel, 12-bit SAR ADC
+	  Say yes here to build support for Linear Technology low noise,
+	  low power 12-bit SAR ADCs:
+	  - LTC2305 - 2-channel
+	  - LTC2309 - 8-channel
 
 	  This driver can also be built as a module. If so, the module will
 	  be called ltc2309.
diff --git a/drivers/iio/adc/ltc2309.c b/drivers/iio/adc/ltc2309.c
index 475ecc21ebe9..d7ec4d92a96c 100644
--- a/drivers/iio/adc/ltc2309.c
+++ b/drivers/iio/adc/ltc2309.c
@@ -1,9 +1,14 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * The LTC2309 is an 8-Channel, 12-Bit SAR ADC with an I2C Interface.
+ * Low noise, low power 12-Bit SAR ADC with an I2C Interface.
+ *
+ * Supported devices:
+ * LTC2305 - 2-channel
+ * LTC2309 - 8-channel
  *
  * Datasheet:
  * https://www.analog.com/media/en/technical-documentation/data-sheets/2309fd.pdf
+ * https://www.analog.com/media/en/technical-documentation/data-sheets/23015fb.pdf
  *
  * Copyright (c) 2023, Liam Beguin <liambeguin@gmail.com>
  */
@@ -110,6 +115,13 @@ static const struct iio_chan_spec ltc2309_channels[] = {
 	LTC2309_DIFF_CHAN(7, 6, LTC2309_CH7_CH6),
 };
 
+static const struct iio_chan_spec ltc2305_channels[] = {
+	LTC2309_CHAN(0, LTC2309_CH0),
+	LTC2309_CHAN(1, LTC2309_CH1),
+	LTC2309_DIFF_CHAN(0, 1, LTC2309_CH0_CH1),
+	LTC2309_DIFF_CHAN(1, 0, LTC2309_CH1_CH0),
+};
+
 static int ltc2309_read_raw_channel(struct ltc2309 *ltc2309,
 				    unsigned long address, int *val)
 {
@@ -170,6 +182,13 @@ static const struct iio_info ltc2309_info = {
 	.read_raw = ltc2309_read_raw,
 };
 
+static const struct ltc2309_chip_info ltc2305_chip_info = {
+	.name = "ltc2305",
+	.num_channels = ARRAY_SIZE(ltc2305_channels),
+	.channels = ltc2305_channels,
+	.read_delay_us = 2,
+};
+
 static const struct ltc2309_chip_info ltc2309_chip_info = {
 	.name = "ltc2309",
 	.num_channels = ARRAY_SIZE(ltc2309_channels),
@@ -213,12 +232,14 @@ static int ltc2309_probe(struct i2c_client *client)
 }
 
 static const struct of_device_id ltc2309_of_match[] = {
+	{ .compatible = "lltc,ltc2305", .data = &ltc2305_chip_info },
 	{ .compatible = "lltc,ltc2309", .data = &ltc2309_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, ltc2309_of_match);
 
 static const struct i2c_device_id ltc2309_id[] = {
+	{ "ltc2305", (kernel_ulong_t)&ltc2305_chip_info },
 	{ "ltc2309", (kernel_ulong_t)&ltc2309_chip_info },
 	{ }
 };
@@ -235,5 +256,5 @@ static struct i2c_driver ltc2309_driver = {
 module_i2c_driver(ltc2309_driver);
 
 MODULE_AUTHOR("Liam Beguin <liambeguin@gmail.com>");
-MODULE_DESCRIPTION("Linear Technology LTC2309 ADC");
+MODULE_DESCRIPTION("Linear Technology LTC2305/LTC2309 ADC driver");
 MODULE_LICENSE("GPL v2");
-- 
2.43.0

Re: [PATCH v2 4/4] iio: adc: ltc2309: Add LTC2305 support
Posted by Andy Shevchenko 1 week, 5 days ago
On Tue, Mar 24, 2026 at 03:13:31PM +0800, Carlos Jones Jr wrote:
> Add support for the LTC2305, a 2-channel, 12-bit SAR ADC that shares
> the same I2C interface as the LTC2309.
> 
> The LTC2305 differs from the LTC2309 in:
> - Channel configuration: 2 single-ended + 2 differential vs 8
>   single-ended + 8 differential
> - Read timing: Requires 2μs delay (1.6μs rounded up)
>   between I2C write and read operations
> 
> Device tree binding added in previous commit.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

-- 
With Best Regards,
Andy Shevchenko