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

Commit 623784bb authored by Ashay Jaiswal's avatar Ashay Jaiswal
Browse files

power: qpnp-fg: update SOC_REPORTING_READY reporting logic



Android healthd daemon waits for Fuel Gauge SOC_REPORTING_READY
property to be set to true. In case of failures during profile
loading SOC_REPORTING_READY remains false. Thus healthd daemon
waits till a timeout(40 sec) before continuing, this wait causes
failure in Android's batteryservice. Fix this by setting
SOC_REPORTING_READY in case of failures during profile loading.

CRs-Fixed: 1063589
Change-Id: I09aa008abdcdb2683602be61f8dc0a0b10a85c8b
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent 625dbda1
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -518,6 +518,7 @@ struct fg_chip {
	struct fg_wakeup_source	update_sram_wakeup_source;
	bool			fg_restarting;
	bool			profile_loaded;
	bool			soc_reporting_ready;
	bool			use_otp_profile;
	bool			battery_missing;
	bool			power_supply_registered;
@@ -4520,7 +4521,7 @@ static int fg_power_get_property(struct power_supply *psy,
		val->intval = !!chip->bcl_lpm_disabled;
		break;
	case POWER_SUPPLY_PROP_SOC_REPORTING_READY:
		val->intval = !!chip->profile_loaded;
		val->intval = !!chip->soc_reporting_ready;
		break;
	case POWER_SUPPLY_PROP_IGNORE_FALSE_NEGATIVE_ISENSE:
		val->intval = !chip->allow_false_negative_isense;
@@ -5156,6 +5157,7 @@ static irqreturn_t fg_batt_missing_irq_handler(int irq, void *_chip)
		fg_cap_learning_stop(chip);
		chip->battery_missing = true;
		chip->profile_loaded = false;
		chip->soc_reporting_ready = false;
		chip->batt_type = default_batt_type;
		mutex_lock(&chip->cyc_ctr.lock);
		if (fg_debug_mask & FG_IRQS)
@@ -6440,6 +6442,7 @@ done:

	chip->first_profile_loaded = true;
	chip->profile_loaded = true;
	chip->soc_reporting_ready = true;
	chip->battery_missing = is_battery_missing(chip);
	update_chg_iterm(chip);
	update_cc_cv_setpoint(chip);
@@ -6458,6 +6461,7 @@ done:
	complete_all(&chip->fg_reset_done);
	return rc;
no_profile:
	chip->soc_reporting_ready = true;
	if (chip->charging_disabled) {
		rc = set_prop_enable_charging(chip, true);
		if (rc)
@@ -8323,6 +8327,7 @@ static void ima_error_recovery_work(struct work_struct *work)
	if (!chip->use_otp_profile) {
		chip->battery_missing = true;
		chip->profile_loaded = false;
		chip->soc_reporting_ready = false;
		chip->batt_type = default_batt_type;
		fg_handle_battery_insertion(chip);
	}