i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / staging / iio / dac / ad5504.h
blobafe09522f53ce2c5f51a113588aa869d796e59ce
1 /*
2 * AD5504 SPI DAC driver
4 * Copyright 2011 Analog Devices Inc.
6 * Licensed under the GPL-2.
7 */
9 #ifndef SPI_AD5504_H_
10 #define SPI_AD5504_H_
12 #define AD5505_BITS 12
13 #define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1)
15 #define AD5504_CMD_READ (1 << 15)
16 #define AD5504_CMD_WRITE (0 << 15)
17 #define AD5504_ADDR(addr) ((addr) << 12)
19 /* Registers */
20 #define AD5504_ADDR_NOOP 0
21 #define AD5504_ADDR_DAC(x) ((x) + 1)
22 #define AD5504_ADDR_ALL_DAC 5
23 #define AD5504_ADDR_CTRL 7
25 /* Control Register */
26 #define AD5504_DAC_PWR(ch) ((ch) << 2)
27 #define AD5504_DAC_PWRDWN_MODE(mode) ((mode) << 6)
28 #define AD5504_DAC_PWRDN_20K 0
29 #define AD5504_DAC_PWRDN_3STATE 1
32 * TODO: struct ad5504_platform_data needs to go into include/linux/iio
35 struct ad5504_platform_data {
36 u16 vref_mv;
39 /**
40 * struct ad5446_state - driver instance specific data
41 * @us: spi_device
42 * @reg: supply regulator
43 * @vref_mv: actual reference voltage used
44 * @pwr_down_mask power down mask
45 * @pwr_down_mode current power down mode
48 struct ad5504_state {
49 struct spi_device *spi;
50 struct regulator *reg;
51 unsigned short vref_mv;
52 unsigned pwr_down_mask;
53 unsigned pwr_down_mode;
56 /**
57 * ad5504_supported_device_ids:
60 enum ad5504_supported_device_ids {
61 ID_AD5504,
62 ID_AD5501,
65 #endif /* SPI_AD5504_H_ */