public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] iio: adc: ltc2309: add support driver for ltc2305
@ 2026-01-26  1:29 Kyle Hsieh
  2026-01-26  1:29 ` [PATCH v3 1/2] dt-bindings: adc: ltc2497: add support " Kyle Hsieh
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kyle Hsieh @ 2026-01-26  1:29 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Liam Beguin
  Cc: Michael Hennerich, linux-iio, devicetree, linux-kernel,
	Kyle Hsieh

The series add support for ltc2305 controller from 
Linear Technology Corporation(lltc).
This is low noise, low power, 2 channels 12-bit successive
approximation ADCs.

Signed-off-by: Kyle Hsieh <kylehsieh1995@gmail.com>
---
Changes in v3:
- Modify ltc2305 channel mask to compatible ltc2309.
- Link to v2: https://lore.kernel.org/r/20251224-add_ltc2305_driver-v2-0-061f78cf45a3@gmail.com

Changes in v2:
- Reordered chip descriptions and code from low to high order.
- Renamed chip info structure to use ltc2309 driver prefix.
- Switched to i2c_get_match_data().
- Removed unused variables.
- Added chip info to i2c_device_id table.
- Link to v1: https://lore.kernel.org/r/20251223-add_ltc2305_driver-v1-0-dfa0827fd620@gmail.com

---
Kyle Hsieh (2):
      dt-bindings: adc: ltc2497: add support for ltc2305
      iio: adc: ltc2309: add support for ltc2305

 .../devicetree/bindings/iio/adc/lltc,ltc2497.yaml  |  7 ++++
 drivers/iio/adc/ltc2309.c                          | 48 +++++++++++++++++++---
 2 files changed, 50 insertions(+), 5 deletions(-)
---
base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578
change-id: 20251223-add_ltc2305_driver-728fa9161bc7

Best regards,
-- 
Kyle Hsieh <kylehsieh1995@gmail.com>


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

* [PATCH v3 1/2] dt-bindings: adc: ltc2497: add support for ltc2305
  2026-01-26  1:29 [PATCH v3 0/2] iio: adc: ltc2309: add support driver for ltc2305 Kyle Hsieh
@ 2026-01-26  1:29 ` Kyle Hsieh
  2026-01-29 17:25   ` Rob Herring (Arm)
  2026-01-26  1:29 ` [PATCH v3 2/2] iio: adc: ltc2309: " Kyle Hsieh
  2026-01-26 10:18 ` [PATCH v3 0/2] iio: adc: ltc2309: add support driver " Andy Shevchenko
  2 siblings, 1 reply; 7+ messages in thread
From: Kyle Hsieh @ 2026-01-26  1:29 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Liam Beguin
  Cc: Michael Hennerich, linux-iio, devicetree, linux-kernel,
	Kyle Hsieh

Add documentation for the 2-channel LTC2305 ADC in the
existing ltc2497 binding.
This enables automatic device tree matching for LTC2305
while using the LTC2309 driver (drivers/iio/adc/ltc2309.c),
since both ADCs share the same I2C interface and 12-bit SAR architecture.
The main difference is the number of channels (LTC2305: 2, LTC2309: 8).

Signed-off-by: Kyle Hsieh <kylehsieh1995@gmail.com>
---
 Documentation/devicetree/bindings/iio/adc/lltc,ltc2497.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/lltc,ltc2497.yaml b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2497.yaml
index 5cc6a9684077..c884b6e03767 100644
--- a/Documentation/devicetree/bindings/iio/adc/lltc,ltc2497.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2497.yaml
@@ -11,6 +11,12 @@ maintainers:
   - Liam Beguin <liambeguin@gmail.com>
 
 description: |
+  LTC2305:
+    low noise, low power, 2-channel, 12-bit successive approximation ADC with an
+    I2C compatible serial interface.
+
+    https://www.analog.com/media/en/technical-documentation/data-sheets/23015fb.pdf
+
   LTC2309:
     low noise, low power, 8-channel, 12-bit successive approximation ADC with an
     I2C compatible serial interface.
@@ -28,6 +34,7 @@ description: |
 properties:
   compatible:
     enum:
+      - lltc,ltc2305
       - lltc,ltc2309
       - lltc,ltc2497
       - lltc,ltc2499

-- 
2.34.1


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

* [PATCH v3 2/2] iio: adc: ltc2309: add support for ltc2305
  2026-01-26  1:29 [PATCH v3 0/2] iio: adc: ltc2309: add support driver for ltc2305 Kyle Hsieh
  2026-01-26  1:29 ` [PATCH v3 1/2] dt-bindings: adc: ltc2497: add support " Kyle Hsieh
