sc760x: Do not enable IRQ until sc760x gpio enable

sc760x_mmi_charger:
Do not enable IRQ until SC760x gpio enable

Change-Id: If74f94c55be02e02b5318d198928a65577483c9d
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2547822
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
xuwt2 2023-03-21 21:05:06 +08:00 • committed by Wentao Xu
commit e144cc561d
2 changed files with 16 additions and 1 deletions

View file

@ -230,10 +230,22 @@ static int sc760x_enable_chip(struct sc760x_chip *sc, bool en)
sc->sc760x_enable = en;
if (sc->sc760x_enable) {
if (!sc->irq_enabled) {
enable_irq_wake(sc->irq);
enable_irq(sc->irq);
sc->irq_enable = true;
}
ret = sc760x_init_device(sc);
if (ret < 0) {
pr_info("init device failed(%d)\n", ret);
}
} else {
if (sc->irq_enabled) {
disable_irq_wake(sc->irq);
disable_irq(sc->irq);
sc->irq_enable = false;
}
}
dev_err(sc->dev, "success to set %s state, sleep 2s\n", pinctrl_name);
@ -1166,7 +1178,9 @@ static int sc760x_register_interrupt(struct sc760x_chip *sc, struct i2c_client *
return ret;
}
enable_irq_wake(client->irq);
disable_irq_wake(client->irq);
disable_irq(client->irq);
sc->irq_enabled = false;
sc->irq = client->irq;
dev_err(sc->dev, "request thread irq success\n");
return 0;

View file

@ -199,6 +199,7 @@ struct sc760x_chip {
int user_gpio_en; /* user gpio en */
int irq;
bool irq_enabled;
int role;
int sc760x_enable;
u32 *thermal_levels;