diff options
author | Matthias Kaehlcke <matthias.list@kaehlcke.net> | 2013-09-23 22:43:29 +0200 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2013-10-23 16:21:14 +0100 |
commit | e90f875419967589d75d1a3e2b89c5f2720e794e (patch) | |
tree | e4b447602c1c50dd363e122915a7b68de4f34fa5 /drivers/mfd | |
parent | 60013b94d9530346db963474f7fde8aecabaff25 (diff) | |
download | blackbird-op-linux-e90f875419967589d75d1a3e2b89c5f2720e794e.tar.gz blackbird-op-linux-e90f875419967589d75d1a3e2b89c5f2720e794e.zip |
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')
-rw-r--r-- | drivers/mfd/ti_am335x_tscadc.c | 10 |
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) const __be32 *cur; u32 val; int err, ctrl; - int clk_value, clock_rate; + int clock_rate; int tsc_wires = 0, adc_channels = 0, total_channels; int readouts = 0; @@ -196,11 +196,11 @@ static int ti_tscadc_probe(struct platform_device *pdev) } clock_rate = clk_get_rate(clk); clk_put(clk); - clk_value = clock_rate / ADC_CLK; + tscadc->clk_div = clock_rate / ADC_CLK; /* TSCADC_CLKDIV needs to be configured to the value minus 1 */ - clk_value = clk_value - 1; - tscadc_writel(tscadc, REG_CLKDIV, clk_value); + tscadc->clk_div--; + tscadc_writel(tscadc, REG_CLKDIV, tscadc->clk_div); /* Set the control register bits */ ctrl = CNTRLREG_STEPCONFIGWRT | @@ -303,6 +303,8 @@ static int tscadc_resume(struct device *dev) tscadc_writel(tscadc_dev, REG_CTRL, (restore | CNTRLREG_TSCSSENB)); + tscadc_writel(tscadc_dev, REG_CLKDIV, tscadc_dev->clk_div); + return 0; } |