diff options
Diffstat (limited to 'drivers/mfd/ezx-pcap.c')
-rw-r--r-- | drivers/mfd/ezx-pcap.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c index de7e63706abb..c5122024f05a 100644 --- a/drivers/mfd/ezx-pcap.c +++ b/drivers/mfd/ezx-pcap.c | |||
@@ -195,6 +195,19 @@ static void pcap_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
195 | } | 195 | } |
196 | 196 | ||
197 | /* ADC */ | 197 | /* ADC */ |
198 | void pcap_set_ts_bits(struct pcap_chip *pcap, u32 bits) | ||
199 | { | ||
200 | u32 tmp; | ||
201 | |||
202 | mutex_lock(&pcap->adc_mutex); | ||
203 | ezx_pcap_read(pcap, PCAP_REG_ADC, &tmp); | ||
204 | tmp &= ~(PCAP_ADC_TS_M_MASK | PCAP_ADC_TS_REF_LOWPWR); | ||
205 | tmp |= bits & (PCAP_ADC_TS_M_MASK | PCAP_ADC_TS_REF_LOWPWR); | ||
206 | ezx_pcap_write(pcap, PCAP_REG_ADC, tmp); | ||
207 | mutex_unlock(&pcap->adc_mutex); | ||
208 | } | ||
209 | EXPORT_SYMBOL_GPL(pcap_set_ts_bits); | ||
210 | |||
198 | static void pcap_disable_adc(struct pcap_chip *pcap) | 211 | static void pcap_disable_adc(struct pcap_chip *pcap) |
199 | { | 212 | { |
200 | u32 tmp; | 213 | u32 tmp; |
@@ -217,15 +230,16 @@ static void pcap_adc_trigger(struct pcap_chip *pcap) | |||
217 | mutex_unlock(&pcap->adc_mutex); | 230 | mutex_unlock(&pcap->adc_mutex); |
218 | return; | 231 | return; |
219 | } | 232 | } |
220 | mutex_unlock(&pcap->adc_mutex); | 233 | /* start conversion on requested bank, save TS_M bits */ |
221 | 234 | ezx_pcap_read(pcap, PCAP_REG_ADC, &tmp); | |
222 | /* start conversion on requested bank */ | 235 | tmp &= (PCAP_ADC_TS_M_MASK | PCAP_ADC_TS_REF_LOWPWR); |
223 | tmp = pcap->adc_queue[head]->flags | PCAP_ADC_ADEN; | 236 | tmp |= pcap->adc_queue[head]->flags | PCAP_ADC_ADEN; |
224 | 237 | ||
225 | if (pcap->adc_queue[head]->bank == PCAP_ADC_BANK_1) | 238 | if (pcap->adc_queue[head]->bank == PCAP_ADC_BANK_1) |
226 | tmp |= PCAP_ADC_AD_SEL1; | 239 | tmp |= PCAP_ADC_AD_SEL1; |
227 | 240 | ||
228 | ezx_pcap_write(pcap, PCAP_REG_ADC, tmp); | 241 | ezx_pcap_write(pcap, PCAP_REG_ADC, tmp); |
242 | mutex_unlock(&pcap->adc_mutex); | ||
229 | ezx_pcap_write(pcap, PCAP_REG_ADR, PCAP_ADR_ASC); | 243 | ezx_pcap_write(pcap, PCAP_REG_ADR, PCAP_ADR_ASC); |
230 | } | 244 | } |
231 | 245 | ||