diff options
author | Jack Wu <wjack@google.com> | 2018-08-14 19:14:58 +0800 |
---|---|---|
committer | Thierry Strudel <tstrudel@google.com> | 2018-08-15 20:30:39 +0000 |
commit | 2513d2388ed10f8dbb80088426c6e402b2e9eb6b (patch) | |
tree | a2af23dd1040d12a1633d58e305de7c45126f8f2 | |
parent | df62d3dc895630cb61ae602468fe1dab9c4f2d7c (diff) |
charger: fix slower charging with NON-PD type-C chargerandroid-9.0.0_r0.40android-9.0.0_r0.39android-9.0.0_r0.21
1. When charger type is detected as NON-PD type-C but usb icl is
voted as 1500mA, it will cause wrong charging current.
That is fixed by voting correct current.
2. NON-PD type-C charger with D+/D- open was detected as UNKNOWN charger.
Fix it.
Bug: 112529920
Change-Id: I8818d632d64fd3ee82adb31043e68d0652c75003
Signed-off-by: Jack Wu <wjack@google.com>
-rw-r--r-- | drivers/power/htc_battery.c | 22 | ||||
-rw-r--r-- | drivers/power/qpnp-smbcharger.c | 5 |
2 files changed, 14 insertions, 13 deletions
diff --git a/drivers/power/htc_battery.c b/drivers/power/htc_battery.c index 2b1cd8f6f15c..623ee1419bf7 100644 --- a/drivers/power/htc_battery.c +++ b/drivers/power/htc_battery.c @@ -1381,6 +1381,7 @@ static void batt_worker(struct work_struct *work) unsigned long cur_jiffies; int cc_uah_now; int current_max = 0; + int typec_sink = 0; char chg_strbuf[20]; /* reference from power_supply.h power_supply_type */ char *chr_src[] = {"NONE", "BATTERY", "UPS", "MAINS", "USB", @@ -1481,16 +1482,21 @@ static void batt_worker(struct work_struct *work) } else { /* WA: QCT recorgnize D+/D- open charger won't set 500mA. */ if ((htc_batt_info.rep.charging_source == POWER_SUPPLY_TYPE_USB)) { - user_set_chg_curr = get_property(htc_batt_info.usb_psy, POWER_SUPPLY_PROP_CURRENT_MAX); - if (!get_connect2pc() && !g_rerun_apsd_done && !g_is_unknown_charger) { - user_set_chg_curr = SLOW_CHARGE_CURR; - if (delayed_work_pending(&htc_batt_info.chk_unknown_chg_work)) - cancel_delayed_work(&htc_batt_info.chk_unknown_chg_work); - schedule_delayed_work(&htc_batt_info.chk_unknown_chg_work, - msecs_to_jiffies(CHG_UNKNOWN_CHG_PERIOD_MS)); + typec_sink = get_property(htc_batt_info.batt_psy, POWER_SUPPLY_PROP_TYPEC_SINK_CURRENT); + if (typec_sink){ + //Souce type is USB TYPE_C, Ignore WA. } else { - if (user_set_chg_curr < SLOW_CHARGE_CURR) + user_set_chg_curr = get_property(htc_batt_info.usb_psy, POWER_SUPPLY_PROP_CURRENT_MAX); + if (!get_connect2pc() && !g_rerun_apsd_done && !g_is_unknown_charger) { user_set_chg_curr = SLOW_CHARGE_CURR; + if (delayed_work_pending(&htc_batt_info.chk_unknown_chg_work)) + cancel_delayed_work(&htc_batt_info.chk_unknown_chg_work); + schedule_delayed_work(&htc_batt_info.chk_unknown_chg_work, + msecs_to_jiffies(CHG_UNKNOWN_CHG_PERIOD_MS)); + } else { + if (user_set_chg_curr < SLOW_CHARGE_CURR) + user_set_chg_curr = SLOW_CHARGE_CURR; + } } } else if (htc_batt_info.rep.charging_source == POWER_SUPPLY_TYPE_USB_HVDCP){ user_set_chg_curr = get_property(htc_batt_info.usb_psy, POWER_SUPPLY_PROP_CURRENT_MAX); diff --git a/drivers/power/qpnp-smbcharger.c b/drivers/power/qpnp-smbcharger.c index 857b9d99636e..9f8366156f7d 100644 --- a/drivers/power/qpnp-smbcharger.c +++ b/drivers/power/qpnp-smbcharger.c @@ -5084,11 +5084,6 @@ static int smbchg_change_usb_supply_type(struct smbchg_chip *chip, current_limit_ma = 3000; power_supply_set_current_limit(chip->usb_psy, current_limit_ma * 1000); - - /* To make sure Type-C charger do have the ability to work at - 3A high current mode, need go through 5v2a detect worker - before setting 3A, so set default low current right here */ - current_limit_ma = DEFAULT_TYPEC_MA; } else #endif /* CONFIG_HTC_BATT */ if (chip->typec_psy && (type != POWER_SUPPLY_TYPE_USB)) |