summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonghwa Lee <jonghwa3.lee@samsung.com>2014-10-21 07:38:58 (GMT)
committerChanho Park <chanho61.park@samsung.com>2014-11-18 03:01:02 (GMT)
commit361f1558dfc48cab51df9d2194fcb1301dcb65e9 (patch)
treeed83ce2072e0bca93beef0a9b2153a1e8c64783d
parent0f5bcde2ecd7e9900791b2ce0b087623dc150d7c (diff)
downloadlinux-3.10-361f1558dfc48cab51df9d2194fcb1301dcb65e9.zip
linux-3.10-361f1558dfc48cab51df9d2194fcb1301dcb65e9.tar.gz
linux-3.10-361f1558dfc48cab51df9d2194fcb1301dcb65e9.tar.bz2
power: charger-manager: Get external power souce information only from EXTCON.
When charger-manager checks whether external power source is available, it gets information from charger IC driver. However, it's not correct source, charger IC doesn't have responsibilty to give cable connection status. The charger-manager already gets cable information from EXTCON susbsystem, so it can re-use it. Change-Id: I408546beefe63707fcb927db7d92c4005f3848f8 Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
-rw-r--r--drivers/power/charger-manager.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 774f9cb..572c0fb 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -110,28 +110,27 @@ static bool is_batt_present(struct charger_manager *cm)
* is_ext_pwr_online - See if an external power source is attached to charge
* @cm: the Charger Manager representing the battery.
*
- * Returns true if at least one of the chargers of the battery has an external
- * power source attached to charge the battery regardless of whether it is
- * actually charging or not.
+ * Returns true if there is external power source.
+ * Cable connection information is only obtained by EXTCON class notification.
*/
static bool is_ext_pwr_online(struct charger_manager *cm)
{
- union power_supply_propval val;
- bool online = false;
- int i, ret;
+ struct charger_desc *desc = cm->desc;
+ struct charger_regulator *regulators = desc->charger_regulators;
+ struct charger_cable *cables;
+ int i, j, num_cables;
/* If at least one of them has one, it's yes. */
- for (i = 0; i < cm->desc->num_chargers; i++) {
- ret = cm->charger_stat[i]->get_property(
- cm->charger_stat[i],
- POWER_SUPPLY_PROP_ONLINE, &val);
- if (ret == 0 && val.intval) {
- online = true;
- break;
+ for (i = 0; i < desc->num_charger_regulators; i++) {
+ cables = regulators[i].cables;
+ num_cables = regulators[i].num_cables;
+ for (j = 0; j < num_cables; j++) {
+ if (cables[j].attached)
+ return true;
}
}
- return online;
+ return false;
}
/**