With edge irq support, the ALERT event may be missed currently. The reason is that ALERT_MASK register is written before devm_request_threaded_irq(). If ALERT event happens in this time gap, it will be missed and ALERT line will not recover to high level. However, we don't meet this issue with level irq. To avoid the issue, this will set ALERT_MASK register after devm_request_threaded_irq() return. Fixes: 77e85107a771 ("usb: typec: tcpci: support edge irq") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Xu Yang <xu.yang_2@xxxxxxx> --- Changes in v3: - remove set_alert_mask flag Changes in v2: - new patch --- drivers/usb/typec/tcpm/tcpci.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index db42f4bf3632..48762508cc86 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -700,7 +700,7 @@ static int tcpci_init(struct tcpc_dev *tcpc) tcpci->alert_mask = reg; - return tcpci_write16(tcpci, TCPC_ALERT_MASK, reg); + return 0; } irqreturn_t tcpci_irq(struct tcpci *tcpci) @@ -931,12 +931,19 @@ static int tcpci_probe(struct i2c_client *client) _tcpci_irq, IRQF_SHARED | IRQF_ONESHOT, dev_name(&client->dev), chip); - if (err < 0) { - tcpci_unregister_port(chip->tcpci); - return err; - } + if (err < 0) + goto unregister_port; + + /* Enable chip interrupts at last */ + err = tcpci_write16(chip->tcpci, TCPC_ALERT_MASK, chip->tcpci->alert_mask); + if (err < 0) + goto unregister_port; return 0; + +unregister_port: + tcpci_unregister_port(chip->tcpci); + return err; } static void tcpci_remove(struct i2c_client *client) -- 2.34.1