Loading Documentation/devicetree/bindings/power/smb1360-charger-fg.txt +3 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,9 @@ Optional Properties: from battery when device working at OTG mode. The possible values are: 350, 550, 950, 1500mA. - qcom,fg-auto-recharge-soc This property defines the auto recharging SOC threshold. - qcom,min-icl-100ma A bool property to set the minimum ICL current to 100mA. If this property is not set the minimum ICL is set to 500mA in all the scenarios. Example: i2c@f9967000 { Loading drivers/power/smb1360-charger-fg.c +28 −12 Original line number Diff line number Diff line Loading @@ -278,6 +278,7 @@ struct smb1360_chip { unsigned int therm_lvl_sel; unsigned int *thermal_mitigation; int otg_batt_curr_limit; bool min_icl_usb100; /* configuration data - fg */ int soc_max; Loading Loading @@ -985,7 +986,8 @@ static int smb1360_set_minimum_usb_current(struct smb1360_chip *chip) { int rc = 0; pr_debug("set USB current to minimum\n"); if (chip->min_icl_usb100) { pr_debug("USB min current set to 100mA\n"); /* set input current limit to minimum (300mA) */ rc = smb1360_masked_write(chip, CFG_BATT_CHG_ICL_REG, INPUT_CURR_LIM_MASK, Loading @@ -993,11 +995,19 @@ static int smb1360_set_minimum_usb_current(struct smb1360_chip *chip) if (rc) pr_err("Couldn't set ICL mA rc=%d\n", rc); if (!(chip->workaround_flags & WRKRND_USB100_FAIL)) { if (!(chip->workaround_flags & WRKRND_USB100_FAIL)) rc = smb1360_masked_write(chip, CMD_IL_REG, USB_CTRL_MASK, USB_100_BIT); if (rc) pr_err("Couldn't configure for USB100 rc=%d\n", rc); pr_err("Couldn't configure for USB100 rc=%d\n", rc); } else { pr_debug("USB min current set to 500mA\n"); rc = smb1360_masked_write(chip, CMD_IL_REG, USB_CTRL_MASK, USB_500_BIT); if (rc) pr_err("Couldn't configure for USB100 rc=%d\n", rc); } return rc; Loading Loading @@ -1063,8 +1073,11 @@ static int smb1360_set_appropriate_usb_current(struct smb1360_chip *chip) pr_debug("ICL set to = %d\n", input_current_limit[i]); if ((current_ma <= CURRENT_100_MA) && (chip->workaround_flags & WRKRND_USB100_FAIL)) { pr_debug("usb100 not supported\n"); ((chip->workaround_flags & WRKRND_USB100_FAIL) || !chip->min_icl_usb100)) { pr_debug("usb100 not supported: usb100_wrkrnd=%d min_icl_100=%d\n", !!(chip->workaround_flags & WRKRND_USB100_FAIL), chip->min_icl_usb100); current_ma = CURRENT_500_MA; } Loading Loading @@ -3213,6 +3226,9 @@ static int smb_parse_dt(struct smb1360_chip *chip) chip->shdn_after_pwroff = of_property_read_bool(node, "qcom,shdn-after-pwroff"); chip->min_icl_usb100 = of_property_read_bool(node, "qcom,min-icl-100ma"); if (of_find_property(node, "qcom,thermal-mitigation", &chip->thermal_levels)) { chip->thermal_mitigation = devm_kzalloc(chip->dev, Loading Loading
Documentation/devicetree/bindings/power/smb1360-charger-fg.txt +3 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,9 @@ Optional Properties: from battery when device working at OTG mode. The possible values are: 350, 550, 950, 1500mA. - qcom,fg-auto-recharge-soc This property defines the auto recharging SOC threshold. - qcom,min-icl-100ma A bool property to set the minimum ICL current to 100mA. If this property is not set the minimum ICL is set to 500mA in all the scenarios. Example: i2c@f9967000 { Loading
drivers/power/smb1360-charger-fg.c +28 −12 Original line number Diff line number Diff line Loading @@ -278,6 +278,7 @@ struct smb1360_chip { unsigned int therm_lvl_sel; unsigned int *thermal_mitigation; int otg_batt_curr_limit; bool min_icl_usb100; /* configuration data - fg */ int soc_max; Loading Loading @@ -985,7 +986,8 @@ static int smb1360_set_minimum_usb_current(struct smb1360_chip *chip) { int rc = 0; pr_debug("set USB current to minimum\n"); if (chip->min_icl_usb100) { pr_debug("USB min current set to 100mA\n"); /* set input current limit to minimum (300mA) */ rc = smb1360_masked_write(chip, CFG_BATT_CHG_ICL_REG, INPUT_CURR_LIM_MASK, Loading @@ -993,11 +995,19 @@ static int smb1360_set_minimum_usb_current(struct smb1360_chip *chip) if (rc) pr_err("Couldn't set ICL mA rc=%d\n", rc); if (!(chip->workaround_flags & WRKRND_USB100_FAIL)) { if (!(chip->workaround_flags & WRKRND_USB100_FAIL)) rc = smb1360_masked_write(chip, CMD_IL_REG, USB_CTRL_MASK, USB_100_BIT); if (rc) pr_err("Couldn't configure for USB100 rc=%d\n", rc); pr_err("Couldn't configure for USB100 rc=%d\n", rc); } else { pr_debug("USB min current set to 500mA\n"); rc = smb1360_masked_write(chip, CMD_IL_REG, USB_CTRL_MASK, USB_500_BIT); if (rc) pr_err("Couldn't configure for USB100 rc=%d\n", rc); } return rc; Loading Loading @@ -1063,8 +1073,11 @@ static int smb1360_set_appropriate_usb_current(struct smb1360_chip *chip) pr_debug("ICL set to = %d\n", input_current_limit[i]); if ((current_ma <= CURRENT_100_MA) && (chip->workaround_flags & WRKRND_USB100_FAIL)) { pr_debug("usb100 not supported\n"); ((chip->workaround_flags & WRKRND_USB100_FAIL) || !chip->min_icl_usb100)) { pr_debug("usb100 not supported: usb100_wrkrnd=%d min_icl_100=%d\n", !!(chip->workaround_flags & WRKRND_USB100_FAIL), chip->min_icl_usb100); current_ma = CURRENT_500_MA; } Loading Loading @@ -3213,6 +3226,9 @@ static int smb_parse_dt(struct smb1360_chip *chip) chip->shdn_after_pwroff = of_property_read_bool(node, "qcom,shdn-after-pwroff"); chip->min_icl_usb100 = of_property_read_bool(node, "qcom,min-icl-100ma"); if (of_find_property(node, "qcom,thermal-mitigation", &chip->thermal_levels)) { chip->thermal_mitigation = devm_kzalloc(chip->dev, Loading