kernel:optimize cdp thermal charGing limitation
authorxuwei9 <xuwei9@lenovo.com>
Fri, 11 Oct 2019 02:55:46 +0000 (10:55 +0800)
committerlingsen1 <lingsen1@lenovo.com>
Sun, 7 Feb 2021 09:37:04 +0000 (17:37 +0800)
Optimize cdp thermal
charGing limitation

Change-Id: I1ce95bd96e8f257ab103720609d93842840868d5
Signed-off-by: xuwei9 <xuwei9@mt.com>
Reviewed-on: https://gerrit.mot.com/1435344
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

drivers/power/supply/s2mu00x_battery.c

index e14d8546d7bd970735bfd48f15f0796afa621695..63712e937dfe6e91c7312550556f30d200bb196c 100644 (file)
@@ -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 ||