public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ti_am335x_adc: Fix TSC operation after ADC continouous mode
@ 2014-08-28  9:07 Vignesh R
  2014-08-28 13:34 ` Felipe Balbi
  2014-08-28 15:47 ` Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Vignesh R @ 2014-08-28  9:07 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, Sebastian Andrzej Siewior,
	Jonathan Cameron
  Cc: nsekhar, Felipe Balbi, linux-iio, Vignesh R

After enabling and disabling ADC continuous mode via sysfs, ts_print_raw
fails to return any data. This is because when ADC is configured for
continuous mode, it disables touch screen steps.These steps are not
re-enabled when ADC continuous mode is disabled. Therefore existing values
of REG_SE needs to be cached before enabling continuous mode and
disabling touch screen steps and enabling ADC steps. The cached value
are to be restored to REG_SE once ADC is disabled.

Fixes: 7ca6740cd1cd ("The continues-read mode remains unchanged")

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 drivers/mfd/ti_am335x_tscadc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index d4e860413bb5..e3076afe6b3c 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -54,7 +54,7 @@ void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tsadc, u32 val)
 	unsigned long flags;
 
 	spin_lock_irqsave(&tsadc->reg_lock, flags);
-	tsadc->reg_se_cache = val;
+	tsadc->reg_se_cache |= val;
 	if (tsadc->adc_waiting)
 		wake_up(&tsadc->reg_se_wait);
 	else if (!tsadc->adc_in_use)
@@ -97,6 +97,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
 void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
 {
 	spin_lock_irq(&tsadc->reg_lock);
+	tsadc->reg_se_cache |= val;
 	am335x_tscadc_need_adc(tsadc);
 
 	tscadc_writel(tsadc, REG_SE, val);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ti_am335x_adc: Fix TSC operation after ADC continouous mode
  2014-08-28  9:07 [PATCH] iio: adc: ti_am335x_adc: Fix TSC operation after ADC continouous mode Vignesh R
@ 2014-08-28 13:34 ` Felipe Balbi
  2014-08-28 15:47 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2014-08-28 13:34 UTC (permalink / raw)
  To: Vignesh R
  Cc: Samuel Ortiz, Lee Jones, Sebastian Andrzej Siewior,
	Jonathan Cameron, nsekhar, Felipe Balbi, linux-iio

[-- Attachment #1: Type: text/plain, Size: 1705 bytes --]

On Thu, Aug 28, 2014 at 02:37:00PM +0530, Vignesh R wrote:
> After enabling and disabling ADC continuous mode via sysfs, ts_print_raw
> fails to return any data. This is because when ADC is configured for
> continuous mode, it disables touch screen steps.These steps are not
> re-enabled when ADC continuous mode is disabled. Therefore existing values
> of REG_SE needs to be cached before enabling continuous mode and
> disabling touch screen steps and enabling ADC steps. The cached value
> are to be restored to REG_SE once ADC is disabled.
> 
> Fixes: 7ca6740cd1cd ("The continues-read mode remains unchanged")
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>

looks like this should Cc stable

> ---
>  drivers/mfd/ti_am335x_tscadc.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index d4e860413bb5..e3076afe6b3c 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -54,7 +54,7 @@ void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tsadc, u32 val)
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&tsadc->reg_lock, flags);
> -	tsadc->reg_se_cache = val;
> +	tsadc->reg_se_cache |= val;
>  	if (tsadc->adc_waiting)
>  		wake_up(&tsadc->reg_se_wait);
>  	else if (!tsadc->adc_in_use)
> @@ -97,6 +97,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
>  void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
>  {
>  	spin_lock_irq(&tsadc->reg_lock);
> +	tsadc->reg_se_cache |= val;
>  	am335x_tscadc_need_adc(tsadc);
>  
>  	tscadc_writel(tsadc, REG_SE, val);
> -- 
> 1.7.9.5
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ti_am335x_adc: Fix TSC operation after ADC continouous mode
  2014-08-28  9:07 [PATCH] iio: adc: ti_am335x_adc: Fix TSC operation after ADC continouous mode Vignesh R
  2014-08-28 13:34 ` Felipe Balbi
@ 2014-08-28 15:47 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2014-08-28 15:47 UTC (permalink / raw)
  To: Vignesh R
  Cc: Samuel Ortiz, Sebastian Andrzej Siewior, Jonathan Cameron,
	nsekhar, Felipe Balbi, linux-iio

On Thu, 28 Aug 2014, Vignesh R wrote:

> After enabling and disabling ADC continuous mode via sysfs, ts_print_raw
> fails to return any data. This is because when ADC is configured for
> continuous mode, it disables touch screen steps.These steps are not
> re-enabled when ADC continuous mode is disabled. Therefore existing values
> of REG_SE needs to be cached before enabling continuous mode and
> disabling touch screen steps and enabling ADC steps. The cached value
> are to be restored to REG_SE once ADC is disabled.
> 
> Fixes: 7ca6740cd1cd ("The continues-read mode remains unchanged")
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  drivers/mfd/ti_am335x_tscadc.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Please re-submit after doing 3 things:
 - Change the $SUBJECT line (this is not an IIO patch)
 - Add Cc: stable@vger.kernel.org
 - Apply my: Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index d4e860413bb5..e3076afe6b3c 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -54,7 +54,7 @@ void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tsadc, u32 val)
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&tsadc->reg_lock, flags);
> -	tsadc->reg_se_cache = val;
> +	tsadc->reg_se_cache |= val;
>  	if (tsadc->adc_waiting)
>  		wake_up(&tsadc->reg_se_wait);
>  	else if (!tsadc->adc_in_use)
> @@ -97,6 +97,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
>  void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
>  {
>  	spin_lock_irq(&tsadc->reg_lock);
> +	tsadc->reg_se_cache |= val;
>  	am335x_tscadc_need_adc(tsadc);
>  
>  	tscadc_writel(tsadc, REG_SE, val);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-28 15:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28  9:07 [PATCH] iio: adc: ti_am335x_adc: Fix TSC operation after ADC continouous mode Vignesh R
2014-08-28 13:34 ` Felipe Balbi
2014-08-28 15:47 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox