Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99c02045 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-fg-gen3: adjust ki coefficient for full soc dynamically"

parents 8f0d95c1 c697dbb0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -301,6 +301,13 @@ First Level Node - FG Gen3 device
		    is specified to make it fully functional. Value has no
		    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
	Usage:      optional
	Value type: <u32>
+1 −1
Original line number Diff line number Diff line
@@ -272,6 +272,7 @@ struct fg_dt_props {
	int	slope_limit_temp;
	int	esr_pulse_thresh_ma;
	int	esr_meas_curr_ma;
	int	ki_coeff_full_soc_dischg;
	int	jeita_thresholds[NUM_JEITA_LEVELS];
	int	ki_coeff_soc[KI_COEFF_SOC_LEVELS];
	int	ki_coeff_med_dischg[KI_COEFF_SOC_LEVELS];
@@ -409,7 +410,6 @@ struct fg_chip {
	int			batt_id_ohms;
	int			ki_coeff_full_soc;
	int			charge_status;
	int			prev_charge_status;
	int			charge_done;
	int			charge_type;
	int			online_status;
+7 −3
Original line number Diff line number Diff line
@@ -1602,6 +1602,8 @@ static int fg_adjust_ki_coeff_full_soc(struct fg_chip *chip, int batt_temp)

	if (batt_temp < 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
		ki_coeff_full_soc = KI_COEFF_FULL_SOC_DEFAULT;

@@ -2438,7 +2440,6 @@ static void status_change_work(struct work_struct *work)
		goto out;
	}

	chip->prev_charge_status = chip->charge_status;
	chip->charge_status = prop.intval;
	rc = power_supply_get_property(chip->batt_psy,
			POWER_SUPPLY_PROP_CHARGE_TYPE, &prop);
@@ -4321,7 +4322,11 @@ static int fg_parse_slope_limit_coefficients(struct fg_chip *chip)
static int fg_parse_ki_coefficients(struct fg_chip *chip)
{
	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",
		chip->dt.ki_coeff_soc, KI_COEFF_SOC_LEVELS);
@@ -4771,7 +4776,6 @@ static int fg_gen3_probe(struct platform_device *pdev)
	chip->debug_mask = &fg_gen3_debug_mask;
	chip->irqs = fg_irqs;
	chip->charge_status = -EINVAL;
	chip->prev_charge_status = -EINVAL;
	chip->ki_coeff_full_soc = -EINVAL;
	chip->online_status = -EINVAL;
	chip->regmap = dev_get_regmap(chip->dev->parent, NULL);