pm2xxx_charger_irq[0].name, pm2->pdata->irq_number, ret);
goto unregister_pm2xxx_charger;
}
+ /* pm interrupt can wake up system */
+ ret = enable_irq_wake(pm2->pdata->irq_number);
+ if (ret) {
+ dev_err(pm2->dev, "failed to set irq wake\n");
+ goto unregister_pm2xxx_interrupt;
+ }
/*Initialize lock*/
mutex_init(&pm2->lock);
ret = gpio_request(pm2->lpn_pin, "pm2301_lpm_gpio");
if (ret < 0) {
dev_err(pm2->dev, "pm2301_lpm_gpio request failed\n");
- goto unregister_pm2xxx_charger;
+ goto disable_pm2_irq_wake;
}
ret = gpio_direction_output(pm2->lpn_pin, 0);
if (ret < 0) {
free_gpio:
gpio_free(pm2->lpn_pin);
+disable_pm2_irq_wake:
+ disable_irq_wake(pm2->pdata->irq_number);
+unregister_pm2xxx_interrupt:
+ /* disable interrupt */
+ free_irq(pm2->pdata->irq_number, pm2);
unregister_pm2xxx_charger:
/* unregister power supply */
power_supply_unregister(&pm2->ac_chg.psy);
destroy_workqueue(pm2->charger_wq);
free_device_info:
kfree(pm2);
+
return ret;
}
/* Disable AC charging */
pm2xxx_charger_ac_en(&pm2->ac_chg, false, 0, 0);
+ /* Disable wake by pm interrupt */
+ disable_irq_wake(pm2->pdata->irq_number);
+
/* Disable interrupts */
free_irq(pm2->pdata->irq_number, pm2);