aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ti_am335x_tscadc.c
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.list@kaehlcke.net>2013-09-23 16:43:29 -0400
committerLee Jones <lee.jones@linaro.org>2013-10-23 11:21:14 -0400
commite90f875419967589d75d1a3e2b89c5f2720e794e (patch)
treee4b447602c1c50dd363e122915a7b68de4f34fa5 /drivers/mfd/ti_am335x_tscadc.c
parent60013b94d9530346db963474f7fde8aecabaff25 (diff)
mfd: ti_am335x_tscadc: Restore clock divider on resume
The ADC clock divider needs to be restored on resume as the register content is lost when the ADC is powered down Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/ti_am335x_tscadc.c')
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index baaf5a8123bb..a3685d6ef674 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -95,7 +95,7 @@ static int ti_tscadc_probe(struct platform_device *pdev)
95 const __be32 *cur; 95 const __be32 *cur;
96 u32 val; 96 u32 val;
97 int err, ctrl; 97 int err, ctrl;
98 int clk_value, clock_rate; 98 int clock_rate;
99 int tsc_wires = 0, adc_channels = 0, total_channels; 99 int tsc_wires = 0, adc_channels = 0, total_channels;
100 int readouts = 0; 100 int readouts = 0;
101 101
@@ -196,11 +196,11 @@ static int ti_tscadc_probe(struct platform_device *pdev)
196 } 196 }
197 clock_rate = clk_get_rate(clk); 197 clock_rate = clk_get_rate(clk);
198 clk_put(clk); 198 clk_put(clk);
199 clk_value = clock_rate / ADC_CLK; 199 tscadc->clk_div = clock_rate / ADC_CLK;
200 200
201 /* TSCADC_CLKDIV needs to be configured to the value minus 1 */ 201 /* TSCADC_CLKDIV needs to be configured to the value minus 1 */
202 clk_value = clk_value - 1; 202 tscadc->clk_div--;
203 tscadc_writel(tscadc, REG_CLKDIV, clk_value); 203 tscadc_writel(tscadc, REG_CLKDIV, tscadc->clk_div);
204 204
205 /* Set the control register bits */ 205 /* Set the control register bits */
206 ctrl = CNTRLREG_STEPCONFIGWRT | 206 ctrl = CNTRLREG_STEPCONFIGWRT |
@@ -303,6 +303,8 @@ static int tscadc_resume(struct device *dev)
303 tscadc_writel(tscadc_dev, REG_CTRL, 303 tscadc_writel(tscadc_dev, REG_CTRL,
304 (restore | CNTRLREG_TSCSSENB)); 304 (restore | CNTRLREG_TSCSSENB));
305 305
306 tscadc_writel(tscadc_dev, REG_CLKDIV, tscadc_dev->clk_div);
307
306 return 0; 308 return 0;
307} 309}
308 310