@ 2026-01-26  1:29 ` Kyle Hsieh
  2026-01-26  6:22   ` kernel test robot
  2026-01-26 10:18 ` [PATCH v3 0/2] iio: adc: ltc2309: add support driver " Andy Shevchenko
  2 siblings, 1 reply; 7+ messages in thread
From: Kyle Hsieh @ 2026-01-26  1:29 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Liam Beguin
  Cc: Michael Hennerich, linux-iio, devicetree, linux-kernel,
	Kyle Hsieh

Add support for the 2-channel LTC2305 ADC in the existing LTC2309 driver.
The LTC2305 and LTC2309 share similar features: both are 12-bit,
low-noise, low-power SAR ADCs with an I2C interface.
The main difference is the number of channels: LTC2305 has 2 channels,
while LTC2309 has 8 channels.

Signed-off-by: Kyle Hsieh <kylehsieh1995@gmail.com>
---
 drivers/iio/adc/ltc2309.c | 48 ++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 43 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/ltc2309.c b/drivers/iio/adc/ltc2309.c
index 5f0d947d0615..25acf7f5331a 100644
--- a/drivers/iio/adc/ltc2309.c
+++ b/drivers/iio/adc/ltc2309.c
@@ -1,8 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
+ * The LTC2305 is a  2-Channel, 12-Bit SAR ADC with an I2C Interface.
  * The LTC2309 is an 8-Channel, 12-Bit SAR ADC with an I2C Interface.
  *
  * Datasheet:
+ * https://www.analog.com/media/en/technical-documentation/data-sheets/23015fb.pdf
  * https://www.analog.com/media/en/technical-documentation/data-sheets/2309fd.pdf
  *
  * Copyright (c) 2023, Liam Beguin <liambeguin@gmail.com>
@@ -41,6 +43,13 @@ struct ltc2309 {
 };
 
 /* Order matches expected channel address, See datasheet Table 1. */
+enum ltc2305_channels {
+	LTC2305_CH0_CH1 = 0x0,
+	LTC2305_CH1_CH0 = 0x4,
+	LTC2305_CH0     = 0x8,
+	LTC2305_CH1     = 0xc,
+};
+
 enum ltc2309_channels {
 	LTC2309_CH0_CH1 = 0,
 	LTC2309_CH2_CH3,
@@ -80,6 +89,13 @@ enum ltc2309_channels {
 	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),	\
 }
 
+static const struct iio_chan_spec ltc2305_channels[] = {
+	LTC2309_CHAN(0, LTC2305_CH0),
+	LTC2309_CHAN(1, LTC2305_CH1),
+	LTC2309_DIFF_CHAN(0, 1, LTC2305_CH0_CH1),
+	LTC2309_DIFF_CHAN(1, 0, LTC2305_CH1_CH0),
+};
+
 static const struct iio_chan_spec ltc2309_channels[] = {
 	LTC2309_CHAN(0, LTC2309_CH0),
 	LTC2309_CHAN(1, LTC2309_CH1),
@@ -99,6 +115,24 @@ static const struct iio_chan_spec ltc2309_channels[] = {
 	LTC2309_DIFF_CHAN(7, 6, LTC2309_CH7_CH6),
 };
 
+struct ltc2309_chip_info {
+	const char *name;
+	const struct iio_chan_spec *channels;
+	int num_channels;
+};
+
+static const struct ltc2309_chip_info ltc2305_chip_info = {
+	.name = "ltc2305",
+	.channels = ltc2305_channels,
+	.num_channels = ARRAY_SIZE(ltc2305_channels),
+};
+
+static const struct ltc2309_chip_info ltc2309_chip_info = {
+	.name = "ltc2309",
+	.channels = ltc2309_channels,
+	.num_channels = ARRAY_SIZE(ltc2309_channels),
+};
+
 static int ltc2309_read_raw_channel(struct ltc2309 *ltc2309,
 				    unsigned long address, int *val)
 {
@@ -158,6 +192,7 @@ static const struct iio_info ltc2309_info = {
 
 static int ltc2309_probe(struct i2c_client *client)
 {
+	const struct ltc2309_chip_info *chip_info;
 	struct iio_dev *indio_dev;
 	struct ltc2309 *ltc2309;
 	int ret;
@@ -167,13 +202,14 @@ static int ltc2309_probe(struct i2c_client *client)
 		return -ENOMEM;
 
 	ltc2309 = iio_priv(indio_dev);
+
 	ltc2309->dev = &indio_dev->dev;
 	ltc2309->client = client;
 
-	indio_dev->name = "ltc2309";
+	indio_dev->name = chip_info->name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
-	indio_dev->channels = ltc2309_channels;
-	indio_dev->num_channels = ARRAY_SIZE(ltc2309_channels);
+	indio_dev->channels = chip_info->channels;
+	indio_dev->num_channels = chip_info->num_channels;
 	indio_dev->info = &ltc2309_info;
 
 	ret = devm_regulator_get_enable_read_voltage(&client->dev, "vref");
@@ -189,13 +225,15 @@ static int ltc2309_probe(struct i2c_client *client)
 }
 
 static const struct of_device_id ltc2309_of_match[] = {
-	{ .compatible = "lltc,ltc2309" },
+	{ .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[] = {
-	{ "ltc2309" },
+	{ "ltc2305", (kernel_ulong_t)&ltc2305_chip_info },
+	{ "ltc2309", (kernel_ulong_t)&ltc2309_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, ltc2309_id);

-- 
2.34.1


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

* Re: [PATCH v3 2/2] iio: adc: ltc2309: add support for ltc2305
  2026-01-26  1:29 ` [PATCH v3 2/2] iio: adc: ltc2309: " Kyle Hsieh
