linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: ti_am335x_tscadc: fix spin lock and reg_cache
@ 2013-08-05 19:10 Zubair Lutfullah
  2013-08-07  8:40 ` Lee Jones
  0 siblings, 1 reply; 11+ messages in thread
From: Zubair Lutfullah @ 2013-08-05 19:10 UTC (permalink / raw)
  To: sameo, lee.jones; +Cc: linux-kernel, gregkh, bigeasy, zubair.lutfullah

Reg_cache variable is used to lock step enable register
from being accessed and written by both TSC and ADC
at the same time.
However, it isn't updated anywhere in the code at all.

If both TSC and ADC are used, eventually 1FFFF is always
written enabling all 16 steps uselessly causing a mess.

Patch fixes it by correcting the locks and updates the
variable by reading the step enable register

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
---
 drivers/mfd/ti_am335x_tscadc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index cd74d59..9f3f07a 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -57,10 +57,10 @@ EXPORT_SYMBOL_GPL(am335x_tsc_se_update);
 void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val)
 {
 	spin_lock(&tsadc->reg_lock);
+	tsadc->reg_se_cache = tscadc_readl(tsadc, REG_SE);
 	tsadc->reg_se_cache |= val;
-	spin_unlock(&tsadc->reg_lock);
-
 	am335x_tsc_se_update(tsadc);
+	spin_unlock(&tsadc->reg_lock);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_set);
 
-- 
1.7.9.5


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

end of thread, other threads:[~2013-10-25 15:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-05 19:10 [PATCH] mfd: ti_am335x_tscadc: fix spin lock and reg_cache Zubair Lutfullah
2013-08-07  8:40 ` Lee Jones
2013-10-22 13:15   ` Sebastian Andrzej Siewior
2013-10-22 15:48     ` Lee Jones
2013-10-22 16:28       ` Sebastian Andrzej Siewior
2013-10-25 15:53         ` Zubair Lutfullah :
2013-10-22 16:05     ` Lee Jones
2013-10-22 16:38       ` Sebastian Andrzej Siewior
2013-10-22 17:06         ` Lee Jones
2013-10-22 17:17           ` Sebastian Andrzej Siewior
2013-10-22 17:36             ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).