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

Commit 00a159a

Browse files
Philip Rakityenomsg
authored andcommitted
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 <[email protected]> Signed-off-by: Ted Bennett <[email protected]> Signed-off-by: Anton Vorontsov <[email protected]>
1 parent b57f2f6 commit 00a159a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/power/max8925_power.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,15 @@ static __devinit int max8925_init_charger(struct max8925_chip *chip,
377377
REQUEST_IRQ(MAX8925_IRQ_VCHG_TOPOFF, "charger-topoff");
378378
REQUEST_IRQ(MAX8925_IRQ_VCHG_TMR_FAULT, "charger-timer-expire");
379379

380-
info->ac_online = 0;
381380
info->usb_online = 0;
382381
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+
383389
ret = max8925_reg_read(info->gpm, MAX8925_CHG_STATUS);
384390
if (ret >= 0) {
385391
/*

0 commit comments

Comments
 (0)