@ 2026-01-26  6:22   ` kernel test robot
  2026-01-26 10:18     ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: kernel test robot @ 2026-01-26  6:22 UTC (permalink / raw)
  To: Kyle Hsieh, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Liam Beguin
  Cc: llvm, oe-kbuild-all, linux-iio, devicetree, linux-kernel,
	Kyle Hsieh

Hi Kyle,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 9448598b22c50c8a5bb77a9103e2d49f134c9578]

url:    https://github.com/intel-lab-lkp/linux/commits/Kyle-Hsieh/dt-bindings-adc-ltc2497-add-support-for-ltc2305/20260126-093339
base:   9448598b22c50c8a5bb77a9103e2d49f134c9578
patch link:    https://lore.kernel.org/r/20260126-add_ltc2305_driver-v3-2-951349a87f97%40gmail.com
patch subject: [PATCH v3 2/2] iio: adc: ltc2309: add support for ltc2305
config: i386-buildonly-randconfig-006-20260126 (https://download.01.org/0day-ci/archive/20260126/202601261441.M4qQzY72-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260126/202601261441.M4qQzY72-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601261441.M4qQzY72-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/iio/adc/ltc2309.c:209:20: warning: variable 'chip_info' is uninitialized when used here [-Wuninitialized]
     209 |         indio_dev->name = chip_info->name;
         |                           ^~~~~~~~~
   drivers/iio/adc/ltc2309.c:195:43: note: initialize the variable 'chip_info' to silence this warning
     195 |         const struct ltc2309_chip_info *chip_info;
         |                                                  ^
         |                                                   = NULL
   1 warning generated.


vim +/chip_info +209 drivers/iio/adc/ltc2309.c

   192	
   193	static int ltc2309_probe(struct i2c_client *client)
   194	{
   195		const struct ltc2309_chip_info *chip_info;
   196		struct iio_dev *indio_dev;
   197		struct ltc2309 *ltc2309;
   198		int ret;
   199	
   200		indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*ltc2309));
   201		if (!indio_dev)
   202			return -ENOMEM;
   203	
   204		ltc2309 = iio_priv(indio_dev);
   205	
   206		ltc2309->dev = &indio_dev->dev;
   207		ltc2309->client = client;
   208	
 > 209		indio_dev->name = chip_info->name;
   210		indio_dev->modes = INDIO_DIRECT_MODE;
   211		indio_dev->channels = chip_info->channels;
   212		indio_dev->num_channels = chip_info->num_channels;
   213		indio_dev->info = &ltc2309_info;
   214	
   215		ret = devm_regulator_get_enable_read_voltage(&client->dev, "vref");
   216		if (ret < 0 && ret != -ENODEV)
   217			return dev_err_probe(ltc2309->dev, ret,
   218					     "failed to get vref voltage\n");
   219	
   220		ltc2309->vref_mv = ret == -ENODEV ? LTC2309_INTERNAL_REF_MV : ret / 1000;
   221	
   222		mutex_init(&ltc2309->lock);
   223	
   224		return devm_iio_device_register(&client->dev, indio_dev);
   225	}
   226	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v3 2/2] iio: adc: ltc2309: add support for ltc2305
  2026-01-26  6:22   ` kernel test robot
@ 2026-01-26 10:18     ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-01-26 10:18 UTC (permalink / raw)
  To: kernel test robot
  Cc: Kyle Hsieh, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Liam Beguin, llvm,
	oe-kbuild-all, linux-iio, devicetree, linux-kernel

