[PATCH 3/3] iio: adc: ltc2309: add support for LTC2305
From: Carlos Jones Jr
Date: Fri Mar 20 2026 - 10:10:34 EST
The LTC2305 is a 2-channel, 12-bit, fast ADC with an I2C interface,
compatible with the LTC2309 (which has 8 channels).
This patch adds support for the LTC2305 by using the chip_info
structure to handle the different channel configurations between the
two variants. The LTC2305 exposes 2 single-ended channels and 2
differential combinations.
The LTC2305 requires a 1.6μs delay between I2C write and read
operations, which is implemented using chip-specific timing to avoid
affecting existing LTC2309 functionality.
Signed-off-by: Carlos Jones Jr <carlosjr.jones@xxxxxxxxxx>
---
drivers/iio/adc/Kconfig | 6 +++---
drivers/iio/adc/ltc2309.c | 23 +++++++++++++++++++----
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index a9dedbb8eb46..791a1ac594c2 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -915,11 +915,11 @@ 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 LTC2309 and
+ similar low noise, low power SAR ADCs.
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 4ea25873398c..179ccc780219 100644
--- a/drivers/iio/adc/ltc2309.c
+++ b/drivers/iio/adc/ltc2309.c
@@ -108,6 +108,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)
{
@@ -175,6 +182,12 @@ static const struct ltc2309_chip_info ltc2309_chip_info = {
.read_delay_us = 0,
};
+static const struct ltc2309_chip_info ltc2305_chip_info = {
+ .channels = ltc2305_channels,
+ .num_channels = ARRAY_SIZE(ltc2305_channels),
+ .read_delay_us = 2,
+};
+
static int ltc2309_probe(struct i2c_client *client)
{
struct iio_dev *indio_dev;
@@ -188,7 +201,7 @@ static int ltc2309_probe(struct i2c_client *client)
ltc2309 = iio_priv(indio_dev);
ltc2309->dev = &indio_dev->dev;
ltc2309->client = client;
- ltc2309->chip_info = <c2309_chip_info;
+ ltc2309->chip_info = i2c_get_match_data(client);
indio_dev->name = "ltc2309";
indio_dev->modes = INDIO_DIRECT_MODE;
@@ -209,13 +222,15 @@ static int ltc2309_probe(struct i2c_client *client)
}
static const struct of_device_id ltc2309_of_match[] = {
- { .compatible = "lltc,ltc2309" },
+ { .compatible = "lltc,ltc2309", .data = <c2309_chip_info },
+ { .compatible = "lltc,ltc2305", .data = <c2305_chip_info },
{ }
};
MODULE_DEVICE_TABLE(of, ltc2309_of_match);
static const struct i2c_device_id ltc2309_id[] = {
- { "ltc2309" },
+ { "ltc2309", (kernel_ulong_t)<c2309_chip_info },
+ { "ltc2305", (kernel_ulong_t)<c2305_chip_info },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc2309_id);
@@ -231,5 +246,5 @@ static struct i2c_driver ltc2309_driver = {
module_i2c_driver(ltc2309_driver);
MODULE_AUTHOR("Liam Beguin <liambeguin@xxxxxxxxx>");
-MODULE_DESCRIPTION("Linear Technology LTC2309 ADC");
+MODULE_DESCRIPTION("Linear Technology LTC2309 and similar ADC driver");
MODULE_LICENSE("GPL v2");
--
2.43.0