[PATCH v3 3/3] iio: dac: ltc2632: add support for LTC2654 DAC family

David Marinović posted 3 patches 2 weeks ago
[PATCH v3 3/3] iio: dac: ltc2632: add support for LTC2654 DAC family
Posted by David Marinović 2 weeks ago
From: David Marinovic <david.marinovic@pupin.rs>

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.

The 12-bit variants of LTC2654 reuse existing LTC2634 chip_info
structs as they are register-compatible.

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 | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/dac/ltc2632.c b/drivers/iio/dac/ltc2632.c
index ca0b88285ce5..33b8ff78c6e3 100644
--- a/drivers/iio/dac/ltc2632.c
+++ b/drivers/iio/dac/ltc2632.c
@@ -58,8 +58,9 @@ 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]);
@@ -185,6 +186,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);
@@ -297,6 +299,18 @@ static const struct ltc2632_chip_info ltc2636h8_chip_info = {
 	.vref_mv	= 4096,
 };
 
+static const struct ltc2632_chip_info ltc2654l16_chip_info = {
+	.channels	= ltc2632x16_channels,
+	.num_channels	= 4,
+	.vref_mv	= 2500,
+};
+
+static const struct ltc2632_chip_info ltc2654h16_chip_info = {
+	.channels	= ltc2632x16_channels,
+	.num_channels	= 4,
+	.vref_mv	= 4096,
+};
+
 static int ltc2632_probe(struct spi_device *spi)
 {
 	struct ltc2632_state *st;
@@ -366,6 +380,10 @@ static const struct spi_device_id ltc2632_id[] = {
 	{ "ltc2636-h12", (kernel_ulong_t)&ltc2636h12_chip_info },
 	{ "ltc2636-h10", (kernel_ulong_t)&ltc2636h10_chip_info },
 	{ "ltc2636-h8",  (kernel_ulong_t)&ltc2636h8_chip_info  },
+	{ "ltc2654-l16", (kernel_ulong_t)&ltc2654l16_chip_info },
+	{ "ltc2654-l12", (kernel_ulong_t)&ltc2634l12_chip_info },
+	{ "ltc2654-h16", (kernel_ulong_t)&ltc2654h16_chip_info },
+	{ "ltc2654-h12", (kernel_ulong_t)&ltc2634h12_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(spi, ltc2632_id);
@@ -389,6 +407,8 @@ static const struct of_device_id ltc2632_of_match[] = {
 	{ .compatible = "lltc,ltc2636-h12", .data = &ltc2636h12_chip_info },
 	{ .compatible = "lltc,ltc2636-h10", .data = &ltc2636h10_chip_info },
 	{ .compatible = "lltc,ltc2636-h8",  .data = &ltc2636h8_chip_info  },
+	{ .compatible = "lltc,ltc2654-l16", .data = &ltc2654l16_chip_info },
+	{ .compatible = "lltc,ltc2654-h16", .data = &ltc2654h16_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, ltc2632_of_match);
@@ -404,5 +424,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
Re: [PATCH v3 3/3] iio: dac: ltc2632: add support for LTC2654 DAC family
Posted by Jonathan Cameron 1 week, 6 days ago
On Fri, 20 Mar 2026 16:09:48 +0100
David Marinović <david.marinovic@pupin.rs> wrote:

> From: David Marinovic <david.marinovic@pupin.rs>
> 
> 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.
> 
> The 12-bit variants of LTC2654 reuse existing LTC2634 chip_info
> structs as they are register-compatible.
> 
> 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>


>  MODULE_DEVICE_TABLE(of, ltc2632_of_match);
> @@ -404,5 +424,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");
I'm going to tweak this to 
		  "LTC2632 and similar DAC SPI driver" because there are already
other parts not listed here.  E.g. LTC2634 parts

>  MODULE_LICENSE("GPL v2");