[PATCH 1/2] iio: dac: ltc2632: add support for LTC2654 DAC family

David Marinović posted 2 patches 4 weeks ago
There is a newer version of this series
[PATCH 1/2] iio: dac: ltc2632: add support for LTC2654 DAC family
Posted by David Marinović 4 weeks ago

Add support for the Linear Technology LTC2654 quad DAC family.
The LTC2654 is a 4-channel, 16-/12-bit DAC with SPI interface,
sharing the same 24-bit SPI protocol as the existing LTC2632/
LTC2634/LTC2636 devices supported by this driver.

Add support for the following variants:
- LTC2654L-16: 16-bit, 2.5V internal reference
- LTC2654L-12: 12-bit, 2.5V internal reference
- LTC2654H-16: 16-bit, 4.096V internal reference
- LTC2654H-12: 12-bit, 4.096V internal reference

Signed-off-by: David Marinovic <david.marinovic@pupin.rs>
---
  drivers/iio/dac/ltc2632.c | 47 ++++++++++++++++++++++++++++++++++++---
  1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/dac/ltc2632.c b/drivers/iio/dac/ltc2632.c
index 105f939f7e54..05d3bf65399f 100644
--- a/drivers/iio/dac/ltc2632.c
+++ b/drivers/iio/dac/ltc2632.c
@@ -67,6 +67,10 @@ enum ltc2632_supported_device_ids {
         ID_LTC2636H12,
         ID_LTC2636H10,
         ID_LTC2636H8,
+       ID_LTC2654L16,
+       ID_LTC2654L12,
+       ID_LTC2654H16,
+       ID_LTC2654H12
  };

  static int ltc2632_spi_write(struct spi_device *spi,
@@ -79,8 +83,8 @@ static int ltc2632_spi_write(struct spi_device *spi,
          * The input shift register is 24 bits wide.
          * The next four are the command bits, C3 to C0,
          * followed by the 4-bit DAC address, A3 to A0, and then the
-        * 12-, 10-, 8-bit data-word. The data-word comprises the 12-,
-        * 10-, 8-bit input code followed by 4, 6, or 8 don't care bits.
+        * 16-, 12-, 10-, 8-bit data-word. The data-word comprises the
+        * 16-, 12-, 10-, 8-bit input code followed by 0, 4, 6, or 8 
don't care bits.
          */
         data = (cmd << 20) | (addr << 16) | (val << shift);
         put_unaligned_be24(data, &msg[0]);
@@ -206,6 +210,7 @@ static const struct iio_chan_spec_ext_info 
ltc2632_ext_info[] = {
                 LTC2632_CHANNEL(7, _bits), \
         }

+static DECLARE_LTC2632_CHANNELS(ltc2632x16, 16);
  static DECLARE_LTC2632_CHANNELS(ltc2632x12, 12);
  static DECLARE_LTC2632_CHANNELS(ltc2632x10, 10);
  static DECLARE_LTC2632_CHANNELS(ltc2632x8, 8);
@@ -301,6 +306,26 @@ static const struct ltc2632_chip_info 
ltc2632_chip_info_tbl[] = {
                 .num_channels   = 8,
                 .vref_mv        = 4096,
         },
+       [ID_LTC2654L16] =  {
+               .channels       = ltc2632x16_channels,
+               .num_channels   = 4,
+               .vref_mv        = 2500,
+       },
+       [ID_LTC2654L12] = {
+               .channels       = ltc2632x12_channels,
+               .num_channels   = 4,
+               .vref_mv        = 2500,
+       },
+       [ID_LTC2654H16] = {
+               .channels       = ltc2632x16_channels,
+               .num_channels   = 4,
+               .vref_mv        = 4096,
+       },
+       [ID_LTC2654H12] =  {
+               .channels       = ltc2632x12_channels,
+               .num_channels   = 4,
+               .vref_mv        = 4096,
+       },
  };

  static int ltc2632_probe(struct spi_device *spi)
@@ -372,6 +397,10 @@ static const struct spi_device_id ltc2632_id[] = {
         { "ltc2636-h12", 
(kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2636H12] },
         { "ltc2636-h10", 
(kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2636H10] },
         { "ltc2636-h8", 
(kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2636H8] },
+       { "ltc2654-l16", 
(kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2654L16] },
+       { "ltc2654-l12", 
(kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2654L12] },
+       { "ltc2654-h16", 
(kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2654H16] },
+       { "ltc2654-h12", 
(kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2654H12] },
         { }
  };
  MODULE_DEVICE_TABLE(spi, ltc2632_id);
@@ -431,6 +460,18 @@ static const struct of_device_id ltc2632_of_match[] 
= {
         }, {
                 .compatible = "lltc,ltc2636-h8",
                 .data = &ltc2632_chip_info_tbl[ID_LTC2636H8]
+       }, {
+               .compatible = "lltc,ltc2654-l16",
+               .data = &ltc2632_chip_info_tbl[ID_LTC2654L16]
+       }, {
+               .compatible = "lltc,ltc2654-l12",
+               .data = &ltc2632_chip_info_tbl[ID_LTC2654L12]
+       }, {
+               .compatible = "lltc,ltc2654-h16",
+               .data = &ltc2632_chip_info_tbl[ID_LTC2654H16]
+       }, {
+               .compatible = "lltc,ltc2654-h12",
+               .data = &ltc2632_chip_info_tbl[ID_LTC2654H12]
         },
         { }
  };
