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

Commit cf6ecfbb authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qcom: step-chg-jeita: Add support for OCV based step charging



Currently, step charging algorithm supports VBAT and SOC based
step charging. In addition, add OCV (Open Circuit Voltage) based
step charging which will be useful in certain hardware platforms
where OCV provides the proper threshold to switch between ranges.

Change-Id: I44d44759b18299d2aeb17d4ef4fd459eb07d6272
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent b2a6e0ff
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -82,10 +82,15 @@ Profile data node optional properties:
			If yes, the low and high thresholds defined in
			"qcom,step-chg-ranges" tuples should be assigned as
			SoC values in percentage.
- qcom,ocv-based-step-chg: A bool property to indicate if the battery will
			perform OCV (Open Circuit Voltage) based step charging.
			If yes, the low and high thresholds defined in
			"qcom,step-chg-ranges" tuples should be assigned as
			OCV values in microvolts.
- qcom,step-chg-ranges: Array of tuples in which a tuple describes a range
			data of step charging setting.
			A range contains following 3 integer elements:
			[0]: the low threshold of battery votlage in uV
			[0]: the low threshold of battery voltage in uV
			     or SoC (State of Charge) in percentage when
			     SoC based step charge is used;
			[1]: the high threshold of battery voltage in uV
+11 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ struct step_chg_info {
	bool			step_chg_cfg_valid;
	bool			sw_jeita_cfg_valid;
	bool			soc_based_step_chg;
	bool			ocv_based_step_chg;
	bool			batt_missing;
	int			jeita_fcc_index;
	int			jeita_fv_index;
@@ -267,6 +268,16 @@ static int get_step_chg_jeita_setting_from_profile(struct step_chg_info *chip)
		chip->step_chg_config->param.hysteresis = 0;
	}

	chip->ocv_based_step_chg =
		of_property_read_bool(profile_node, "qcom,ocv-based-step-chg");
	if (chip->ocv_based_step_chg) {
		chip->step_chg_config->param.psy_prop =
				POWER_SUPPLY_PROP_VOLTAGE_OCV;
		chip->step_chg_config->param.prop_name = "OCV";
		chip->step_chg_config->param.hysteresis = 10000;
		chip->step_chg_config->param.use_bms = true;
	}

	chip->step_chg_cfg_valid = true;
	rc = read_range_data_from_node(profile_node,
			"qcom,step-chg-ranges",