diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2011-08-24 09:28:21 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-10-24 08:09:12 -0400 |
commit | fec316d63219f610e5385f5e54e6c3ea459e58e9 (patch) | |
tree | c3eb2e6352ccad730f93335edee789c58203b003 /include/linux/mfd | |
parent | f3ca07824f309474b308d859c9a2cc871c6c5ab8 (diff) |
mfd: Provide a generic version of mc13xxx adc_do_conversion
This is needed to convert the touch driver away from using struct mc13783.
Note this patch drops MC13783_ADC0_ADREFMODE. This is unused and doesn't
exist on mc13892.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r-- | include/linux/mfd/mc13783.h | 35 | ||||
-rw-r--r-- | include/linux/mfd/mc13xxx.h | 19 |
2 files changed, 37 insertions, 17 deletions
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h index 7d0f3d6a0002..e7a3c0169f63 100644 --- a/include/linux/mfd/mc13783.h +++ b/include/linux/mfd/mc13783.h | |||
@@ -89,18 +89,15 @@ static inline int mc13783_irq_ack(struct mc13783 *mc13783, int irq) | |||
89 | return mc13xxx_irq_ack(mc13783_to_mc13xxx(mc13783), irq); | 89 | return mc13xxx_irq_ack(mc13783_to_mc13xxx(mc13783), irq); |
90 | } | 90 | } |
91 | 91 | ||
92 | #define MC13783_ADC0 43 | 92 | #define MC13783_ADC0 MC13XXX_ADC0 |
93 | #define MC13783_ADC0_ADREFEN (1 << 10) | 93 | #define MC13783_ADC0_ADREFEN MC13XXX_ADC0_ADREFEN |
94 | #define MC13783_ADC0_ADREFMODE (1 << 11) | 94 | #define MC13783_ADC0_TSMOD0 MC13XXX_ADC0_TSMOD0 |
95 | #define MC13783_ADC0_TSMOD0 (1 << 12) | 95 | #define MC13783_ADC0_TSMOD1 MC13XXX_ADC0_TSMOD1 |
96 | #define MC13783_ADC0_TSMOD1 (1 << 13) | 96 | #define MC13783_ADC0_TSMOD2 MC13XXX_ADC0_TSMOD2 |
97 | #define MC13783_ADC0_TSMOD2 (1 << 14) | 97 | #define MC13783_ADC0_ADINC1 MC13XXX_ADC0_ADINC1 |
98 | #define MC13783_ADC0_ADINC1 (1 << 16) | 98 | #define MC13783_ADC0_ADINC2 MC13XXX_ADC0_ADINC2 |
99 | #define MC13783_ADC0_ADINC2 (1 << 17) | 99 | |
100 | 100 | #define MC13783_ADC0_TSMOD_MASK MC13XXX_ADC0_TSMOD_MASK | |
101 | #define MC13783_ADC0_TSMOD_MASK (MC13783_ADC0_TSMOD0 | \ | ||
102 | MC13783_ADC0_TSMOD1 | \ | ||
103 | MC13783_ADC0_TSMOD2) | ||
104 | 101 | ||
105 | #define mc13783_regulator_init_data mc13xxx_regulator_init_data | 102 | #define mc13783_regulator_init_data mc13xxx_regulator_init_data |
106 | #define mc13783_regulator_platform_data mc13xxx_regulator_platform_data | 103 | #define mc13783_regulator_platform_data mc13xxx_regulator_platform_data |
@@ -115,12 +112,16 @@ static inline int mc13783_irq_ack(struct mc13783 *mc13783, int irq) | |||
115 | #define MC13783_USE_REGULATOR MC13XXX_USE_REGULATOR | 112 | #define MC13783_USE_REGULATOR MC13XXX_USE_REGULATOR |
116 | #define MC13783_USE_LED MC13XXX_USE_LED | 113 | #define MC13783_USE_LED MC13XXX_USE_LED |
117 | 114 | ||
118 | #define MC13783_ADC_MODE_TS 1 | 115 | #define MC13783_ADC_MODE_TS MC13XXX_ADC_MODE_TS |
119 | #define MC13783_ADC_MODE_SINGLE_CHAN 2 | 116 | #define MC13783_ADC_MODE_SINGLE_CHAN MC13XXX_ADC_MODE_SINGLE_CHAN |
120 | #define MC13783_ADC_MODE_MULT_CHAN 3 | 117 | #define MC13783_ADC_MODE_MULT_CHAN MC13XXX_ADC_MODE_MULT_CHAN |
121 | 118 | ||
122 | int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode, | 119 | static inline int mc13783_adc_do_conversion(struct mc13783 *mc13783, |
123 | unsigned int channel, unsigned int *sample); | 120 | unsigned int mode, unsigned int channel, unsigned int *sample) |
121 | { | ||
122 | return mc13xxx_adc_do_conversion(mc13783_to_mc13xxx(mc13783), mode, | ||
123 | channel, sample); | ||
124 | } | ||
124 | 125 | ||
125 | 126 | ||
126 | #define MC13783_REG_SW1A 0 | 127 | #define MC13783_REG_SW1A 0 |
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h index c064beaaccb7..6e7c0ac36d09 100644 --- a/include/linux/mfd/mc13xxx.h +++ b/include/linux/mfd/mc13xxx.h | |||
@@ -37,6 +37,9 @@ int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq); | |||
37 | 37 | ||
38 | int mc13xxx_get_flags(struct mc13xxx *mc13xxx); | 38 | int mc13xxx_get_flags(struct mc13xxx *mc13xxx); |
39 | 39 | ||
40 | int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, | ||
41 | unsigned int mode, unsigned int channel, unsigned int *sample); | ||
42 | |||
40 | #define MC13XXX_IRQ_ADCDONE 0 | 43 | #define MC13XXX_IRQ_ADCDONE 0 |
41 | #define MC13XXX_IRQ_ADCBISDONE 1 | 44 | #define MC13XXX_IRQ_ADCBISDONE 1 |
42 | #define MC13XXX_IRQ_TS 2 | 45 | #define MC13XXX_IRQ_TS 2 |
@@ -150,4 +153,20 @@ struct mc13xxx_platform_data { | |||
150 | struct mc13xxx_leds_platform_data *leds; | 153 | struct mc13xxx_leds_platform_data *leds; |
151 | }; | 154 | }; |
152 | 155 | ||
156 | #define MC13XXX_ADC_MODE_TS 1 | ||
157 | #define MC13XXX_ADC_MODE_SINGLE_CHAN 2 | ||
158 | #define MC13XXX_ADC_MODE_MULT_CHAN 3 | ||
159 | |||
160 | #define MC13XXX_ADC0 43 | ||
161 | #define MC13XXX_ADC0_ADREFEN (1 << 10) | ||
162 | #define MC13XXX_ADC0_TSMOD0 (1 << 12) | ||
163 | #define MC13XXX_ADC0_TSMOD1 (1 << 13) | ||
164 | #define MC13XXX_ADC0_TSMOD2 (1 << 14) | ||
165 | #define MC13XXX_ADC0_ADINC1 (1 << 16) | ||
166 | #define MC13XXX_ADC0_ADINC2 (1 << 17) | ||
167 | |||
168 | #define MC13XXX_ADC0_TSMOD_MASK (MC13XXX_ADC0_TSMOD0 | \ | ||
169 | MC13XXX_ADC0_TSMOD1 | \ | ||
170 | MC13XXX_ADC0_TSMOD2) | ||
171 | |||
153 | #endif /* ifndef __LINUX_MFD_MC13XXX_H */ | 172 | #endif /* ifndef __LINUX_MFD_MC13XXX_H */ |