iio:dac:ad5686: Add AD5310R support
The AD5310R is a single channel DAC with 10-bit precision, which is part of the same family as AD5311R, except that it uses the spi interface instead of i2c. The device has a built-in 2.5V reference which is enabled by default. Another important difference is that the SPI write command operation is 16 bits long. The first four bits represent the command, while the remaining 12 bits are for data. In the control reg, DB9 and DB10 are used for power-down modes, while DB8 is the REF bit. In order to accommodate this change, a new regmap type was defined and checked accordingly. Because AD5310R does not have a readback register, the read_raw operation will return "Operation is not supported". Datasheet: Link: http://www.analog.com/media/en/technical-documentation/data-sheets/AD5310R_5311R.pdf Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:

committed by
Jonathan Cameron

parent
5c608d4dd4
commit
12d323cf6d
@@ -13,7 +13,10 @@
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#define AD5310_CMD(x) ((x) << 12)
|
||||
|
||||
#define AD5683_DATA(x) ((x) << 4)
|
||||
|
||||
#define AD5686_ADDR(x) ((x) << 16)
|
||||
#define AD5686_CMD(x) ((x) << 20)
|
||||
|
||||
@@ -38,6 +41,8 @@
|
||||
|
||||
#define AD5686_CMD_CONTROL_REG 0x4
|
||||
#define AD5686_CMD_READBACK_ENABLE_V2 0x5
|
||||
|
||||
#define AD5310_REF_BIT_MSK BIT(8)
|
||||
#define AD5683_REF_BIT_MSK BIT(12)
|
||||
#define AD5693_REF_BIT_MSK BIT(12)
|
||||
|
||||
@@ -45,6 +50,7 @@
|
||||
* ad5686_supported_device_ids:
|
||||
*/
|
||||
enum ad5686_supported_device_ids {
|
||||
ID_AD5310R,
|
||||
ID_AD5311R,
|
||||
ID_AD5671R,
|
||||
ID_AD5672R,
|
||||
@@ -72,6 +78,7 @@ enum ad5686_supported_device_ids {
|
||||
};
|
||||
|
||||
enum ad5686_regmap_type {
|
||||
AD5310_REGMAP,
|
||||
AD5683_REGMAP,
|
||||
AD5686_REGMAP,
|
||||
AD5693_REGMAP
|
||||
|
Reference in New Issue
Block a user