[<prev] [next>] [day] [month] [year] [list]
Message-ID: <D3390D73-F351-438B-8D25-928539495DC8@marvell.com>
Date: Thu, 1 Sep 2011 19:11:16 -0700
From: Philip Rakity <prakity@...vell.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] power: max8925_power.c 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@...vell.com>
Signed-off-by: Ted Bennett <tbennett@...vell.com>
---
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 b56c78a..31d84c4 100644
--- a/drivers/power/max8925_power.c
+++ b/drivers/power/max8925_power.c
@@ -495,9 +495,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) {
/*
--
1.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists