Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

extcon: sm5502: Reset registers during initialization

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>

authored by

Stephan Gerhold and committed by
Chanwoo Choi
69426350 e81b8893

+6
+4
drivers/extcon/extcon-sm5502.c
··· 65 65 /* Default value of SM5502 register to bring up MUIC device. */ 66 66 static struct reg_data sm5502_reg_data[] = { 67 67 { 68 + .reg = SM5502_REG_RESET, 69 + .val = SM5502_REG_RESET_MASK, 70 + .invert = true, 71 + }, { 68 72 .reg = SM5502_REG_CONTROL, 69 73 .val = SM5502_REG_CONTROL_MASK_INT_MASK, 70 74 .invert = false,
+2
drivers/extcon/extcon-sm5502.h
··· 237 237 #define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ 238 238 | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) 239 239 240 + #define SM5502_REG_RESET_MASK (0x1) 241 + 240 242 /* SM5502 Interrupts */ 241 243 enum sm5502_irq { 242 244 /* INT1 */