@@ -447,5 +488,5 @@ static struct spi_driver ltc2632_driver = {
  module_spi_driver(ltc2632_driver);

  MODULE_AUTHOR("Maxime Roussin-Belanger 
<maxime.roussinbelanger@gmail.com>");
-MODULE_DESCRIPTION("LTC2632 DAC SPI driver");
+MODULE_DESCRIPTION("LTC2632/LTC2654 DAC SPI driver");
  MODULE_LICENSE("GPL v2");
--
2.50.1




-------- Original Message --------
Subject: [PATCH 0/2] iio: dac: ltc2632: add support for LTC2654 DAC 
family
Date: 10.03.2026 16:27
 From: David Marinović <david.marinovic@pupin.rs>
To: jic23@kernel.org

This patch series adds support for the Linear Technology LTC2654
quad DAC family to the existing ltc2632 driver.

The LTC2654 shares the same 24-bit SPI protocol as the existing
LTC2632/2634/2636 devices, requiring minimal additions to the
driver.

The LTC2654L-16 variant has been tested on a Phytec phyCORE-STM32MP1
board with the DAC connected via SPI1. The driver probes successfully
and all 4 channels are accessible via the IIO sysfs interface.

Patch 1 adds the driver support.
Patch 2 updates the DT bindings documentation.

David Marinovic (2):
   iio: dac: ltc2632: add support for LTC2654 DAC family
   dt-bindings: iio: dac: ltc2632: add LTC2654 compatible strings

Signed-off-by: David Marinovic <david.marinovic@pupin.rs>
Re: [PATCH 1/2] iio: dac: ltc2632: add support for LTC2654 DAC family
Posted by Andy Shevchenko 3 weeks, 6 days ago
On Tue, Mar 10, 2026 at 04:29:48PM +0100, David Marinović wrote:
> 
> Add support for the Linear Technology LTC2654 quad DAC family.
> The LTC2654 is a 4-channel, 16-/12-bit DAC with SPI interface,
> sharing the same 24-bit SPI protocol as the existing LTC2632/
> LTC2634/LTC2636 devices supported by this driver.
> 
> Add support for the following variants:
> - LTC2654L-16: 16-bit, 2.5V internal reference
> - LTC2654L-12: 12-bit, 2.5V internal reference
> - LTC2654H-16: 16-bit, 4.096V internal reference
> - LTC2654H-12: 12-bit, 4.096V internal reference

...

> enum ltc2632_supported_device_ids {

>         ID_LTC2636H12,
>         ID_LTC2636H10,
>         ID_LTC2636H8,
> +       ID_LTC2654L16,
> +       ID_LTC2654L12,
> +       ID_LTC2654H16,
> +       ID_LTC2654H12

You see how nicely the new IDs landed here, but after you it will require an
unneeded churn.

>  };

...

> static const struct spi_device_id ltc2632_id[] = {

>         { "ltc2636-h12",
> (kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2636H12] },
>         { "ltc2636-h10",
> (kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2636H10] },
>         { "ltc2636-h8", (kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2636H8]
> },
> +       { "ltc2654-l16",
> (kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2654L16] },
> +       { "ltc2654-l12",
> (kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2654L12] },
> +       { "ltc2654-h16",
> (kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2654H16] },
> +       { "ltc2654-h12",
> (kernel_ulong_t)&ltc2632_chip_info_tbl[ID_LTC2654H12] },
>         { }

Can we have a refactor patch to drop that enum and use separate chip_info
static objects?

>  };

...

> static const struct of_device_id ltc2632_of_match[] = {

>         }, {
>                 .compatible = "lltc,ltc2636-h8",
>                 .data = &ltc2632_chip_info_tbl[ID_LTC2636H8]
> +       }, {
> +               .compatible = "lltc,ltc2654-l16",
> +               .data = &ltc2632_chip_info_tbl[ID_LTC2654L16]
> +       }, {
> +               .compatible = "lltc,ltc2654-l12",
> +               .data = &ltc2632_chip_info_tbl[ID_LTC2654L12]
> +       }, {
> +               .compatible = "lltc,ltc2654-h16",
> +               .data = &ltc2632_chip_info_tbl[ID_LTC2654H16]
> +       }, {
> +               .compatible = "lltc,ltc2654-h12",
> +               .data = &ltc2632_chip_info_tbl[ID_LTC2654H12]
>         },

Ditto.

>         { }
>  };

...

> Subject: [PATCH 0/2] iio: dac: ltc2632: add support for LTC2654 DAC family
> Date: 10.03.2026 16:27
> From: David Marinović <david.marinovic@pupin.rs>
> To: jic23@kernel.org
> 
> This patch series adds support for the Linear Technology LTC2654
> quad DAC family to the existing ltc2632 driver.

Huh?!

-- 
With Best Regards,
Andy Shevchenko