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

Commit 3814aad3 authored by Zhenhua Huang's avatar Zhenhua Huang Committed by Gerrit - the friendly Code Review server
Browse files

power: smb1360: Add a property to disable ov-ends-chg-cycle



With ov-ends-charge-cycle enabled, if soft JEITA kicks in
and battery voltage higher than compensated float voltage,
the battery OV(over voltage) interrupt will be triggered and
charging will be stopped. After battery temperature falls
back to normal range, charging won't be resumed automatically
until charging disabled/enabled once.

Add the interface to disable ov-ends-charge-cycle, to fix
charging can not resume issue.

CRs-Fixed: 854879
Change-Id: I07abe0b25f4d389154afaa83495e2c42d37c5029
Signed-off-by: default avatarZhenhua Huang <zhenhuah@codeaurora.org>
parent 23eab882
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -41,6 +41,12 @@ Optional Properties:
- qcom,iterm-disabled		Disables the termination current feature. This is a bool
				property.
- qcom,chg-inhibit-disabled	Disables the charger-inhibit function.
- qcom,disable-ov-ends-chg-cycle
				The boolean property to indicate if the ov-ends-charge-cycle
				feature is disabled. If the feature is disabled, charging
				could be resumed from battery OV (over voltage) status; otherwise,
				charging cycle will be terminated after battery OV event and
				won't be resumed until disable/enable charging.
- qcom,batt-id-disabled		Disabled the batt-id function. Doing this will
				disable the ability of RID based battery profile selection.
- qcom,fg-delta-soc		The delta in SOC which will generate an interrupt
+15 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@
#define CHG_EN_BY_PIN_BIT		BIT(7)
#define CHG_EN_ACTIVE_LOW_BIT		BIT(6)
#define PRE_TO_FAST_REQ_CMD_BIT		BIT(5)
#define CFG_BAT_OV_ENDS_CHG_CYC		BIT(4)
#define CHG_CURR_TERM_DIS_BIT		BIT(3)
#define CFG_AUTO_RECHG_DIS_BIT		BIT(2)
#define CFG_CHG_INHIBIT_EN_BIT		BIT(0)
@@ -304,6 +305,7 @@ struct smb1360_chip {
	bool				shdn_after_pwroff;
	bool				config_hard_thresholds;
	bool				soft_jeita_supported;
	bool				ov_ends_chg_cycle_disabled;
	int				iterm_ma;
	int				vfloat_mv;
	int				safety_time;
@@ -3793,6 +3795,16 @@ static int smb1360_hw_init(struct smb1360_chip *chip)
		return rc;
	}

	rc = smb1360_masked_write(chip, CFG_CHG_MISC_REG,
					CFG_BAT_OV_ENDS_CHG_CYC,
					chip->ov_ends_chg_cycle_disabled ?
					0 : CFG_BAT_OV_ENDS_CHG_CYC);
	if (rc) {
		dev_err(chip->dev, "Couldn't set bat_ov_ends_charge rc = %d\n"
									, rc);
		return rc;
	}

	/* battery missing detection */
	rc = smb1360_masked_write(chip, CFG_BATT_MISSING_REG,
				BATT_MISSING_SRC_THERM_BIT,
@@ -4191,6 +4203,9 @@ static int smb_parse_dt(struct smb1360_chip *chip)
	chip->min_icl_usb100 = of_property_read_bool(node,
						"qcom,min-icl-100ma");

	chip->ov_ends_chg_cycle_disabled = of_property_read_bool(node,
					"qcom,disable-ov-ends-chg-cycle");

	rc = smb1360_parse_parallel_charging_params(chip);
	if (rc) {
		pr_err("Couldn't parse parallel charginng params rc=%d\n", rc);