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

Commit b551fb59 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-smbcharger: Add property to set min ICL for main charger"

parents e9bab994 301725ea
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -304,6 +304,8 @@ Optional Properties:
				parallel slave to detect adapter's ICL capacity. Ideally
				to be used if the required FCC is greater then 3A and if
				the parallel slave supports AICL.
- qcom,parallel-min-main-icl-ma	Minimum ICL allotted to main charger in parallel
				configuration.

Example:
	qcom,qpnp-smbcharger {
+9 −3
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ struct parallel_usb_cfg {
	ktime_t				last_disabled;
	bool				enabled_once;
	int				parallel_aicl_ma;
	int				min_main_icl_ma;
	bool				use_parallel_aicl;
	bool				parallel_en_in_progress;
};
@@ -2265,7 +2266,7 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip,
	struct power_supply *parallel_psy = get_parallel_psy(chip);
	union power_supply_propval pval = {0, };
	int new_parallel_cl_ma, set_parallel_cl_ma, new_pmi_cl_ma, rc;
	int current_table_index, target_icl_ma;
	int current_table_index, target_icl_ma, pmi_icl_ma;
	int fcc_ma, main_fastchg_current_ma;
	int target_parallel_fcc_ma, supplied_parallel_fcc_ma;
	int parallel_chg_fcc_percent;
@@ -2283,8 +2284,11 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip,
	}
	/* Set USB ICL */
	target_icl_ma = get_effective_result_locked(chip->usb_icl_votable);
	new_parallel_cl_ma = total_current_ma
			* (100 - smbchg_main_chg_icl_percent) / 100;

	pmi_icl_ma = total_current_ma * smbchg_main_chg_icl_percent / 100;
	pmi_icl_ma = max(chip->parallel.min_main_icl_ma, pmi_icl_ma);
	new_parallel_cl_ma = total_current_ma - pmi_icl_ma;

	taper_irq_en(chip, true);
	power_supply_set_present(parallel_psy, true);
	power_supply_set_current_limit(parallel_psy,
@@ -7699,6 +7703,8 @@ static int smb_parse_dt(struct smbchg_chip *chip)
				"max-pulse-allowed", rc, 1);
	chip->parallel.use_parallel_aicl = of_property_read_bool(node,
					"qcom,use-parallel-aicl");
	OF_PROP_READ(chip, chip->parallel.min_main_icl_ma,
				"parallel-min-main-icl-ma", rc, 1);
	/*
	 * use the dt values if they exist, otherwise do not touch the params
	 */