From 3aaf2019e9e16d4dc9db37e71dd5a8400b73c530 Mon Sep 17 00:00:00 2001 From: Li Jun Date: Thu, 25 Apr 2019 21:40:16 +0530 Subject: [PATCH] MLK-21368 typec: tcpci: disable irq when system suspend 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 Acked-by: Peter Chen Signed-off-by: Li Jun (cherry picked from commit 61869f787fb0ee2f00d0fe9443cb8b487e16e5ec) Signed-off-by: Arulpandiyan Vadivel Signed-off-by: Shrikant Bobade (cherry picked from commit 3b1fd5d8ccc9545818ead8bf1dcccb47bfd5c9e6) --- drivers/usb/typec/tcpci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/typec/tcpci.c b/drivers/usb/typec/tcpci.c index f17b565aa1fa..944e61be07d0 100644 --- a/drivers/usb/typec/tcpci.c +++ b/drivers/usb/typec/tcpci.c @@ -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; } -- 2.17.1