From c73d42c876f0f10d03c92411074b90c8a038f39d Mon Sep 17 00:00:00 2001 From: mahj8 Date: Tue, 28 Dec 2021 16:38:26 +0800 Subject: [PATCH] charging: enable irq wake up when system suspend and then inserted charger, the system can't wake up and update charger info. Change-Id: Idb69dfc330b93d5929ce1b10b5c95491d6997aff Signed-off-by: mahj8 Reviewed-on: https://gerrit.mot.com/2155893 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../power/bq2589x_chg_mmi/bq2589x_charger.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/power/bq2589x_chg_mmi/bq2589x_charger.c b/drivers/power/bq2589x_chg_mmi/bq2589x_charger.c index 77e3b8b3df5c..091332f84fc4 100644 --- a/drivers/power/bq2589x_chg_mmi/bq2589x_charger.c +++ b/drivers/power/bq2589x_chg_mmi/bq2589x_charger.c @@ -2710,13 +2710,18 @@ static int bq2589x_charger_probe(struct i2c_client *client, goto err_irq; } - ret = devm_request_threaded_irq(dev, client->irq, NULL, - bq2589x_charger_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, BQ25890_IRQ_PIN, bq); - if (ret) { - dev_err(dev, "%s:Request IRQ %d failed: %d\n", __func__, client->irq, ret); - goto err_irq; - } else { - dev_info(dev, "%s:irq = %d\n", __func__, client->irq); + if (client->irq) { + ret = devm_request_threaded_irq(dev, client->irq, NULL, + bq2589x_charger_interrupt, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + BQ25890_IRQ_PIN, bq); + if (ret) { + dev_err(dev, "%s:Request IRQ %d failed: %d\n", __func__, client->irq, ret); + goto err_irq; + } else { + dev_info(dev, "%s:irq = %d\n", __func__, client->irq); + enable_irq_wake(client->irq); + } } #ifdef CONFIG_MMI_QC3P_TURBO_CHARGER