original_kernel/drivers/iio/dac
Anshul Dalal cdf3ecb0d8 iio: dac: driver for MCP4821
Adds driver for the MCP48xx series of DACs.

Device uses a simplex SPI channel. To set the value of an output channel,
a 16-bit data of following format must be written:

Bit field | Description
15 [MSB]  | Channel selection bit
            0 -> Channel A
            1 -> Channel B
13        | Output Gain Selection bit
            0 -> 2x Gain (Vref = 4.096V)
            1 -> 1x Gain (Vref = 2.048V)
12        | Output Shutdown Control bit
            0 -> Shutdown the selected channel
            1 -> Active mode operation
11-0 [LSB]| DAC Input Data bits
            Value's big endian representation is taken as input for the
            selected DAC channel. For devices with a resolution of less
            than 12-bits, only the x most significant bits are considered
            where x is the resolution of the device.
Reference: Page#22 [MCP48x2 Datasheet]

Supported devices:
  +---------+--------------+-------------+
  | Device  |  Resolution  |   Channels  |
  |---------|--------------|-------------|
  | MCP4801 |     8-bit    |      1      |
  | MCP4802 |     8-bit    |      2      |
  | MCP4811 |    10-bit    |      1      |
  | MCP4812 |    10-bit    |      2      |
  | MCP4821 |    12-bit    |      1      |
  | MCP4822 |    12-bit    |      2      |
  +---------+--------------+-------------+

Devices tested:
  MCP4821 [12-bit single channel]
  MCP4802 [8-bit dual channel]

Tested on Raspberry Pi Zero 2W

Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/22244B.pdf #MCP48x1
Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/20002249B.pdf #MCP48x2
Signed-off-by: Anshul Dalal <anshulusr@gmail.com>
Link: https://lore.kernel.org/r/20231220151954.154595-2-anshulusr@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-12-21 17:04:42 +00:00
..
Kconfig
Makefile
ad3552r.c
ad5064.c
ad5360.c
ad5380.c
ad5421.c
ad5446.c
ad5449.c
ad5504.c
ad5592r-base.c
ad5592r-base.h
ad5592r.c
ad5593r.c
ad5624r.h
ad5624r_spi.c
ad5686-spi.c
ad5686.c
ad5686.h
ad5696-i2c.c
ad5755.c
ad5758.c
ad5761.c
ad5764.c
ad5766.c
ad5770r.c
ad5791.c
ad7293.c
ad7303.c
ad8801.c
cio-dac.c
dpot-dac.c
ds4424.c
lpc18xx_dac.c
ltc1660.c
ltc2632.c
ltc2688.c
m62332.c
max517.c
max5522.c
max5821.c
mcp4725.c
mcp4728.c
mcp4821.c
mcp4922.c
stm32-dac-core.c
stm32-dac-core.h
stm32-dac.c
ti-dac082s085.c
ti-dac5571.c
ti-dac7311.c
ti-dac7612.c
vf610_dac.c