提交 45491ada 编写于 作者: Z Zubair Lutfullah 提交者: Lee Jones

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: NZubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: NLee Jones <lee.jones@linaro.org>
上级 e293e847
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册