MLK-21368 typec: tcpci: disable irq when system suspend
authorLi Jun <jun.li@nxp.com>
Thu, 25 Apr 2019 16:10:16 +0000 (21:40 +0530)
committerLeonard Crestez <leonard.crestez@nxp.com>
Thu, 2 May 2019 08:35:32 +0000 (11:35 +0300)
Disable typec irq when suspend to avoid the threaded irq to access
some resource(e.g. i2c over rpmsg) but those resource is not
available at later phrase, also use IRQ_DISABLE_UNLAZY flag to
mask the irq on irq chip level when irq happens.

Suggested-by: Anson Huang <anson.huang@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 61869f787fb0ee2f00d0fe9443cb8b487e16e5ec)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com>
(cherry picked from commit 3b1fd5d8ccc9545818ead8bf1dcccb47bfd5c9e6)

drivers/usb/typec/tcpci.c

index f17b565..944e61b 100644 (file)
@@ -808,6 +808,7 @@ static int tcpci_probe(struct i2c_client *client,
        if (err)
                goto err1;
 
+       irq_set_status_flags(client->irq, IRQ_DISABLE_UNLAZY);
        err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
                                        _tcpci_irq,
                                        IRQF_ONESHOT | IRQF_TRIGGER_LOW,
@@ -828,6 +829,7 @@ static int tcpci_remove(struct i2c_client *client)
        struct tcpci_chip *chip = i2c_get_clientdata(client);
 
        tcpci_unregister_port(chip->tcpci);
+       irq_clear_status_flags(client->irq, IRQ_DISABLE_UNLAZY);
 
        return 0;
 }
@@ -838,6 +840,8 @@ static int tcpci_suspend(struct device *dev)
 
        if (device_may_wakeup(dev))
                enable_irq_wake(chip->tcpci->client->irq);
+       else
+               disable_irq(tcpci->client->irq);
 
        return 0;
 }
@@ -848,6 +852,8 @@ static int tcpci_resume(struct device *dev)
 
        if (device_may_wakeup(dev))
                disable_irq_wake(chip->tcpci->client->irq);
+       else
+               enable_irq(tcpci->client->irq);
 
        return 0;
 }