Input: pm8xxx-vib - fix handling of separate enable register
authorStephan Gerhold <stephan@gerhold.net>
Fri, 17 Jan 2020 21:40:36 +0000 (13:40 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 14:02:38 +0000 (15:02 +0100)
commit1130377fb5a8095a13c23018edadbabbec7f7fef
tree19e61f8473da577ae99181a1af6c75d07332385a
parentc57b0f88fce8b4f697f323cfb3b7acc195b7560f
Input: pm8xxx-vib - fix handling of separate enable register

commit 996d5d5f89a558a3608a46e73ccd1b99f1b1d058 upstream.

Setting the vibrator enable_mask is not implemented correctly:

For regmap_update_bits(map, reg, mask, val) we give in either
regs->enable_mask or 0 (= no-op) as mask and "val" as value.
But "val" actually refers to the vibrator voltage control register,
which has nothing to do with the enable_mask.

So we usually end up doing nothing when we really wanted
to enable the vibrator.

We want to set or clear the enable_mask (to enable/disable the vibrator).
Therefore, change the call to always modify the enable_mask
and set the bits only if we want to enable the vibrator.

Fixes: d4c7c5c96c92 ("Input: pm8xxx-vib - handle separate enable register")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20200114183442.45720-1-stephan@gerhold.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/misc/pm8xxx-vibrator.c