11 #include <linux/types.h>
13 #include <linux/device.h>
15 #include <linux/slab.h>
17 #include <linux/module.h>
22 #define DRV_NAME "ad9910"
34 #define DIG_RAMPL 0x0B
35 #define DIG_RAMPS 0x0C
36 #define DIG_RAMPR 0x0D
37 #define SIN_TONEP0 0x0E
38 #define SIN_TONEP1 0x0F
39 #define SIN_TONEP2 0x10
40 #define SIN_TONEP3 0x11
41 #define SIN_TONEP4 0x12
42 #define SIN_TONEP5 0x13
43 #define SIN_TONEP6 0x14
44 #define SIN_TONEP7 0x15
46 #define RAM_ENABLE (1 << 7)
48 #define MANUAL_OSK (1 << 7)
49 #define INVSIC (1 << 6)
50 #define DDS_SINEOP (1)
53 #define OSKEN (1 << 1)
54 #define LOAD_ARR (1 << 2)
55 #define CLR_PHA (1 << 3)
56 #define CLR_DIG (1 << 4)
57 #define ACLR_PHA (1 << 5)
58 #define ACLR_DIG (1 << 6)
59 #define LOAD_LRR (1 << 7)
62 #define SDIO_IPT (1 << 1)
63 #define EXT_PWD (1 << 3)
64 #define ADAC_PWD (1 << 4)
65 #define REFCLK_PWD (1 << 5)
66 #define DAC_PWD (1 << 6)
67 #define DIG_PWD (1 << 7)
71 #define DIGR_LOW (1 << 1)
72 #define DIGR_HIGH (1 << 2)
73 #define DIGR_ENA (1 << 3)
74 #define SYNCCLK_ENA (1 << 6)
75 #define ITER_IOUPD (1 << 7)
77 #define TX_ENA (1 << 1)
78 #define PDCLK_INV (1 << 2)
79 #define PDCLK_ENB (1 << 3)
81 #define PARA_ENA (1 << 4)
82 #define SYNC_DIS (1 << 5)
83 #define DATA_ASS (1 << 6)
84 #define MATCH_ENA (1 << 7)
87 #define PFD_RST (1 << 2)
88 #define REFCLK_RST (1 << 6)
89 #define REFCLK_BYP (1 << 7)
133 spi_message_init(&msg);
134 spi_message_add_tail(&xfer, &msg);
142 spi_message_init(&msg);
143 spi_message_add_tail(&xfer, &msg);
151 spi_message_init(&msg);
152 spi_message_add_tail(&xfer, &msg);
160 spi_message_init(&msg);
161 spi_message_add_tail(&xfer, &msg);
169 spi_message_init(&msg);
170 spi_message_add_tail(&xfer, &msg);
178 spi_message_init(&msg);
179 spi_message_add_tail(&xfer, &msg);
187 spi_message_init(&msg);
188 spi_message_add_tail(&xfer, &msg);
196 spi_message_init(&msg);
197 spi_message_add_tail(&xfer, &msg);
205 spi_message_init(&msg);
206 spi_message_add_tail(&xfer, &msg);
214 spi_message_init(&msg);
215 spi_message_add_tail(&xfer, &msg);
223 spi_message_init(&msg);
224 spi_message_add_tail(&xfer, &msg);
232 spi_message_init(&msg);
233 spi_message_add_tail(&xfer, &msg);
240 spi_message_init(&msg);
241 spi_message_add_tail(&xfer, &msg);
249 spi_message_init(&msg);
250 spi_message_add_tail(&xfer, &msg);
258 spi_message_init(&msg);
259 spi_message_add_tail(&xfer, &msg);
267 spi_message_init(&msg);
268 spi_message_add_tail(&xfer, &msg);
276 spi_message_init(&msg);
277 spi_message_add_tail(&xfer, &msg);
284 return ret ? ret : len;
307 spi_message_init(&
msg);
308 spi_message_add_tail(&xfer, &
msg);
322 spi_message_init(&
msg);
323 spi_message_add_tail(&xfer, &
msg);
337 spi_message_init(&
msg);
338 spi_message_add_tail(&xfer, &
msg);
350 static struct attribute *ad9910_attributes[] = {
351 &iio_dev_attr_dds.dev_attr.attr,
356 .attrs = ad9910_attributes,
359 static const struct iio_info ad9910_info = {
360 .attrs = &ad9910_attribute_group,
375 spi_set_drvdata(spi, idev);
380 idev->
dev.parent = &spi->
dev;
381 idev->
info = &ad9910_info;
413 .probe = ad9910_probe,