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

Commit 87d410ce authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: step-chg-jeita: Allow JEITA ARB workaround configurable



Currently, when SW JEITA is enabled and Vbatt goes above Vfloat,
handle_jeita() suspends the USB input until the JEITA condition
goes away. This is to make sure that the charger doesn't end up
in reverse boost. This can cause charging status fluctuations
when the USB input is suspended and unsuspended frequently. In
SMB5 driver, handling ARB condition has a new sequence as per
the hardware recommendation. However, allowing the FCC/FV to
be configured based on temperature zones needs a lot of code
duplication. Hence, make changes in qcom_step_chg_init() to
take in another parameter to enable JEITA ARB workaround only
when needed.

Change-Id: Ia8de71b8d771d4dbcc3591116ecc40a6c9bf7e04
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 12165278
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5128,7 +5128,7 @@ int smblib_init(struct smb_charger *chg)
		}

		rc = qcom_step_chg_init(chg->dev, chg->step_chg_enabled,
						chg->sw_jeita_enabled);
						chg->sw_jeita_enabled, true);
		if (rc < 0) {
			smblib_err(chg, "Couldn't init qcom_step_chg_init rc=%d\n",
				rc);
+1 −1
Original line number Diff line number Diff line
@@ -5520,7 +5520,7 @@ int smblib_init(struct smb_charger *chg)
		}

		rc = qcom_step_chg_init(chg->dev, chg->step_chg_enabled,
						chg->sw_jeita_enabled);
						chg->sw_jeita_enabled, false);
		if (rc < 0) {
			smblib_err(chg, "Couldn't init qcom_step_chg_init rc=%d\n",
				rc);
+4 −2
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ struct step_chg_info {
	ktime_t			jeita_last_update_time;
	bool			step_chg_enable;
	bool			sw_jeita_enable;
	bool			jeita_arb_en;
	bool			config_is_read;
	bool			step_chg_cfg_valid;
	bool			sw_jeita_cfg_valid;
@@ -601,7 +602,7 @@ static int handle_jeita(struct step_chg_info *chip)
	 * Suspend USB input path if battery voltage is above
	 * JEITA VFLOAT threshold.
	 */
	if (fv_uv > 0) {
	if (chip->jeita_arb_en && fv_uv > 0) {
		rc = power_supply_get_property(chip->batt_psy,
				POWER_SUPPLY_PROP_VOLTAGE_NOW, &pval);
		if (!rc && (pval.intval > fv_uv))
@@ -753,7 +754,7 @@ static int step_chg_register_notifier(struct step_chg_info *chip)
}

int qcom_step_chg_init(struct device *dev,
		bool step_chg_enable, bool sw_jeita_enable)
		bool step_chg_enable, bool sw_jeita_enable, bool jeita_arb_en)
{
	int rc;
	struct step_chg_info *chip;
@@ -774,6 +775,7 @@ int qcom_step_chg_init(struct device *dev,
	chip->dev = dev;
	chip->step_chg_enable = step_chg_enable;
	chip->sw_jeita_enable = sw_jeita_enable;
	chip->jeita_arb_en = jeita_arb_en;
	chip->step_index = -EINVAL;
	chip->jeita_fcc_index = -EINVAL;
	chip->jeita_fv_index = -EINVAL;
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ struct range_data {
};

int qcom_step_chg_init(struct device *dev,
		bool step_chg_enable, bool sw_jeita_enable);
		bool step_chg_enable, bool sw_jeita_enable, bool jeita_arb_en);
void qcom_step_chg_deinit(void);
int read_range_data_from_node(struct device_node *node,
		const char *prop_str, struct range_data *ranges,