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

Commit fd7f07b0 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy Committed by Harry Yang
Browse files

power: qpnp-fg-gen3: add SOC_REPORTING_READY property



Add SOC_REPORTING_READY property which indicates when the SOC
reporting is ready from FG driver. This can be read by healthd
daemon during its start.

Change-Id: I415e322e99bacd61c4e9ac921643d87d3eec4b3e
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 4aa2c0cf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -335,6 +335,7 @@ struct fg_chip {
	bool			recharge_soc_adjusted;
	bool			ki_coeff_dischg_en;
	bool			esr_fcc_ctrl_en;
	bool			soc_reporting_ready;
	struct completion	soc_update;
	struct completion	soc_ready;
	struct delayed_work	profile_load_work;
+10 −1
Original line number Diff line number Diff line
@@ -2050,6 +2050,7 @@ static void profile_load_work(struct work_struct *work)

	fg_notify_charger(chip);
	chip->profile_loaded = true;
	chip->soc_reporting_ready = true;
	fg_dbg(chip, FG_STATUS, "profile loaded successfully");
out:
	vote(chip->awake_votable, PROFILE_LOAD, false, 0);
@@ -2386,6 +2387,9 @@ static int fg_psy_get_property(struct power_supply *psy,
	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
		rc = fg_get_time_to_empty(chip, &pval->intval);
		break;
	case POWER_SUPPLY_PROP_SOC_REPORTING_READY:
		pval->intval = chip->soc_reporting_ready;
		break;
	default:
		pr_err("unsupported property %d\n", psp);
		rc = -EINVAL;
@@ -2483,6 +2487,7 @@ static enum power_supply_property fg_psy_props[] = {
	POWER_SUPPLY_PROP_CHARGE_COUNTER,
	POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
	POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
	POWER_SUPPLY_PROP_SOC_REPORTING_READY,
};

static const struct power_supply_desc fg_psy_desc = {
@@ -2773,9 +2778,11 @@ static irqreturn_t fg_batt_missing_irq_handler(int irq, void *data)
		chip->profile_available = false;
		chip->profile_loaded = false;
		clear_cycle_counter(chip);
		chip->soc_reporting_ready = false;
	} else {
		rc = fg_get_batt_profile(chip);
		if (rc < 0) {
			chip->soc_reporting_ready = true;
			pr_err("Error in getting battery profile, rc:%d\n", rc);
			return IRQ_HANDLED;
		}
@@ -3213,9 +3220,11 @@ static int fg_parse_dt(struct fg_chip *chip)
	chip->rradc_base = base;

	rc = fg_get_batt_profile(chip);
	if (rc < 0)
	if (rc < 0) {
		chip->soc_reporting_ready = true;
		pr_warn("profile for batt_id=%dKOhms not found..using OTP, rc:%d\n",
			chip->batt_id_ohms / 1000, rc);
	}

	/* Read all the optional properties below */
	rc = of_property_read_u32(node, "qcom,fg-cutoff-voltage", &temp);