Loading Documentation/devicetree/bindings/power/qpnp-fg-gen3.txt +7 −0 Original line number Original line Diff line number Diff line Loading @@ -316,6 +316,13 @@ First Level Node - FG Gen3 device is specified to make it fully functional. Value has no is specified to make it fully functional. Value has no unit. Allowed range is 0 to 62200 in micro units. unit. Allowed range is 0 to 62200 in micro units. - qcom,ki-coeff-full-dischg Usage: optional Value type: <u32> Definition: Ki coefficient full SOC value that will be applied during discharging. If not specified, a value of 0 will be set. Allowed range is from 245 to 62256. - qcom,fg-rconn-mohms - qcom,fg-rconn-mohms Usage: optional Usage: optional Value type: <u32> Value type: <u32> Loading drivers/power/fg-core.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -280,6 +280,7 @@ struct fg_dt_props { int slope_limit_temp; int slope_limit_temp; int esr_pulse_thresh_ma; int esr_pulse_thresh_ma; int esr_meas_curr_ma; int esr_meas_curr_ma; int ki_coeff_full_soc_dischg; int sync_sleep_threshold_ma; int sync_sleep_threshold_ma; int jeita_thresholds[NUM_JEITA_LEVELS]; int jeita_thresholds[NUM_JEITA_LEVELS]; int ki_coeff_soc[KI_COEFF_SOC_LEVELS]; int ki_coeff_soc[KI_COEFF_SOC_LEVELS]; Loading Loading @@ -408,7 +409,6 @@ struct fg_chip { int batt_id_ohms; int batt_id_ohms; int ki_coeff_full_soc; int ki_coeff_full_soc; int charge_status; int charge_status; int prev_charge_status; int charge_done; int charge_done; int charge_type; int charge_type; int last_soc; int last_soc; Loading drivers/power/qpnp-fg-gen3.c +7 −9 Original line number Original line Diff line number Diff line Loading @@ -1503,9 +1503,6 @@ static void fg_cap_learning_update(struct fg_chip *chip) goto out; goto out; } } if (chip->charge_status == chip->prev_charge_status) goto out; rc = fg_get_sram_prop(chip, FG_SRAM_BATT_SOC, &batt_soc); rc = fg_get_sram_prop(chip, FG_SRAM_BATT_SOC, &batt_soc); if (rc < 0) { if (rc < 0) { pr_err("Error in getting ACT_BATT_CAP, rc=%d\n", rc); pr_err("Error in getting ACT_BATT_CAP, rc=%d\n", rc); Loading Loading @@ -1650,6 +1647,8 @@ static int fg_adjust_ki_coeff_full_soc(struct fg_chip *chip, int batt_temp) if (batt_temp < 0) if (batt_temp < 0) ki_coeff_full_soc = 0; ki_coeff_full_soc = 0; else if (chip->charge_status == POWER_SUPPLY_STATUS_DISCHARGING) ki_coeff_full_soc = chip->dt.ki_coeff_full_soc_dischg; else else ki_coeff_full_soc = KI_COEFF_FULL_SOC_DEFAULT; ki_coeff_full_soc = KI_COEFF_FULL_SOC_DEFAULT; Loading Loading @@ -2227,9 +2226,6 @@ static int fg_esr_timer_config(struct fg_chip *chip, bool sleep) static void fg_batt_avg_update(struct fg_chip *chip) static void fg_batt_avg_update(struct fg_chip *chip) { { if (chip->charge_status == chip->prev_charge_status) return; cancel_delayed_work_sync(&chip->batt_avg_work); cancel_delayed_work_sync(&chip->batt_avg_work); fg_circ_buf_clr(&chip->ibatt_circ_buf); fg_circ_buf_clr(&chip->ibatt_circ_buf); fg_circ_buf_clr(&chip->vbatt_circ_buf); fg_circ_buf_clr(&chip->vbatt_circ_buf); Loading Loading @@ -2460,7 +2456,6 @@ static void status_change_work(struct work_struct *work) } } fg_batt_avg_update(chip); fg_batt_avg_update(chip); chip->prev_charge_status = chip->charge_status; out: out: fg_dbg(chip, FG_STATUS, "charge_status:%d charge_type:%d charge_done:%d\n", fg_dbg(chip, FG_STATUS, "charge_status:%d charge_type:%d charge_done:%d\n", chip->charge_status, chip->charge_type, chip->charge_done); chip->charge_status, chip->charge_type, chip->charge_done); Loading Loading @@ -4247,7 +4242,11 @@ static int fg_parse_slope_limit_coefficients(struct fg_chip *chip) static int fg_parse_ki_coefficients(struct fg_chip *chip) static int fg_parse_ki_coefficients(struct fg_chip *chip) { { struct device_node *node = chip->dev->of_node; struct device_node *node = chip->dev->of_node; int rc, i; int rc, i, temp; rc = of_property_read_u32(node, "qcom,ki-coeff-full-dischg", &temp); if (!rc) chip->dt.ki_coeff_full_soc_dischg = temp; rc = fg_parse_dt_property_u32_array(node, "qcom,ki-coeff-soc-dischg", rc = fg_parse_dt_property_u32_array(node, "qcom,ki-coeff-soc-dischg", chip->dt.ki_coeff_soc, KI_COEFF_SOC_LEVELS); chip->dt.ki_coeff_soc, KI_COEFF_SOC_LEVELS); Loading Loading @@ -4731,7 +4730,6 @@ static int fg_gen3_probe(struct spmi_device *spmi) chip->debug_mask = &fg_gen3_debug_mask; chip->debug_mask = &fg_gen3_debug_mask; chip->irqs = fg_irqs; chip->irqs = fg_irqs; chip->charge_status = -EINVAL; chip->charge_status = -EINVAL; chip->prev_charge_status = -EINVAL; chip->ki_coeff_full_soc = -EINVAL; chip->ki_coeff_full_soc = -EINVAL; chip->spmi = spmi; chip->spmi = spmi; Loading Loading
Documentation/devicetree/bindings/power/qpnp-fg-gen3.txt +7 −0 Original line number Original line Diff line number Diff line Loading @@ -316,6 +316,13 @@ First Level Node - FG Gen3 device is specified to make it fully functional. Value has no is specified to make it fully functional. Value has no unit. Allowed range is 0 to 62200 in micro units. unit. Allowed range is 0 to 62200 in micro units. - qcom,ki-coeff-full-dischg Usage: optional Value type: <u32> Definition: Ki coefficient full SOC value that will be applied during discharging. If not specified, a value of 0 will be set. Allowed range is from 245 to 62256. - qcom,fg-rconn-mohms - qcom,fg-rconn-mohms Usage: optional Usage: optional Value type: <u32> Value type: <u32> Loading
drivers/power/fg-core.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -280,6 +280,7 @@ struct fg_dt_props { int slope_limit_temp; int slope_limit_temp; int esr_pulse_thresh_ma; int esr_pulse_thresh_ma; int esr_meas_curr_ma; int esr_meas_curr_ma; int ki_coeff_full_soc_dischg; int sync_sleep_threshold_ma; int sync_sleep_threshold_ma; int jeita_thresholds[NUM_JEITA_LEVELS]; int jeita_thresholds[NUM_JEITA_LEVELS]; int ki_coeff_soc[KI_COEFF_SOC_LEVELS]; int ki_coeff_soc[KI_COEFF_SOC_LEVELS]; Loading Loading @@ -408,7 +409,6 @@ struct fg_chip { int batt_id_ohms; int batt_id_ohms; int ki_coeff_full_soc; int ki_coeff_full_soc; int charge_status; int charge_status; int prev_charge_status; int charge_done; int charge_done; int charge_type; int charge_type; int last_soc; int last_soc; Loading
drivers/power/qpnp-fg-gen3.c +7 −9 Original line number Original line Diff line number Diff line Loading @@ -1503,9 +1503,6 @@ static void fg_cap_learning_update(struct fg_chip *chip) goto out; goto out; } } if (chip->charge_status == chip->prev_charge_status) goto out; rc = fg_get_sram_prop(chip, FG_SRAM_BATT_SOC, &batt_soc); rc = fg_get_sram_prop(chip, FG_SRAM_BATT_SOC, &batt_soc); if (rc < 0) { if (rc < 0) { pr_err("Error in getting ACT_BATT_CAP, rc=%d\n", rc); pr_err("Error in getting ACT_BATT_CAP, rc=%d\n", rc); Loading Loading @@ -1650,6 +1647,8 @@ static int fg_adjust_ki_coeff_full_soc(struct fg_chip *chip, int batt_temp) if (batt_temp < 0) if (batt_temp < 0) ki_coeff_full_soc = 0; ki_coeff_full_soc = 0; else if (chip->charge_status == POWER_SUPPLY_STATUS_DISCHARGING) ki_coeff_full_soc = chip->dt.ki_coeff_full_soc_dischg; else else ki_coeff_full_soc = KI_COEFF_FULL_SOC_DEFAULT; ki_coeff_full_soc = KI_COEFF_FULL_SOC_DEFAULT; Loading Loading @@ -2227,9 +2226,6 @@ static int fg_esr_timer_config(struct fg_chip *chip, bool sleep) static void fg_batt_avg_update(struct fg_chip *chip) static void fg_batt_avg_update(struct fg_chip *chip) { { if (chip->charge_status == chip->prev_charge_status) return; cancel_delayed_work_sync(&chip->batt_avg_work); cancel_delayed_work_sync(&chip->batt_avg_work); fg_circ_buf_clr(&chip->ibatt_circ_buf); fg_circ_buf_clr(&chip->ibatt_circ_buf); fg_circ_buf_clr(&chip->vbatt_circ_buf); fg_circ_buf_clr(&chip->vbatt_circ_buf); Loading Loading @@ -2460,7 +2456,6 @@ static void status_change_work(struct work_struct *work) } } fg_batt_avg_update(chip); fg_batt_avg_update(chip); chip->prev_charge_status = chip->charge_status; out: out: fg_dbg(chip, FG_STATUS, "charge_status:%d charge_type:%d charge_done:%d\n", fg_dbg(chip, FG_STATUS, "charge_status:%d charge_type:%d charge_done:%d\n", chip->charge_status, chip->charge_type, chip->charge_done); chip->charge_status, chip->charge_type, chip->charge_done); Loading Loading @@ -4247,7 +4242,11 @@ static int fg_parse_slope_limit_coefficients(struct fg_chip *chip) static int fg_parse_ki_coefficients(struct fg_chip *chip) static int fg_parse_ki_coefficients(struct fg_chip *chip) { { struct device_node *node = chip->dev->of_node; struct device_node *node = chip->dev->of_node; int rc, i; int rc, i, temp; rc = of_property_read_u32(node, "qcom,ki-coeff-full-dischg", &temp); if (!rc) chip->dt.ki_coeff_full_soc_dischg = temp; rc = fg_parse_dt_property_u32_array(node, "qcom,ki-coeff-soc-dischg", rc = fg_parse_dt_property_u32_array(node, "qcom,ki-coeff-soc-dischg", chip->dt.ki_coeff_soc, KI_COEFF_SOC_LEVELS); chip->dt.ki_coeff_soc, KI_COEFF_SOC_LEVELS); Loading Loading @@ -4731,7 +4730,6 @@ static int fg_gen3_probe(struct spmi_device *spmi) chip->debug_mask = &fg_gen3_debug_mask; chip->debug_mask = &fg_gen3_debug_mask; chip->irqs = fg_irqs; chip->irqs = fg_irqs; chip->charge_status = -EINVAL; chip->charge_status = -EINVAL; chip->prev_charge_status = -EINVAL; chip->ki_coeff_full_soc = -EINVAL; chip->ki_coeff_full_soc = -EINVAL; chip->spmi = spmi; chip->spmi = spmi; Loading