aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c10
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h1
2 files changed, 7 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
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 4befdb85dd9c..7b68a061cd60 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -151,6 +151,7 @@ struct ti_tscadc_dev {
151 struct mfd_cell cells[TSCADC_CELLS]; 151 struct mfd_cell cells[TSCADC_CELLS];
152 u32 reg_se_cache; 152 u32 reg_se_cache;
153 spinlock_t reg_lock; 153 spinlock_t reg_lock;
154 unsigned int clk_div;
154 155
155 /* tsc device */ 156 /* tsc device */
156 struct titsc *tsc; 157 struct titsc *tsc;