On Mon, Jan 26, 2026 at 02:22:21PM +0800, kernel test robot wrote:
> Hi Kyle,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on 9448598b22c50c8a5bb77a9103e2d49f134c9578]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Kyle-Hsieh/dt-bindings-adc-ltc2497-add-support-for-ltc2305/20260126-093339
> base:   9448598b22c50c8a5bb77a9103e2d49f134c9578
> patch link:    https://lore.kernel.org/r/20260126-add_ltc2305_driver-v3-2-951349a87f97%40gmail.com
> patch subject: [PATCH v3 2/2] iio: adc: ltc2309: add support for ltc2305
> config: i386-buildonly-randconfig-006-20260126 (https://download.01.org/0day-ci/archive/20260126/202601261441.M4qQzY72-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260126/202601261441.M4qQzY72-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202601261441.M4qQzY72-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> drivers/iio/adc/ltc2309.c:209:20: warning: variable 'chip_info' is uninitialized when used here [-Wuninitialized]
>      209 |         indio_dev->name = chip_info->name;
>          |                           ^~~~~~~~~
>    drivers/iio/adc/ltc2309.c:195:43: note: initialize the variable 'chip_info' to silence this warning
>      195 |         const struct ltc2309_chip_info *chip_info;
>          |                                                  ^
>          |                                                   = NULL

This is so wrong advice!

>    1 warning generated.

...

The device_get_match_data() call is missing.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v3 0/2] iio: adc: ltc2309: add support driver for ltc2305
  2026-01-26  1:29 [PATCH v3 0/2] iio: adc: ltc2309: add support driver for ltc2305 Kyle Hsieh
  2026-01-26  1:29 ` [PATCH v3 1/2] dt-bindings: adc: ltc2497: add support " Kyle Hsieh
  2026-01-26  1:29 ` [PATCH v3 2/2] iio: adc: ltc2309: " Kyle Hsieh
@ 2026-01-26 10:18 ` Andy Shevchenko
  2 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-01-26 10:18 UTC (permalink / raw)
  To: Kyle Hsieh
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Liam Beguin, linux-iio,
	devicetree, linux-kernel

On Mon, Jan 26, 2026 at 09:29:40AM +0800, Kyle Hsieh wrote:
> The series add support for ltc2305 controller from 
> Linear Technology Corporation(lltc).
> This is low noise, low power, 2 channels 12-bit successive
> approximation ADCs.

Apparently this has not been ever tested IRL. Please, be sure you have tested
stuff before sending out.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v3 1/2] dt-bindings: adc: ltc2497: add support for ltc2305
  2026-01-26  1:29 ` [PATCH v3 1/2] dt-bindings: adc: ltc2497: add support " Kyle Hsieh
@ 2026-01-29 17:25   ` Rob Herring (Arm)
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring (Arm) @ 2026-01-29 17:25 UTC (permalink / raw)
  To: Kyle Hsieh
  Cc: devicetree, Lars-Peter Clausen, Michael Hennerich, linux-iio,
	Conor Dooley, linux-kernel, Krzysztof Kozlowski, Jonathan Cameron,
	Andy Shevchenko, Michael Hennerich, Nuno Sá, Liam Beguin,
	David Lechner


On Mon, 26 Jan 2026 09:29:41 +0800, Kyle Hsieh wrote:
> Add documentation for the 2-channel LTC2305 ADC in the
> existing ltc2497 binding.
> This enables automatic device tree matching for LTC2305
> while using the LTC2309 driver (drivers/iio/adc/ltc2309.c),
> since both ADCs share the same I2C interface and 12-bit SAR architecture.
> The main difference is the number of channels (LTC2305: 2, LTC2309: 8).
> 
> Signed-off-by: Kyle Hsieh <kylehsieh1995@gmail.com>
> ---
>  Documentation/devicetree/bindings/iio/adc/lltc,ltc2497.yaml | 7 +++++++
>  1 file changed, 7 insertions(+)
> 

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>


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

end of thread, other threads:[~2026-01-29 17:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26  1:29 [PATCH v3 0/2] iio: adc: ltc2309: add support driver for ltc2305 Kyle Hsieh
2026-01-26  1:29 ` [PATCH v3 1/2] dt-bindings: adc: ltc2497: add support " Kyle Hsieh
2026-01-29 17:25   ` Rob Herring (Arm)
2026-01-26  1:29 ` [PATCH v3 2/2] iio: adc: ltc2309: " Kyle Hsieh
2026-01-26  6:22   ` kernel test robot
2026-01-26 10:18     ` Andy Shevchenko
2026-01-26 10:18 ` [PATCH v3 0/2] iio: adc: ltc2309: add support driver " Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox