aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Chen <intervigil@gmail.com>2015-03-26 14:16:56 -0700
committerEthan Chen <intervigil@gmail.com>2015-03-26 14:24:10 -0700
commit3c89365d85b3a452c9242072d709973d262c03ae (patch)
tree0a9bc9b4147ebce5aa536f1fec69d14602bad736
parent4349193e2e1b88614a6f394265c71ba1295e21b7 (diff)
power: yl_fan5405: Check OTG mode in addition to VBUS status
* Current code assumes charging if VBUS is present, even though this is true in the case OTG is enabled. * Check OTG mode as well. Change-Id: Ib9acf262351bfb28b81d67fa9587e02676388530
-rw-r--r--drivers/power/yl_fan5405_charger.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/power/yl_fan5405_charger.c b/drivers/power/yl_fan5405_charger.c
index e9d5e8de50f..7bc4bd43ee0 100644
--- a/drivers/power/yl_fan5405_charger.c
+++ b/drivers/power/yl_fan5405_charger.c
@@ -56,6 +56,7 @@ struct fan5405_chip {
bool batt_temp_mark;
int charge_stat;
+ bool otg_enabled;
bool vbus_present;
/* battery status tracking */
bool batt_present;
@@ -1054,7 +1055,7 @@ static int fan5405_get_prop_batt_status(struct fan5405_chip *chip)
}
chip->vbus_present = (1 == get_yl_pm8916_vbus_status());
- if (true == chip->vbus_present) {
+ if (true == chip->vbus_present && !chip->otg_enabled) {
if (chip->batt_capa >= 100)
ret.intval = POWER_SUPPLY_STATUS_FULL;
else
@@ -1545,6 +1546,7 @@ int fan5405_enable_otg_mode(bool enable)
if (rc < 0)
dev_err(this_chip->dev, "Couldn't %s OTG mode rc=%d\n",
enable ? "enable" : "disable", rc);
+ this_chip->otg_enabled = enable;
return rc;
}
@@ -1603,6 +1605,7 @@ static int fan5405_probe(struct i2c_client *client, const struct i2c_device_id *
}
fan5405_set_chg_reg(chip);//add by sunxiaogang@yulong.com 2015.03.10 to init the fan5405 when probe
+ chip->otg_enabled = false;
//fan5405_hw_init(chip);
usb_psy = power_supply_get_by_name("usb");