Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
max8925_power: Check at probe time if power to set online
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Philip Rakity authored and enomsg committed Nov 26, 2011
1 parent b57f2f6 commit 00a159a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/power/max8925_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,15 @@ static __devinit int max8925_init_charger(struct max8925_chip *chip,
REQUEST_IRQ(MAX8925_IRQ_VCHG_TOPOFF, "charger-topoff");
REQUEST_IRQ(MAX8925_IRQ_VCHG_TMR_FAULT, "charger-timer-expire");

info->ac_online = 0;
info->usb_online = 0;
info->bat_online = 0;

/* check for power - can miss interrupt at boot time */
if (start_measure(info, MEASURE_VCHG) * 2000 > 500000)
info->ac_online = 1;
else
info->ac_online = 0;

ret = max8925_reg_read(info->gpm, MAX8925_CHG_STATUS);
if (ret >= 0) {
/*
Expand Down

0 comments on commit 00a159a

Please sign in to comment.