iio: add ad5761 DAC driver
Subsystems (2)
PATCH v7 1/1 iio: add ad5761 DAC driver
ad5761 is a 1-channel DAC with configurable output range. The driver uses the regulator interface for its voltage ref.
It shares its register layout with ad5761r, ad5721 and ad5721r.
Differences:
ad5761* are 16 bit, ad5721* are 12 bits.
ad57*1r have an internal reference.
---
v7: Remove check for !regulator
Thanks to Jonathan Cameron <[email protected]>
v6: Do not set val2 when IIO_VAL_INT
Document AD5761_VOLTAGE_RANGE_0V_5V Thanks to Jonathan Cameron <[email protected]>
v5: CodeStyle and check val2 value
Thanks to Peter Meerwald-Stadler <[email protected]> and
v4: Use locking mechanism
Populate errors
Thanks to Lars-Peter Clausen <[email protected]>
v3: Move programmable voltage range to pdata
Exit on error instead of using internal voltage reference Thanks to Jonathan Cameron <[email protected]>
v2: A lot of CodeStyle Fixes
Thanks to Peter Meerwald-Stadler <[email protected]> and Jonathan Cameron <[email protected]>
CREDITS | 1 + drivers/iio/dac/Kconfig | 10 + drivers/iio/dac/Makefile | 1 + drivers/iio/dac/ad5761.c | 430 +++++++++++++++++++++++++++++++++++++++++ include/linux/iio/dac/ad5761.h | 37 ++++ 5 files changed, 479 insertions(+) create mode 100644 drivers/iio/dac/ad5761.c create mode 100644 include/linux/iio/dac/ad5761.h
CREDITS +1 -0
@@ -3035,6 +3035,7 @@ D: PLX USB338x driver D: PCA9634 driver D: Option GTM671WFS D: Fintek F81216A +D: AD5761 iio driver D: Various kernel hacks S: Qtechnology A/S S: Valby Langgade 142
drivers/iio/dac/Kconfig +10 -0
@@ -111,6 +111,16 @@ config AD5755 To compile this driver as a module, choose M here: the module will be called ad5755. +config AD5761 + tristate "Analog Devices AD5761/61R/21/21R DAC driver" + depends on SPI_MASTER + help + Say yes here to build support for Analog Devices AD5761, AD5761R, AD5721, + AD5721R Digital to Analog Converter. + + To compile this driver as a module, choose M here: the + module will be called ad5761. + config AD5764 tristate "Analog Devices AD5764/64R/44/44R DAC driver" depends on SPI_MASTER
drivers/iio/dac/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_AD5504) += ad5504.o obj-$(CONFIG_AD5446) += ad5446.o obj-$(CONFIG_AD5449) += ad5449.o obj-$(CONFIG_AD5755) += ad5755.o +obj-$(CONFIG_AD5761) += ad5761.o obj-$(CONFIG_AD5764) += ad5764.o obj-$(CONFIG_AD5791) += ad5791.o obj-$(CONFIG_AD5686) += ad5686.o
drivers/iio/dac/ad5761.c new file +430 -0
430 lines not on this page · raw message
include/linux/iio/dac/ad5761.h new file +37 -0
@@ -0,0 +1,37 @@ +#ifndef __IIO_DAC_AD5761_H__ +#define __IIO_DAC_AD5761_H__ + +/** +* enum ad5761_voltage_range - Voltage range the AD5761 is configured for. +* @AD5761_VOLTAGE_RANGE_M10V_10V: -10V to 10V +* @AD5761_VOLTAGE_RANGE_0V_10V: 0V to 10V +* @AD5761_VOLTAGE_RANGE_M5V_5V: -5V to 5V +* @AD5761_VOLTAGE_RANGE_0V_5V: 0V to 5V +* @AD5761_VOLTAGE_RANGE_M2V5_7V5: -2.5V to 7.5V +* @AD5761_VOLTAGE_RANGE_M3V_3V: -3V to 3V +* @AD5761_VOLTAGE_RANGE_0V_16V: 0V to 16V +* @AD5761_VOLTAGE_RANGE_0V_20V: 0V to 20V +*/ + +enum ad5761_voltage_range { +AD5761_VOLTAGE_RANGE_M10V_10V , +AD5761_VOLTAGE_RANGE_0V_10V , +AD5761_VOLTAGE_RANGE_M5V_5V , +AD5761_VOLTAGE_RANGE_0V_5V , +AD5761_VOLTAGE_RANGE_M2V5_7V5 , +AD5761_VOLTAGE_RANGE_M3V_3V , +AD5761_VOLTAGE_RANGE_0V_16V , +AD5761_VOLTAGE_RANGE_0V_20V , +}; + +/** +* struct ad5761_platform_data - AD5761 DAC driver platform data +* @voltage_range: Voltage range the AD5761 is configured for +*/ + +struct ad5761_platform_data { +enum ad5761_voltage_range voltage_range; +}; + + +#endif
Signature · 1 line
2.6.2
Quoted 10 lines · Ricardo Ribalda Delgado
ad5761 is a 1-channel DAC with configurable output range. The driver uses the regulator interface for its voltage ref.
It shares its register layout with ad5761r, ad5721 and ad5721r.
Differences:
ad5761* are 16 bit, ad5721* are 12 bits.
ad57*1r have an internal reference.Signed-off-by Ricardo Ribalda Delgado <[email protected]>
Looks very clean now, thanks. I have just one comment I overlooked during the first review. When that's addresses feel free to add
And one wish for the future, please give people a chance a review and don't resend a new version of the patch every couple of hours. This will make the reviewers life a bit easier.
include/linux/iio/dac/ad5761.h
Quoted 5 lines
include/linux/iio/dac/ad5761.h new file +0
-0
This should go into include/linux/platform_data. That's where all new platform data include files should go.
Hello Lars
Quoted 3 lines
And one wish for the future, please give people a chance a review and don't resend a new version of the patch every couple of hours. This will make the reviewers life a bit easier.
Sorry for the disturbance
Quoted 10 lines
include/linux/iio/dac/ad5761.h
Quoted 6 lines
include/linux/iio/dac/ad5761.h new file +0
-0This should go into
include/linux/platform_data. That's where all new platform data include files should go.
v8 is not on https://github.com/ribalda/linux/tree/ad5761v8
I will send to the ML if there is no more comments on it by the end of the day.
Regards!
Signature · 1 line
Ricardo Ribalda
Jonathan Cameron
maintainerQuoted 8 lines · Ricardo Ribalda Delgado
Hello Lars
Quoted 3 lines
And one wish for the future, please give people a chance a review and don't resend a new version of the patch every couple of hours. This will make the reviewers life a bit easier.
Sorry for the disturbance
I'm impatient unlike Lars ;)
Quoted 11 lines
Quoted 10 lines
include/linux/iio/dac/ad5761.h
Quoted 6 lines
include/linux/iio/dac/ad5761.h new file +0
-0This should go into
include/linux/platform_data. That's where all new platform data include files should go.
Quoted 3 lines
v8 is not on https://github.com/ribalda/linux/tree/ad5761v8
I will send to the ML if there is no more comments on it by the end of the day.
It's been several days....
(not that it actually matters at this time of the cycle!)
Quoted 4 lines
Regards!