Loading Documentation/devicetree/bindings/power/qpnp-fg.txt +4 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,10 @@ Parent node optional properties: - qcom,resume-soc: soc to resume charging in percentage. - qcom,use-otp-profile: Specify this flag to avoid RAM loading any battery profile. - qcom,sw-rbias-control: Boolean property which defines whether the Rbias needs to be controlled by software. If this is not set, it will be controlled by hardware (default). qcom,fg-soc node required properties: - reg : offset and length of the PMIC peripheral register map. Loading drivers/power/qpnp-fg.c +28 −16 Original line number Diff line number Diff line Loading @@ -238,6 +238,7 @@ struct fg_chip { bool use_otp_profile; bool battery_missing; bool power_supply_registered; bool sw_rbias_ctrl; struct delayed_work update_jeita_setting; struct delayed_work update_sram_data; char *batt_profile; Loading Loading @@ -1670,6 +1671,8 @@ static int fg_of_init(struct fg_chip *chip) rc = 0; } chip->sw_rbias_ctrl = of_property_read_bool(chip->spmi->dev.of_node, "qcom,sw-rbias-control"); return rc; } Loading Loading @@ -2292,6 +2295,7 @@ static int fg_hw_init(struct fg_chip *chip) } } if (chip->sw_rbias_ctrl) { rc = fg_mem_masked_write(chip, EXTERNAL_SENSE_SELECT, BATT_TEMP_CNTRL_MASK, BATT_TEMP_ON, Loading @@ -2309,6 +2313,7 @@ static int fg_hw_init(struct fg_chip *chip) pr_err("failed to write to memif rc=%d\n", rc); return rc; } } if (chip->use_thermal_coefficients) { fg_mem_write(chip, chip->thermal_coefficients, Loading Loading @@ -2499,6 +2504,9 @@ static int fg_suspend(struct device *dev) int total_time_ms; int rc; if (!chip->sw_rbias_ctrl) return 0; enter_time = ktime_get(); rc = fg_mem_masked_write(chip, EXTERNAL_SENSE_SELECT, BATT_TEMP_CNTRL_MASK, Loading @@ -2511,7 +2519,8 @@ static int fg_suspend(struct device *dev) total_time_ms = ktime_to_ms(total_time); if ((total_time_ms > 1500) && (fg_debug_mask & FG_STATUS)) pr_info("spent %dms configuring rbias\n", total_time_ms); pr_info("spent %dms configuring rbias\n", total_time_ms); return 0; } Loading @@ -2525,6 +2534,9 @@ static int fg_resume(struct device *dev) unsigned long current_time = 0, next_update_time, time_left; int rc; if (!chip->sw_rbias_ctrl) return 0; enter_time = ktime_get(); rc = fg_mem_masked_write(chip, EXTERNAL_SENSE_SELECT, BATT_TEMP_CNTRL_MASK, Loading Loading
Documentation/devicetree/bindings/power/qpnp-fg.txt +4 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,10 @@ Parent node optional properties: - qcom,resume-soc: soc to resume charging in percentage. - qcom,use-otp-profile: Specify this flag to avoid RAM loading any battery profile. - qcom,sw-rbias-control: Boolean property which defines whether the Rbias needs to be controlled by software. If this is not set, it will be controlled by hardware (default). qcom,fg-soc node required properties: - reg : offset and length of the PMIC peripheral register map. Loading
drivers/power/qpnp-fg.c +28 −16 Original line number Diff line number Diff line Loading @@ -238,6 +238,7 @@ struct fg_chip { bool use_otp_profile; bool battery_missing; bool power_supply_registered; bool sw_rbias_ctrl; struct delayed_work update_jeita_setting; struct delayed_work update_sram_data; char *batt_profile; Loading Loading @@ -1670,6 +1671,8 @@ static int fg_of_init(struct fg_chip *chip) rc = 0; } chip->sw_rbias_ctrl = of_property_read_bool(chip->spmi->dev.of_node, "qcom,sw-rbias-control"); return rc; } Loading Loading @@ -2292,6 +2295,7 @@ static int fg_hw_init(struct fg_chip *chip) } } if (chip->sw_rbias_ctrl) { rc = fg_mem_masked_write(chip, EXTERNAL_SENSE_SELECT, BATT_TEMP_CNTRL_MASK, BATT_TEMP_ON, Loading @@ -2309,6 +2313,7 @@ static int fg_hw_init(struct fg_chip *chip) pr_err("failed to write to memif rc=%d\n", rc); return rc; } } if (chip->use_thermal_coefficients) { fg_mem_write(chip, chip->thermal_coefficients, Loading Loading @@ -2499,6 +2504,9 @@ static int fg_suspend(struct device *dev) int total_time_ms; int rc; if (!chip->sw_rbias_ctrl) return 0; enter_time = ktime_get(); rc = fg_mem_masked_write(chip, EXTERNAL_SENSE_SELECT, BATT_TEMP_CNTRL_MASK, Loading @@ -2511,7 +2519,8 @@ static int fg_suspend(struct device *dev) total_time_ms = ktime_to_ms(total_time); if ((total_time_ms > 1500) && (fg_debug_mask & FG_STATUS)) pr_info("spent %dms configuring rbias\n", total_time_ms); pr_info("spent %dms configuring rbias\n", total_time_ms); return 0; } Loading @@ -2525,6 +2534,9 @@ static int fg_resume(struct device *dev) unsigned long current_time = 0, next_update_time, time_left; int rc; if (!chip->sw_rbias_ctrl) return 0; enter_time = ktime_get(); rc = fg_mem_masked_write(chip, EXTERNAL_SENSE_SELECT, BATT_TEMP_CNTRL_MASK, Loading