extcon: sm5502: Reset registers during initialization
authorStephan Gerhold <stephan@gerhold.net>
Thu, 10 Oct 2019 15:47:20 +0000 (17:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 11:37:06 +0000 (12:37 +0100)
commite9555e31fe7a853f18bd6ecea74b575e9262ce2c
tree81d14ceada6351b9f1ccb09b2ac2aaf1e004f6ef
parent23df4c40de1ebe4fbf97d1303990bf5601889bc2
extcon: sm5502: Reset registers during initialization

[ Upstream commit 6942635032cfd3e003e980d2dfa4e6323a3ce145 ]

On some devices (e.g. Samsung Galaxy A5 (2015)), the bootloader
seems to keep interrupts enabled for SM5502 when booting Linux.
Changing the cable state (i.e. plugging in a cable) - until the driver
is loaded - will therefore produce an interrupt that is never read.

In this situation, the cable state will be stuck forever on the
initial state because SM5502 stops sending interrupts.
This can be avoided by clearing those pending interrupts after
the driver has been loaded.

One way to do this is to reset all registers to default state
by writing to SM5502_REG_RESET. This ensures that we start from
a clean state, with all interrupts disabled.

Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/extcon/extcon-sm5502.c
drivers/extcon/extcon-sm5502.h