Commit cbf806dd9302f3ff27ba496dae474b9da6b58873
Committed by
Dmitry Torokhov
1 parent
10494dce0b
Exists in
master
and in
39 other branches
Input: ucb1400 - move static function from header into core
it's a little too large for static line. The ts is currently the only mainline user but Marek Vasut claims that there is a battery driver in an ARM tree which also needs this function. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Showing 2 changed files with 24 additions and 19 deletions Side-by-side Diff
drivers/mfd/ucb1400_core.c
... | ... | @@ -23,6 +23,26 @@ |
23 | 23 | #include <linux/module.h> |
24 | 24 | #include <linux/ucb1400.h> |
25 | 25 | |
26 | +unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, | |
27 | + int adcsync) | |
28 | +{ | |
29 | + unsigned int val; | |
30 | + | |
31 | + if (adcsync) | |
32 | + adc_channel |= UCB_ADC_SYNC_ENA; | |
33 | + | |
34 | + ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel); | |
35 | + ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel | | |
36 | + UCB_ADC_START); | |
37 | + | |
38 | + while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA)) | |
39 | + & UCB_ADC_DAT_VALID)) | |
40 | + schedule_timeout_uninterruptible(1); | |
41 | + | |
42 | + return val & UCB_ADC_DAT_MASK; | |
43 | +} | |
44 | +EXPORT_SYMBOL_GPL(ucb1400_adc_read); | |
45 | + | |
26 | 46 | static int ucb1400_core_probe(struct device *dev) |
27 | 47 | { |
28 | 48 | int err; |
include/linux/ucb1400.h
... | ... | @@ -134,29 +134,14 @@ |
134 | 134 | ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA); |
135 | 135 | } |
136 | 136 | |
137 | -static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, | |
138 | - int adcsync) | |
139 | -{ | |
140 | - unsigned int val; | |
141 | - | |
142 | - if (adcsync) | |
143 | - adc_channel |= UCB_ADC_SYNC_ENA; | |
144 | - | |
145 | - ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel); | |
146 | - ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel | | |
147 | - UCB_ADC_START); | |
148 | - | |
149 | - while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA)) | |
150 | - & UCB_ADC_DAT_VALID)) | |
151 | - schedule_timeout_uninterruptible(1); | |
152 | - | |
153 | - return val & UCB_ADC_DAT_MASK; | |
154 | -} | |
155 | - | |
156 | 137 | static inline void ucb1400_adc_disable(struct snd_ac97 *ac97) |
157 | 138 | { |
158 | 139 | ucb1400_reg_write(ac97, UCB_ADC_CR, 0); |
159 | 140 | } |
141 | + | |
142 | + | |
143 | +unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, | |
144 | + int adcsync); | |
160 | 145 | |
161 | 146 | #endif |