staging: brcm80211: remove brcms_b_dotxstatus wrapper function
[zen-stable.git] / drivers / staging / iio / dac / ad5504.h
blob85beb1dd29b91fc0ae0f2f0a86f95a2a0ad7d271
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_DAC0 1
22 #define AD5504_ADDR_DAC1 2
23 #define AD5504_ADDR_DAC2 3
24 #define AD5504_ADDR_DAC3 4
25 #define AD5504_ADDR_ALL_DAC 5
26 #define AD5504_ADDR_CTRL 7
28 /* Control Register */
29 #define AD5504_DAC_PWR(ch) ((ch) << 2)
30 #define AD5504_DAC_PWRDWN_MODE(mode) ((mode) << 6)
31 #define AD5504_DAC_PWRDN_20K 0
32 #define AD5504_DAC_PWRDN_3STATE 1
35 * TODO: struct ad5504_platform_data needs to go into include/linux/iio
38 struct ad5504_platform_data {
39 u16 vref_mv;
42 /**
43 * struct ad5446_state - driver instance specific data
44 * @us: spi_device
45 * @reg: supply regulator
46 * @vref_mv: actual reference voltage used
47 * @pwr_down_mask power down mask
48 * @pwr_down_mode current power down mode
51 struct ad5504_state {
52 struct spi_device *spi;
53 struct regulator *reg;
54 unsigned short vref_mv;
55 unsigned pwr_down_mask;
56 unsigned pwr_down_mode;
59 /**
60 * ad5504_supported_device_ids:
63 enum ad5504_supported_device_ids {
64 ID_AD5504,
65 ID_AD5501,
68 #endif /* SPI_AD5504_H_ */