Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 367467
b: refs/heads/master
c: d4f510f
h: refs/heads/master
i:
  367465: 8666654
  367463: bc11d0b
v: v3
  • Loading branch information
Rupesh Kumar authored and Lee Jones committed Mar 7, 2013
1 parent dde3290 commit 517af80
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da9e83d496039458fe9863540cf52b3f9b450675
refs/heads/master: d4f510f6c3f579bac0dbeaa8dc7c2dc768c31786
17 changes: 16 additions & 1 deletion trunk/drivers/power/pm2301_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,12 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client,
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);
Expand All @@ -1084,7 +1090,7 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client,
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) {
Expand Down Expand Up @@ -1115,6 +1121,11 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client,

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);
Expand All @@ -1125,6 +1136,7 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client,
destroy_workqueue(pm2->charger_wq);
free_device_info:
kfree(pm2);

return ret;
}

Expand All @@ -1135,6 +1147,9 @@ static int pm2xxx_wall_charger_remove(struct i2c_client *i2c_client)
/* 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);

Expand Down

0 comments on commit 517af80

Please sign in to comment.