]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
extcon: sm5502: Reset registers during initialization
authorStephan Gerhold <stephan@gerhold.net>
Thu, 10 Oct 2019 15:47:20 +0000 (17:47 +0200)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 11 Oct 2019 01:43:26 +0000 (10:43 +0900)
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>
drivers/extcon/extcon-sm5502.c
drivers/extcon/extcon-sm5502.h

index dc43847ad2b0809401dd21373c0c4df992cd171f..b3d93baf4fc584190e4fe5150a5ad85b2302b738 100644 (file)
@@ -65,6 +65,10 @@ struct sm5502_muic_info {
 /* Default value of SM5502 register to bring up MUIC device. */
 static struct reg_data sm5502_reg_data[] = {
        {
+               .reg = SM5502_REG_RESET,
+               .val = SM5502_REG_RESET_MASK,
+               .invert = true,
+       }, {
                .reg = SM5502_REG_CONTROL,
                .val = SM5502_REG_CONTROL_MASK_INT_MASK,
                .invert = false,
index 9dbb634d213b7076f083185a85972354bdd95b7f..ce1f1ec310c49ee53a6ff4c219c4774b96274e6c 100644 (file)
@@ -237,6 +237,8 @@ enum sm5502_reg {
 #define DM_DP_SWITCH_UART                      ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
                                                | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
 
+#define SM5502_REG_RESET_MASK                  (0x1)
+
 /* SM5502 Interrupts */
 enum sm5502_irq {
        /* INT1 */