mfd: ti_am335x_tscadc: Update reg_cache variable in clr function
authorZubair Lutfullah <zubair.lutfullah@gmail.com>
Tue, 13 Aug 2013 16:40:56 +0000 (17:40 +0100)
committerLee Jones <lee.jones@linaro.org>
Wed, 14 Aug 2013 17:55:40 +0000 (18:55 +0100)
The reg_cache variable should be updated with current
steps in the reg_se register. Then the mask should
apply and clear the register. Previously, the reg_cache
can be an old redundant value that isn't updated.

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/ti_am335x_tscadc.c

index 9f3f07ad54bd77891c1b0b7c62e3aef166a0ceac..baaf5a8123bb8eba1aadffda901238acce2a9a98 100644 (file)
@@ -67,10 +67,10 @@ EXPORT_SYMBOL_GPL(am335x_tsc_se_set);
 void am335x_tsc_se_clr(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_clr);