diff options
author | Philip Rakity <prakity@marvell.com> | 2011-09-01 22:20:01 -0400 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2011-11-25 19:32:46 -0500 |
commit | 00a159a5567232fbe1dd85bc611c55f53943b0fc (patch) | |
tree | 684721d12271fecb5b42daca52e79cab6bbc28d8 /drivers/power | |
parent | b57f2f6108fbf9ce33191fb574fe94b1f3ccbff3 (diff) |
max8925_power: Check at probe time if power to set online
The interrupt for ac on/off can be missed during boot time.
Check if online by seeing if we have power. We choose 0.5V
since this is high enough to avoid random reading from a
input that could be floating if no charger.
Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Ted Bennett <tbennett@marvell.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/max8925_power.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index d87032afcb5a..815525094ff9 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c | |||
@@ -377,9 +377,15 @@ static __devinit int max8925_init_charger(struct max8925_chip *chip, | |||
377 | REQUEST_IRQ(MAX8925_IRQ_VCHG_TOPOFF, "charger-topoff"); | 377 | REQUEST_IRQ(MAX8925_IRQ_VCHG_TOPOFF, "charger-topoff"); |
378 | REQUEST_IRQ(MAX8925_IRQ_VCHG_TMR_FAULT, "charger-timer-expire"); | 378 | REQUEST_IRQ(MAX8925_IRQ_VCHG_TMR_FAULT, "charger-timer-expire"); |
379 | 379 | ||
380 | info->ac_online = 0; | ||
381 | info->usb_online = 0; | 380 | info->usb_online = 0; |
382 | info->bat_online = 0; | 381 | info->bat_online = 0; |
382 | |||
383 | /* check for power - can miss interrupt at boot time */ | ||
384 | if (start_measure(info, MEASURE_VCHG) * 2000 > 500000) | ||
385 | info->ac_online = 1; | ||
386 | else | ||
387 | info->ac_online = 0; | ||
388 | |||
383 | ret = max8925_reg_read(info->gpm, MAX8925_CHG_STATUS); | 389 | ret = max8925_reg_read(info->gpm, MAX8925_CHG_STATUS); |
384 | if (ret >= 0) { | 390 | if (ret >= 0) { |
385 | /* | 391 | /* |