linux/drivers/iio
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
..
accel iio: accel: bmi088: update comments and Kconfig 2023-12-17 14:22:21 +00:00
adc iio: adc: ad7091r: Align arguments to function call parenthesis 2023-12-17 14:56:45 +00:00
addac IIO: 1st set of new device support, features and cleanup for 6.7 2023-10-20 07:54:15 +02:00
afe iio: afe: rescale: Accept only offset channels 2023-10-17 20:25:32 +01:00
amplifiers iio: amplifiers: hmc425a: add support for ADRF5740 Attenuator 2023-11-26 16:36:53 +00:00
buffer iio: buffer-dma: split iio_dma_buffer_fileio_free() function 2023-12-21 11:30:59 +00:00
cdc iio: cdc: ad7150: relax return value check for IRQ get 2023-08-01 18:55:55 +01:00
chemical iio: chemical: add support for Aosong AGS02MA 2023-12-17 14:44:35 +00:00
common iio: cros_ec: fix an use-after-free in cros_ec_sensors_push_data() 2023-10-05 18:06:45 +01:00
dac iio: dac: driver for MCP4821 2023-12-21 17:04:42 +00:00
dummy Bitmap patches for 5.19-rc1 2022-06-04 14:04:27 -07:00
filter drivers: iio: filter: admv8818: add bypass mode 2023-08-08 09:51:06 +01:00
frequency iio: frequency: admv1014: Switch to device_property_match_property_string() 2023-11-16 19:10:26 +00:00
gyro iio: gyro: hid-sensor-gyro-3d: Convert to platform remove callback returning void 2023-09-23 15:06:55 +01:00
health iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
humidity iio: humidity: Add driver for ti HDC302x humidity sensors 2023-12-11 19:38:36 +00:00
imu iio: imu: bmi323: Make the local structures static 2023-11-26 18:04:58 +00:00
light iio: light: driver for Lite-On ltr390 2023-12-11 19:16:35 +00:00
magnetometer iio: magnetometer: tmag5273: Switch to device_property_match_property_string() 2023-11-16 19:10:26 +00:00
multiplexer iio: multiplexer: Switch to use dev_err_probe() helper 2022-11-23 19:43:57 +00:00
orientation iio: orientation: hid-sensor-rotation: Convert to platform remove callback returning void 2023-09-23 15:06:56 +01:00
position iio: position: hid-sensor-custom-intel-hinge: Convert to platform remove callback returning void 2023-09-23 15:06:56 +01:00
potentiometer iio: potentiometer: ad5110: Use i2c_get_match_data() 2023-09-12 10:42:03 +01:00
potentiostat iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
pressure iio: pressure: driver for Honeywell HSC/SSC series 2023-12-11 19:16:35 +00:00
proximity iio: proximity: irsd200: Drop unused include 2023-12-04 13:24:42 +00:00
resolver iio: resolver: ad2s1210: add reset gpio support 2023-11-16 19:10:25 +00:00
temperature iio: temperature: mlx90635 MLX90635 IR Temperature sensor 2023-12-11 19:16:34 +00:00
test iio: test: Mark file local structure arrays static. 2022-08-15 22:30:01 +01:00
trigger iio: trigger: stm32-timer: Convert to platform remove callback returning void 2023-09-23 15:06:56 +01:00
iio_core_trigger.h
iio_core.h iio: Remove unused declarations 2023-09-12 10:42:03 +01:00
industrialio-buffer.c iio: buffer: Use IIO_SEPARATE instead of a hard-coded 0 2023-12-21 10:48:29 +00:00
industrialio-configfs.c
industrialio-core.c iio: core: introduce trough info element for minimum values 2023-12-11 19:37:10 +00:00
industrialio-event.c iio: event: add optional event label support 2023-10-11 15:54:41 +01:00
industrialio-gts-helper.c iio: gts-helpers: fix integration time units 2023-05-13 17:54:57 +01:00
industrialio-sw-device.c iio: Don't use bare "unsigned" 2022-07-01 11:19:08 +01:00
industrialio-sw-trigger.c iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails 2022-11-12 17:53:35 +00:00
industrialio-trigger.c iio: Make return value check for set_trigger_state() consistent 2023-07-20 19:21:30 +01:00
industrialio-triggered-event.c
inkern.c iio: inkern: Add a helper to query an available minimum raw value 2023-07-09 22:48:17 +01:00
Kconfig iio: light: Add gain-time-scale helpers 2023-04-10 12:26:34 +01:00
Makefile iio: light: Add gain-time-scale helpers 2023-04-10 12:26:34 +01:00
TODO iio: core: move 'mlock' to 'struct iio_dev_opaque' 2022-11-23 19:44:00 +00:00