forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/iio/dac/ad5686-spi.c
....@@ -1,7 +1,8 @@
1
-// SPDX-License-Identifier: GPL-2.0+
1
+// SPDX-License-Identifier: GPL-2.0
22 /*
3
- * AD5672R, AD5676, AD5676R, AD5681R, AD5682R, AD5683, AD5683R,
4
- * AD5684, AD5684R, AD5685R, AD5686, AD5686R
3
+ * AD5672R, AD5674R, AD5676, AD5676R, AD5679R,
4
+ * AD5681R, AD5682R, AD5683, AD5683R, AD5684,
5
+ * AD5684R, AD5685R, AD5686, AD5686R
56 * Digital to analog converters driver
67 *
78 * Copyright 2018 Analog Devices Inc.
....@@ -19,6 +20,12 @@
1920 u8 tx_len, *buf;
2021
2122 switch (st->chip_info->regmap_type) {
23
+ case AD5310_REGMAP:
24
+ st->data[0].d16 = cpu_to_be16(AD5310_CMD(cmd) |
25
+ val);
26
+ buf = &st->data[0].d8[0];
27
+ tx_len = 2;
28
+ break;
2229 case AD5683_REGMAP:
2330 st->data[0].d32 = cpu_to_be32(AD5686_CMD(cmd) |
2431 AD5683_DATA(val));
....@@ -56,10 +63,18 @@
5663 u8 cmd = 0;
5764 int ret;
5865
59
- if (st->chip_info->regmap_type == AD5686_REGMAP)
60
- cmd = AD5686_CMD_READBACK_ENABLE;
61
- else if (st->chip_info->regmap_type == AD5683_REGMAP)
66
+ switch (st->chip_info->regmap_type) {
67
+ case AD5310_REGMAP:
68
+ return -ENOTSUPP;
69
+ case AD5683_REGMAP:
6270 cmd = AD5686_CMD_READBACK_ENABLE_V2;
71
+ break;
72
+ case AD5686_REGMAP:
73
+ cmd = AD5686_CMD_READBACK_ENABLE;
74
+ break;
75
+ default:
76
+ return -EINVAL;
77
+ }
6378
6479 st->data[0].d32 = cpu_to_be32(AD5686_CMD(cmd) |
6580 AD5686_ADDR(addr));
....@@ -86,9 +101,12 @@
86101 }
87102
88103 static const struct spi_device_id ad5686_spi_id[] = {
104
+ {"ad5310r", ID_AD5310R},
89105 {"ad5672r", ID_AD5672R},
106
+ {"ad5674r", ID_AD5674R},
90107 {"ad5676", ID_AD5676},
91108 {"ad5676r", ID_AD5676R},
109
+ {"ad5679r", ID_AD5679R},
92110 {"ad5681r", ID_AD5681R},
93111 {"ad5682r", ID_AD5682R},
94112 {"ad5683", ID_AD5683},