From: xuwei9 Date: Fri, 11 Oct 2019 02:55:46 +0000 (+0800) Subject: kernel:optimize cdp thermal charGing limitation X-Git-Tag: MMI-RSA31.Q1-48-36-11~91 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7401b25b254703428aa31cc1493ad36d8c1b4d2c;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git kernel:optimize cdp thermal charGing limitation Optimize cdp thermal charGing limitation Change-Id: I1ce95bd96e8f257ab103720609d93842840868d5 Signed-off-by: xuwei9 Reviewed-on: https://gerrit.mot.com/1435344 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- diff --git a/drivers/power/supply/s2mu00x_battery.c b/drivers/power/supply/s2mu00x_battery.c index e14d8546d7bd..63712e937dfe 100644 --- a/drivers/power/supply/s2mu00x_battery.c +++ b/drivers/power/supply/s2mu00x_battery.c @@ -3858,6 +3858,7 @@ static void smbchg_heartbeat_work(struct work_struct *work) int prev_step; int index; int state; + int cdp_target_current = 0; if(!is_cable_present(chip)){ pr_info("%s:cable not inserted\n",__func__); @@ -4043,8 +4044,14 @@ static void smbchg_heartbeat_work(struct work_struct *work) if (is_sdp_cdp(chip)) { pr_info("%s, usb\n",__func__); - //need test usb charging. - //chip->update_allowed_fastchg_current_ma = false; + if(chip->cable_type == POWER_SUPPLY_TYPE_USB_CDP) { + cdp_target_current = min(chip->target_fastchg_current_ma, (int)chip->pdata->charging_current[chip->cable_type].fast_charging_current); + pr_info("%s,cdp set current:%d\n",__func__,cdp_target_current); + set_property_on_charger(chip, POWER_SUPPLY_PROP_CURRENT_NOW, cdp_target_current); + } else { + pr_info("%s, usb sdp heartbeat\n", __func__); + } + } else if (is_dc_present(chip)) { #if defined(CONFIG_SMALL_CHARGER) if (chip->cable_type == POWER_SUPPLY_TYPE_PREPARE_TA ||