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

Commit 4551e1ce 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: fix first_soc_done completion"

parents 31ccc2ad 83330762
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3778,6 +3778,7 @@ static irqreturn_t fg_batt_missing_irq_handler(int irq, void *_chip)
	} else {
		if (!chip->use_otp_profile) {
			reinit_completion(&chip->batt_id_avail);
			reinit_completion(&chip->first_soc_done);
			schedule_work(&chip->batt_profile_init);
			cancel_delayed_work(&chip->update_sram_data);
			schedule_delayed_work(
@@ -3794,7 +3795,6 @@ static irqreturn_t fg_batt_missing_irq_handler(int irq, void *_chip)

	if (chip->power_supply_registered)
		power_supply_changed(&chip->bms_psy);
	complete_all(&chip->first_soc_done);
	return IRQ_HANDLED;
}

@@ -3914,6 +3914,9 @@ static irqreturn_t fg_first_soc_irq_handler(int irq, void *_chip)

	if (chip->power_supply_registered)
		power_supply_changed(&chip->bms_psy);

	complete_all(&chip->first_soc_done);

	return IRQ_HANDLED;
}

@@ -6161,7 +6164,6 @@ static int fg_probe(struct spmi_device *spmi)
	complete_all(&chip->sram_access_revoked);
	init_completion(&chip->batt_id_avail);
	init_completion(&chip->first_soc_done);
	complete_all(&chip->first_soc_done);
	dev_set_drvdata(&spmi->dev, chip);

	spmi_for_each_container_dev(spmi_resource, spmi) {
+26 −7
Original line number Diff line number Diff line
@@ -5510,15 +5510,34 @@ static irqreturn_t chg_hot_handler(int irq, void *_chip)
static irqreturn_t chg_term_handler(int irq, void *_chip)
{
	struct smbchg_chip *chip = _chip;
	int rc;
	u8 reg = 0;
	bool terminated = false;

	smbchg_read(chip, &reg, chip->chgr_base + RT_STS, 1);
	rc = smbchg_read(chip, &reg, chip->chgr_base + RT_STS, 1);
	if (rc) {
		dev_err(chip->dev, "Error reading RT_STS rc= %d\n", rc);
	} else {
		terminated = !!(reg & BAT_TCC_REACHED_BIT);
		pr_smb(PR_INTERRUPT, "triggered: 0x%02x\n", reg);
	}
	/*
	 * If charging has not actually terminated, then this means that
	 * either this is a manual call to chg_term_handler during
	 * determine_initial_status(), or the charger has instantly restarted
	 * charging.
	 *
	 * In either case, do not do the usual status updates here. If there
	 * is something that needs to be updated, the recharge handler will
	 * handle it.
	 */
	if (terminated) {
		smbchg_parallel_usb_check_ok(chip);
		if (chip->psy_registered)
			power_supply_changed(&chip->batt_psy);
		smbchg_charging_status_change(chip);
		set_property_on_fg(chip, POWER_SUPPLY_PROP_CHARGE_DONE, 1);
	}
	return IRQ_HANDLED;
}