Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: dac: ltc2632: add support for LTC2654 DAC family

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>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Marinovic and committed by
Jonathan Cameron
e163b094 9e5e2c58

+23 -3
+23 -3
drivers/iio/dac/ltc2632.c
··· 58 58 * The input shift register is 24 bits wide. 59 59 * The next four are the command bits, C3 to C0, 60 60 * followed by the 4-bit DAC address, A3 to A0, and then the 61 - * 12-, 10-, 8-bit data-word. The data-word comprises the 12-, 62 - * 10-, 8-bit input code followed by 4, 6, or 8 don't care bits. 61 + * 16-, 12-, 10-, 8-bit data-word. The data-word comprises the 62 + * 16-, 12-, 10-, 8-bit input code followed by 0, 4, 6, or 8 63 + * don't care bits. 63 64 */ 64 65 data = (cmd << 20) | (addr << 16) | (val << shift); 65 66 put_unaligned_be24(data, &msg[0]); ··· 186 185 LTC2632_CHANNEL(7, _bits), \ 187 186 } 188 187 188 + static DECLARE_LTC2632_CHANNELS(ltc2632x16, 16); 189 189 static DECLARE_LTC2632_CHANNELS(ltc2632x12, 12); 190 190 static DECLARE_LTC2632_CHANNELS(ltc2632x10, 10); 191 191 static DECLARE_LTC2632_CHANNELS(ltc2632x8, 8); ··· 299 297 .vref_mv = 4096, 300 298 }; 301 299 300 + static const struct ltc2632_chip_info ltc2654l16_chip_info = { 301 + .channels = ltc2632x16_channels, 302 + .num_channels = 4, 303 + .vref_mv = 2500, 304 + }; 305 + 306 + static const struct ltc2632_chip_info ltc2654h16_chip_info = { 307 + .channels = ltc2632x16_channels, 308 + .num_channels = 4, 309 + .vref_mv = 4096, 310 + }; 311 + 302 312 static int ltc2632_probe(struct spi_device *spi) 303 313 { 304 314 struct ltc2632_state *st; ··· 380 366 { "ltc2636-h12", (kernel_ulong_t)&ltc2636h12_chip_info }, 381 367 { "ltc2636-h10", (kernel_ulong_t)&ltc2636h10_chip_info }, 382 368 { "ltc2636-h8", (kernel_ulong_t)&ltc2636h8_chip_info }, 369 + { "ltc2654-l16", (kernel_ulong_t)&ltc2654l16_chip_info }, 370 + { "ltc2654-l12", (kernel_ulong_t)&ltc2634l12_chip_info }, 371 + { "ltc2654-h16", (kernel_ulong_t)&ltc2654h16_chip_info }, 372 + { "ltc2654-h12", (kernel_ulong_t)&ltc2634h12_chip_info }, 383 373 { } 384 374 }; 385 375 MODULE_DEVICE_TABLE(spi, ltc2632_id); ··· 407 389 { .compatible = "lltc,ltc2636-h12", .data = &ltc2636h12_chip_info }, 408 390 { .compatible = "lltc,ltc2636-h10", .data = &ltc2636h10_chip_info }, 409 391 { .compatible = "lltc,ltc2636-h8", .data = &ltc2636h8_chip_info }, 392 + { .compatible = "lltc,ltc2654-l16", .data = &ltc2654l16_chip_info }, 393 + { .compatible = "lltc,ltc2654-h16", .data = &ltc2654h16_chip_info }, 410 394 { } 411 395 }; 412 396 MODULE_DEVICE_TABLE(of, ltc2632_of_match); ··· 424 404 module_spi_driver(ltc2632_driver); 425 405 426 406 MODULE_AUTHOR("Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>"); 427 - MODULE_DESCRIPTION("LTC2632 DAC SPI driver"); 407 + MODULE_DESCRIPTION("LTC2632 and similar DAC SPI driver"); 428 408 MODULE_LICENSE("GPL v2");