summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorZubair Lutfullah <zubair.lutfullah@gmail.com>2013-08-05 20:10:45 +0100
committerLee Jones <lee.jones@linaro.org>2013-08-14 18:53:03 +0100
commit45491ada9830cd22e386499cbeb7cab2f24a1136 (patch)
tree555887d6d4d01558b86a1d825078d8cb9e00f34c /drivers/mfd
parente293e847275b2d1a4768ca25f0933a70b2383016 (diff)
downloadlinux-45491ada9830cd22e386499cbeb7cab2f24a1136.tar.gz
linux-45491ada9830cd22e386499cbeb7cab2f24a1136.tar.bz2
linux-45491ada9830cd22e386499cbeb7cab2f24a1136.zip
mfd: ti_am335x_tscadc: Fix spin lock and reg_cache
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> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index cd74d594c563..9f3f07ad54bd 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);