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

Commit 95c66bad authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-qg: Update a specific SOC scaling condition"

parents e58dfec0 83094d94
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -486,8 +486,9 @@ static bool is_scaling_required(struct qpnp_qg *chip)

	if (chip->catch_up_soc > chip->msoc && input_present &&
			(chip->charge_status != POWER_SUPPLY_STATUS_CHARGING &&
			chip->charge_status != POWER_SUPPLY_STATUS_FULL))
		/* USB is present, but not charging */
			chip->charge_status != POWER_SUPPLY_STATUS_FULL
			&& chip->msoc != 0))
		/* USB is present, but not charging. Ignore when msoc = 0 */
		return false;

	return true;
+24 −1
Original line number Diff line number Diff line
@@ -1963,13 +1963,14 @@ static bool is_charging_paused(struct smb_charger *chg)
	return val & CHARGING_PAUSE_CMD_BIT;
}

#define CUTOFF_COUNT		3
int smblib_get_prop_batt_status(struct smb_charger *chg,
				union power_supply_propval *val)
{
	union power_supply_propval pval = {0, };
	bool usb_online, dc_online;
	u8 stat;
	int rc, suspend = 0;
	int rc, suspend = 0, input_present = 0;

	if (chg->fake_chg_status_on_debug_batt) {
		rc = smblib_get_prop_from_bms(chg,
@@ -1999,6 +2000,28 @@ int smblib_get_prop_batt_status(struct smb_charger *chg,
		return 0;
	}

	/*
	 * If SOC = 0 and we are discharging with input connected, report
	 * the battery status as DISCHARGING.
	 */
	smblib_is_input_present(chg, &input_present);
	rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CAPACITY, &pval);
	if (!rc && pval.intval == 0 && input_present) {
		rc = smblib_get_prop_from_bms(chg,
				POWER_SUPPLY_PROP_CURRENT_NOW, &pval);
		if (!rc && pval.intval > 0) {
			if (chg->cutoff_count > CUTOFF_COUNT) {
				val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
				return 0;
			}
			chg->cutoff_count++;
		} else {
			chg->cutoff_count = 0;
		}
	} else {
		chg->cutoff_count = 0;
	}

	if (chg->dbc_usbov) {
		rc = smblib_get_prop_usb_present(chg, &pval);
		if (rc < 0) {
+1 −0
Original line number Diff line number Diff line
@@ -574,6 +574,7 @@ struct smb_charger {
	int			init_thermal_ua;
	u32			comp_clamp_level;
	int			wls_icl_ua;
	int			cutoff_count;
	bool			dcin_aicl_done;
	bool			hvdcp3_standalone_config;
	bool			dcin_icl_user_set;
+25 −1
Original line number Diff line number Diff line
@@ -721,13 +721,14 @@ static bool is_charging_paused(struct smb_charger *chg)
	return val & CHARGING_PAUSE_CMD_BIT;
}

#define CUTOFF_COUNT		3
int smblite_lib_get_prop_batt_status(struct smb_charger *chg,
				union power_supply_propval *val)
{
	union power_supply_propval pval = {0, };
	bool usb_online;
	u8 stat;
	int rc;
	int rc, input_present = 0;

	if (chg->fake_chg_status_on_debug_batt) {
		rc = smblite_lib_get_prop_from_bms(chg,
@@ -741,6 +742,29 @@ int smblite_lib_get_prop_batt_status(struct smb_charger *chg,
		}
	}

	/*
	 * If SOC = 0 and we are discharging with input connected, report
	 * the battery status as DISCHARGING.
	 */
	smblite_lib_is_input_present(chg, &input_present);
	rc = smblite_lib_get_prop_from_bms(chg,
				POWER_SUPPLY_PROP_CAPACITY, &pval);
	if (!rc && pval.intval == 0 && input_present) {
		rc = smblite_lib_get_prop_from_bms(chg,
				POWER_SUPPLY_PROP_CURRENT_NOW, &pval);
		if (!rc && pval.intval > 0) {
			if (chg->cutoff_count > CUTOFF_COUNT) {
				val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
				return 0;
			}
			chg->cutoff_count++;
		} else {
			chg->cutoff_count = 0;
		}
	} else {
		chg->cutoff_count = 0;
	}

	rc = smblite_lib_get_prop_usb_online(chg, &pval);
	if (rc < 0) {
		smblite_lib_err(chg, "Couldn't get usb online property rc=%d\n",
+1 −0
Original line number Diff line number Diff line
@@ -310,6 +310,7 @@ struct smb_charger {
	int			jeita_soft_fv[2];
	int			aicl_5v_threshold_mv;
	int			default_aicl_5v_threshold_mv;
	int			cutoff_count;
	bool			aicl_max_reached;
	bool			pr_swap_in_progress;
	bool			ldo_mode;