aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-06-04 05:36:27 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-05 00:47:33 -0400
commit20374d1a36df3e20cd6742ba376684e5506254a8 (patch)
treefa4d0e76a328e5febf61ef59328864d03feeade8 /drivers/staging/iio
parenta98348b74ec2c4c5cda0f14d38ff19e08fc4e4bf (diff)
staging:iio:dac:ad5791: Move private structs and defines from header to C file
The header for this driver contains some private structs and defines, which do not have to be shared between multiple source files, as well as the platform data struct for this driver, which has to be shared with other source files. Since there is no need to expose those private structs and defines move them to the source file. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/dac/ad5791.c83
-rw-r--r--drivers/staging/iio/dac/ad5791.h83
2 files changed, 83 insertions, 83 deletions
diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c
index 82b51a7aa80..5de28c2a57e 100644
--- a/drivers/staging/iio/dac/ad5791.c
+++ b/drivers/staging/iio/dac/ad5791.c
@@ -22,6 +22,89 @@
22 22
23#include "ad5791.h" 23#include "ad5791.h"
24 24
25#define AD5791_RES_MASK(x) ((1 << (x)) - 1)
26#define AD5791_DAC_MASK AD5791_RES_MASK(20)
27#define AD5791_DAC_MSB (1 << 19)
28
29#define AD5791_CMD_READ (1 << 23)
30#define AD5791_CMD_WRITE (0 << 23)
31#define AD5791_ADDR(addr) ((addr) << 20)
32
33/* Registers */
34#define AD5791_ADDR_NOOP 0
35#define AD5791_ADDR_DAC0 1
36#define AD5791_ADDR_CTRL 2
37#define AD5791_ADDR_CLRCODE 3
38#define AD5791_ADDR_SW_CTRL 4
39
40/* Control Register */
41#define AD5791_CTRL_RBUF (1 << 1)
42#define AD5791_CTRL_OPGND (1 << 2)
43#define AD5791_CTRL_DACTRI (1 << 3)
44#define AD5791_CTRL_BIN2SC (1 << 4)
45#define AD5791_CTRL_SDODIS (1 << 5)
46#define AD5761_CTRL_LINCOMP(x) ((x) << 6)
47
48#define AD5791_LINCOMP_0_10 0
49#define AD5791_LINCOMP_10_12 1
50#define AD5791_LINCOMP_12_16 2
51#define AD5791_LINCOMP_16_19 3
52#define AD5791_LINCOMP_19_20 12
53
54#define AD5780_LINCOMP_0_10 0
55#define AD5780_LINCOMP_10_20 12
56
57/* Software Control Register */
58#define AD5791_SWCTRL_LDAC (1 << 0)
59#define AD5791_SWCTRL_CLR (1 << 1)
60#define AD5791_SWCTRL_RESET (1 << 2)
61
62#define AD5791_DAC_PWRDN_6K 0
63#define AD5791_DAC_PWRDN_3STATE 1
64
65/**
66 * struct ad5791_chip_info - chip specific information
67 * @get_lin_comp: function pointer to the device specific function
68 */
69
70struct ad5791_chip_info {
71 int (*get_lin_comp) (unsigned int span);
72};
73
74/**
75 * struct ad5791_state - driver instance specific data
76 * @us: spi_device
77 * @reg_vdd: positive supply regulator
78 * @reg_vss: negative supply regulator
79 * @chip_info: chip model specific constants
80 * @vref_mv: actual reference voltage used
81 * @vref_neg_mv: voltage of the negative supply
82 * @pwr_down_mode current power down mode
83 */
84
85struct ad5791_state {
86 struct spi_device *spi;
87 struct regulator *reg_vdd;
88 struct regulator *reg_vss;
89 const struct ad5791_chip_info *chip_info;
90 unsigned short vref_mv;
91 unsigned int vref_neg_mv;
92 unsigned ctrl;
93 unsigned pwr_down_mode;
94 bool pwr_down;
95};
96
97/**
98 * ad5791_supported_device_ids:
99 */
100
101enum ad5791_supported_device_ids {
102 ID_AD5760,
103 ID_AD5780,
104 ID_AD5781,
105 ID_AD5791,
106};
107
25static int ad5791_spi_write(struct spi_device *spi, u8 addr, u32 val) 108static int ad5791_spi_write(struct spi_device *spi, u8 addr, u32 val)
26{ 109{
27 union { 110 union {
diff --git a/drivers/staging/iio/dac/ad5791.h b/drivers/staging/iio/dac/ad5791.h
index fd7edbdb4ec..87a6c922f18 100644
--- a/drivers/staging/iio/dac/ad5791.h
+++ b/drivers/staging/iio/dac/ad5791.h
@@ -9,46 +9,6 @@
9#ifndef SPI_AD5791_H_ 9#ifndef SPI_AD5791_H_
10#define SPI_AD5791_H_ 10#define SPI_AD5791_H_
11 11
12#define AD5791_RES_MASK(x) ((1 << (x)) - 1)
13#define AD5791_DAC_MASK AD5791_RES_MASK(20)
14#define AD5791_DAC_MSB (1 << 19)
15
16#define AD5791_CMD_READ (1 << 23)
17#define AD5791_CMD_WRITE (0 << 23)
18#define AD5791_ADDR(addr) ((addr) << 20)
19
20/* Registers */
21#define AD5791_ADDR_NOOP 0
22#define AD5791_ADDR_DAC0 1
23#define AD5791_ADDR_CTRL 2
24#define AD5791_ADDR_CLRCODE 3
25#define AD5791_ADDR_SW_CTRL 4
26
27/* Control Register */
28#define AD5791_CTRL_RBUF (1 << 1)
29#define AD5791_CTRL_OPGND (1 << 2)
30#define AD5791_CTRL_DACTRI (1 << 3)
31#define AD5791_CTRL_BIN2SC (1 << 4)
32#define AD5791_CTRL_SDODIS (1 << 5)
33#define AD5761_CTRL_LINCOMP(x) ((x) << 6)
34
35#define AD5791_LINCOMP_0_10 0
36#define AD5791_LINCOMP_10_12 1
37#define AD5791_LINCOMP_12_16 2
38#define AD5791_LINCOMP_16_19 3
39#define AD5791_LINCOMP_19_20 12
40
41#define AD5780_LINCOMP_0_10 0
42#define AD5780_LINCOMP_10_20 12
43
44/* Software Control Register */
45#define AD5791_SWCTRL_LDAC (1 << 0)
46#define AD5791_SWCTRL_CLR (1 << 1)
47#define AD5791_SWCTRL_RESET (1 << 2)
48
49#define AD5791_DAC_PWRDN_6K 0
50#define AD5791_DAC_PWRDN_3STATE 1
51
52/* 12/*
53 * TODO: struct ad5791_platform_data needs to go into include/linux/iio 13 * TODO: struct ad5791_platform_data needs to go into include/linux/iio
54 */ 14 */
@@ -66,47 +26,4 @@ struct ad5791_platform_data {
66 bool use_rbuf_gain2; 26 bool use_rbuf_gain2;
67}; 27};
68 28
69/**
70 * struct ad5791_chip_info - chip specific information
71 * @get_lin_comp: function pointer to the device specific function
72 */
73
74struct ad5791_chip_info {
75 int (*get_lin_comp) (unsigned int span);
76};
77
78/**
79 * struct ad5791_state - driver instance specific data
80 * @us: spi_device
81 * @reg_vdd: positive supply regulator
82 * @reg_vss: negative supply regulator
83 * @chip_info: chip model specific constants
84 * @vref_mv: actual reference voltage used
85 * @vref_neg_mv: voltage of the negative supply
86 * @pwr_down_mode current power down mode
87 */
88
89struct ad5791_state {
90 struct spi_device *spi;
91 struct regulator *reg_vdd;
92 struct regulator *reg_vss;
93 const struct ad5791_chip_info *chip_info;
94 unsigned short vref_mv;
95 unsigned int vref_neg_mv;
96 unsigned ctrl;
97 unsigned pwr_down_mode;
98 bool pwr_down;
99};
100
101/**
102 * ad5791_supported_device_ids:
103 */
104
105enum ad5791_supported_device_ids {
106 ID_AD5760,
107 ID_AD5780,
108 ID_AD5781,
109 ID_AD5791,
110};
111
112#endif /* SPI_AD5791_H_ */ 29#endif /* SPI_AD5791_H_ */