aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c13
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h1
2 files changed, 6 insertions, 8 deletions
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 467c80e1c4ae..e4e4b22eebc9 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -68,12 +68,6 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
68 DEFINE_WAIT(wait); 68 DEFINE_WAIT(wait);
69 u32 reg; 69 u32 reg;
70 70
71 /*
72 * disable TSC steps so it does not run while the ADC is using it. If
73 * write 0 while it is running (it just started or was already running)
74 * then it completes all steps that were enabled and stops then.
75 */
76 tscadc_writel(tsadc, REG_SE, 0);
77 reg = tscadc_readl(tsadc, REG_ADCFSM); 71 reg = tscadc_readl(tsadc, REG_ADCFSM);
78 if (reg & SEQ_STATUS) { 72 if (reg & SEQ_STATUS) {
79 tsadc->adc_waiting = true; 73 tsadc->adc_waiting = true;
@@ -86,8 +80,12 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
86 spin_lock_irq(&tsadc->reg_lock); 80 spin_lock_irq(&tsadc->reg_lock);
87 finish_wait(&tsadc->reg_se_wait, &wait); 81 finish_wait(&tsadc->reg_se_wait, &wait);
88 82
83 /*
84 * Sequencer should either be idle or
85 * busy applying the charge step.
86 */
89 reg = tscadc_readl(tsadc, REG_ADCFSM); 87 reg = tscadc_readl(tsadc, REG_ADCFSM);
90 WARN_ON(reg & SEQ_STATUS); 88 WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
91 tsadc->adc_waiting = false; 89 tsadc->adc_waiting = false;
92 } 90 }
93 tsadc->adc_in_use = true; 91 tsadc->adc_in_use = true;
@@ -96,7 +94,6 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
96void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val) 94void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
97{ 95{
98 spin_lock_irq(&tsadc->reg_lock); 96 spin_lock_irq(&tsadc->reg_lock);
99 tsadc->reg_se_cache |= val;
100 am335x_tscadc_need_adc(tsadc); 97 am335x_tscadc_need_adc(tsadc);
101 98
102 tscadc_writel(tsadc, REG_SE, val); 99 tscadc_writel(tsadc, REG_SE, val);
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 3f4e994ace2b..1fd50dcfe47c 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -128,6 +128,7 @@
128 128
129/* Sequencer Status */ 129/* Sequencer Status */
130#define SEQ_STATUS BIT(5) 130#define SEQ_STATUS BIT(5)
131#define CHARGE_STEP 0x11
131 132
132#define ADC_CLK 3000000 133#define ADC_CLK 3000000
133#define TOTAL_STEPS 16 134#define TOTAL_STEPS 16