Loading Documentation/devicetree/bindings/power/supply/qcom/qpnp-fg-gen4.txt +7 −0 Original line number Diff line number Diff line Loading @@ -419,6 +419,13 @@ First Level Node - FG Gen4 device multiple battery profiles to be specified for a battery for proper functionality. - qcom,soc-hi-res Usage: optional Value type: <empty> Definition: A boolean property that when specified shows high resolution of monotonic SOC under CAPACITY_RAW property during charging in the scale of 0-10000. ========================================================== Second Level Nodes - Peripherals managed by FG Gen4 driver ========================================================== Loading drivers/power/supply/qcom/qpnp-fg-gen4.c +32 −1 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ struct fg_dt_props { bool five_pin_battery; bool multi_profile_load; bool esr_calib_dischg; bool soc_hi_res; int cutoff_volt_mv; int empty_volt_mv; int cutoff_curr_ma; Loading Loading @@ -829,6 +830,35 @@ static int fg_gen4_get_prop_capacity(struct fg_dev *fg, int *val) return 0; } static int fg_gen4_get_prop_capacity_raw(struct fg_gen4_chip *chip, int *val) { struct fg_dev *fg = &chip->fg; int rc; if (!chip->dt.soc_hi_res) { rc = fg_get_msoc_raw(fg, val); return rc; } if (!is_input_present(fg)) { rc = fg_gen4_get_prop_capacity(fg, val); if (!rc) *val = *val * 100; return rc; } rc = fg_get_sram_prop(&chip->fg, FG_SRAM_MONOTONIC_SOC, val); if (rc < 0) { pr_err("Error in getting MONOTONIC_SOC, rc=%d\n", rc); return rc; } /* Show it in centi-percentage */ *val = (*val * 10000) / 0xFFFF; return 0; } static inline void get_esr_meas_current(int curr_ma, u8 *val) { switch (curr_ma) { Loading Loading @@ -3484,7 +3514,7 @@ static int fg_psy_get_property(struct power_supply *psy, rc = fg_gen4_get_prop_capacity(fg, &pval->intval); break; case POWER_SUPPLY_PROP_CAPACITY_RAW: rc = fg_get_msoc_raw(fg, &pval->intval); rc = fg_gen4_get_prop_capacity_raw(chip, &pval->intval); break; case POWER_SUPPLY_PROP_CC_SOC: rc = fg_get_sram_prop(&chip->fg, FG_SRAM_CC_SOC, &val); Loading Loading @@ -4859,6 +4889,7 @@ static int fg_gen4_parse_dt(struct fg_gen4_chip *chip) "qcom,five-pin-battery"); chip->dt.multi_profile_load = of_property_read_bool(node, "qcom,multi-profile-load"); chip->dt.soc_hi_res = of_property_read_bool(node, "qcom,soc-hi-res"); return 0; } Loading Loading
Documentation/devicetree/bindings/power/supply/qcom/qpnp-fg-gen4.txt +7 −0 Original line number Diff line number Diff line Loading @@ -419,6 +419,13 @@ First Level Node - FG Gen4 device multiple battery profiles to be specified for a battery for proper functionality. - qcom,soc-hi-res Usage: optional Value type: <empty> Definition: A boolean property that when specified shows high resolution of monotonic SOC under CAPACITY_RAW property during charging in the scale of 0-10000. ========================================================== Second Level Nodes - Peripherals managed by FG Gen4 driver ========================================================== Loading
drivers/power/supply/qcom/qpnp-fg-gen4.c +32 −1 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ struct fg_dt_props { bool five_pin_battery; bool multi_profile_load; bool esr_calib_dischg; bool soc_hi_res; int cutoff_volt_mv; int empty_volt_mv; int cutoff_curr_ma; Loading Loading @@ -829,6 +830,35 @@ static int fg_gen4_get_prop_capacity(struct fg_dev *fg, int *val) return 0; } static int fg_gen4_get_prop_capacity_raw(struct fg_gen4_chip *chip, int *val) { struct fg_dev *fg = &chip->fg; int rc; if (!chip->dt.soc_hi_res) { rc = fg_get_msoc_raw(fg, val); return rc; } if (!is_input_present(fg)) { rc = fg_gen4_get_prop_capacity(fg, val); if (!rc) *val = *val * 100; return rc; } rc = fg_get_sram_prop(&chip->fg, FG_SRAM_MONOTONIC_SOC, val); if (rc < 0) { pr_err("Error in getting MONOTONIC_SOC, rc=%d\n", rc); return rc; } /* Show it in centi-percentage */ *val = (*val * 10000) / 0xFFFF; return 0; } static inline void get_esr_meas_current(int curr_ma, u8 *val) { switch (curr_ma) { Loading Loading @@ -3484,7 +3514,7 @@ static int fg_psy_get_property(struct power_supply *psy, rc = fg_gen4_get_prop_capacity(fg, &pval->intval); break; case POWER_SUPPLY_PROP_CAPACITY_RAW: rc = fg_get_msoc_raw(fg, &pval->intval); rc = fg_gen4_get_prop_capacity_raw(chip, &pval->intval); break; case POWER_SUPPLY_PROP_CC_SOC: rc = fg_get_sram_prop(&chip->fg, FG_SRAM_CC_SOC, &val); Loading Loading @@ -4859,6 +4889,7 @@ static int fg_gen4_parse_dt(struct fg_gen4_chip *chip) "qcom,five-pin-battery"); chip->dt.multi_profile_load = of_property_read_bool(node, "qcom,multi-profile-load"); chip->dt.soc_hi_res = of_property_read_bool(node, "qcom,soc-hi-res"); return 0; } Loading