Re: [PATCH] mfd: ti_am335x_tscadc: Restore clock divider on resume

2013-09-27 Thread Lee Jones
On Mon, 23 Sep 2013, Matthias Kaehlcke wrote:

> 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 
> 
> ---
>  drivers/mfd/ti_am335x_tscadc.c   |   10 ++
>  include/linux/mfd/ti_am335x_tscadc.h |1 +
>  2 files changed, 7 insertions(+), 4 deletions(-)

I would question why 'struct ti_tscadc_dev' has different names
throughout the driver, but that has nothing to do with this patch.

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mfd: ti_am335x_tscadc: Restore clock divider on resume

2013-09-27 Thread Lee Jones
On Mon, 23 Sep 2013, Matthias Kaehlcke wrote:

 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 matth...@kaehlcke.net
 
 ---
  drivers/mfd/ti_am335x_tscadc.c   |   10 ++
  include/linux/mfd/ti_am335x_tscadc.h |1 +
  2 files changed, 7 insertions(+), 4 deletions(-)

I would question why 'struct ti_tscadc_dev' has different names
throughout the driver, but that has nothing to do with this patch.

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: ti_am335x_tscadc: Restore clock divider on resume

2013-09-23 Thread Matthias Kaehlcke
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 

---
 drivers/mfd/ti_am335x_tscadc.c   |   10 ++
 include/linux/mfd/ti_am335x_tscadc.h |1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index baaf5a8..a3685d6 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -95,7 +95,7 @@ staticint 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 @@ staticint 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;
 }
 
diff --git a/include/linux/mfd/ti_am335x_tscadc.h 
b/include/linux/mfd/ti_am335x_tscadc.h
index 25f2c61..f03281d 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -146,6 +146,7 @@ struct ti_tscadc_dev {
struct mfd_cell cells[TSCADC_CELLS];
u32 reg_se_cache;
spinlock_t reg_lock;
+   unsigned int clk_div;
 
/* tsc device */
struct titsc *tsc;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: ti_am335x_tscadc: Restore clock divider on resume

2013-09-23 Thread Matthias Kaehlcke
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 matth...@kaehlcke.net

---
 drivers/mfd/ti_am335x_tscadc.c   |   10 ++
 include/linux/mfd/ti_am335x_tscadc.h |1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index baaf5a8..a3685d6 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -95,7 +95,7 @@ staticint 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 @@ staticint 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;
 }
 
diff --git a/include/linux/mfd/ti_am335x_tscadc.h 
b/include/linux/mfd/ti_am335x_tscadc.h
index 25f2c61..f03281d 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -146,6 +146,7 @@ struct ti_tscadc_dev {
struct mfd_cell cells[TSCADC_CELLS];
u32 reg_se_cache;
spinlock_t reg_lock;
+   unsigned int clk_div;
 
/* tsc device */
struct titsc *tsc;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/