diff options
Diffstat (limited to 'drivers/iio/dac')
-rw-r--r-- | drivers/iio/dac/ad5446.c | 35 | ||||
-rw-r--r-- | drivers/iio/dac/ad5446.h | 64 |
2 files changed, 34 insertions, 65 deletions
diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c index 241665b8183b..7f11c1c89960 100644 --- a/drivers/iio/dac/ad5446.c +++ b/drivers/iio/dac/ad5446.c | |||
@@ -22,7 +22,40 @@ | |||
22 | #include <linux/iio/iio.h> | 22 | #include <linux/iio/iio.h> |
23 | #include <linux/iio/sysfs.h> | 23 | #include <linux/iio/sysfs.h> |
24 | 24 | ||
25 | #include "ad5446.h" | 25 | #define MODE_PWRDWN_1k 0x1 |
26 | #define MODE_PWRDWN_100k 0x2 | ||
27 | #define MODE_PWRDWN_TRISTATE 0x3 | ||
28 | |||
29 | /** | ||
30 | * struct ad5446_state - driver instance specific data | ||
31 | * @spi: spi_device | ||
32 | * @chip_info: chip model specific constants, available modes etc | ||
33 | * @reg: supply regulator | ||
34 | * @vref_mv: actual reference voltage used | ||
35 | */ | ||
36 | |||
37 | struct ad5446_state { | ||
38 | struct device *dev; | ||
39 | const struct ad5446_chip_info *chip_info; | ||
40 | struct regulator *reg; | ||
41 | unsigned short vref_mv; | ||
42 | unsigned cached_val; | ||
43 | unsigned pwr_down_mode; | ||
44 | unsigned pwr_down; | ||
45 | }; | ||
46 | |||
47 | /** | ||
48 | * struct ad5446_chip_info - chip specific information | ||
49 | * @channel: channel spec for the DAC | ||
50 | * @int_vref_mv: AD5620/40/60: the internal reference voltage | ||
51 | * @write: chip specific helper function to write to the register | ||
52 | */ | ||
53 | |||
54 | struct ad5446_chip_info { | ||
55 | struct iio_chan_spec channel; | ||
56 | u16 int_vref_mv; | ||
57 | int (*write)(struct ad5446_state *st, unsigned val); | ||
58 | }; | ||
26 | 59 | ||
27 | static const char * const ad5446_powerdown_modes[] = { | 60 | static const char * const ad5446_powerdown_modes[] = { |
28 | "1kohm_to_gnd", "100kohm_to_gnd", "three_state" | 61 | "1kohm_to_gnd", "100kohm_to_gnd", "three_state" |
diff --git a/drivers/iio/dac/ad5446.h b/drivers/iio/dac/ad5446.h deleted file mode 100644 index 6b7a1766c109..000000000000 --- a/drivers/iio/dac/ad5446.h +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * AD5446 SPI DAC driver | ||
3 | * | ||
4 | * Copyright 2010 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | #ifndef IIO_DAC_AD5446_H_ | ||
9 | #define IIO_DAC_AD5446_H_ | ||
10 | |||
11 | /* DAC Control Bits */ | ||
12 | |||
13 | #define AD5446_LOAD (0x0 << 14) /* Load and update */ | ||
14 | #define AD5446_SDO_DIS (0x1 << 14) /* Disable SDO */ | ||
15 | #define AD5446_NOP (0x2 << 14) /* No operation */ | ||
16 | #define AD5446_CLK_RISING (0x3 << 14) /* Clock data on rising edge */ | ||
17 | |||
18 | #define AD5620_LOAD (0x0 << 14) /* Load and update Norm Operation*/ | ||
19 | #define AD5620_PWRDWN_1k (0x1 << 14) /* Power-down: 1kOhm to GND */ | ||
20 | #define AD5620_PWRDWN_100k (0x2 << 14) /* Power-down: 100kOhm to GND */ | ||
21 | #define AD5620_PWRDWN_TRISTATE (0x3 << 14) /* Power-down: Three-state */ | ||
22 | |||
23 | #define AD5660_LOAD (0x0 << 16) /* Load and update Norm Operation*/ | ||
24 | #define AD5660_PWRDWN_1k (0x1 << 16) /* Power-down: 1kOhm to GND */ | ||
25 | #define AD5660_PWRDWN_100k (0x2 << 16) /* Power-down: 100kOhm to GND */ | ||
26 | #define AD5660_PWRDWN_TRISTATE (0x3 << 16) /* Power-down: Three-state */ | ||
27 | |||
28 | #define MODE_PWRDWN_1k 0x1 | ||
29 | #define MODE_PWRDWN_100k 0x2 | ||
30 | #define MODE_PWRDWN_TRISTATE 0x3 | ||
31 | |||
32 | /** | ||
33 | * struct ad5446_state - driver instance specific data | ||
34 | * @spi: spi_device | ||
35 | * @chip_info: chip model specific constants, available modes etc | ||
36 | * @reg: supply regulator | ||
37 | * @vref_mv: actual reference voltage used | ||
38 | */ | ||
39 | |||
40 | struct ad5446_state { | ||
41 | struct device *dev; | ||
42 | const struct ad5446_chip_info *chip_info; | ||
43 | struct regulator *reg; | ||
44 | unsigned short vref_mv; | ||
45 | unsigned cached_val; | ||
46 | unsigned pwr_down_mode; | ||
47 | unsigned pwr_down; | ||
48 | }; | ||
49 | |||
50 | /** | ||
51 | * struct ad5446_chip_info - chip specific information | ||
52 | * @channel: channel spec for the DAC | ||
53 | * @int_vref_mv: AD5620/40/60: the internal reference voltage | ||
54 | * @write: chip specific helper function to write to the register | ||
55 | */ | ||
56 | |||
57 | struct ad5446_chip_info { | ||
58 | struct iio_chan_spec channel; | ||
59 | u16 int_vref_mv; | ||
60 | int (*write)(struct ad5446_state *st, unsigned val); | ||
61 | }; | ||
62 | |||
63 | |||
64 | #endif /* IIO_DAC_AD5446_H_ */ | ||