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

Commit 941d8779 authored by Guru Das Srinagesh's avatar Guru Das Srinagesh Committed by Ashay Jaiswal
Browse files

power: smb5: Set DCIN ICL value via DT



Add device tree support for changing the DCIN input current limit.

Change-Id: Iff25344e58bd65b19d1d3362f26d936857038201
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent 994a2da4
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -397,7 +397,7 @@ static int smb5_parse_dt(struct smb5 *chip)
{
	struct smb_charger *chg = &chip->chg;
	struct device_node *node = chg->dev->of_node;
	int rc, byte_len;
	int rc, byte_len, tmp;

	if (!node) {
		pr_err("device tree node missing\n");
@@ -654,6 +654,12 @@ static int smb5_parse_dt(struct smb5 *chip)
	if (chg->chg_param.hvdcp3_max_icl_ua <= 0)
		chg->chg_param.hvdcp3_max_icl_ua = MICRO_3PA;

	chg->wls_icl_ua = DCIN_ICL_MAX_UA;
	rc = of_property_read_u32(node, "qcom,wls-current-max-ua",
			&tmp);
	if (!rc && tmp < DCIN_ICL_MAX_UA)
		chg->wls_icl_ua = tmp;

	return 0;
}

+2 −3
Original line number Diff line number Diff line
@@ -5995,14 +5995,13 @@ static void dcin_aicl(struct smb_charger *chg)
	if (rc < 0)
		goto unlock;

	if (icl == DCIN_ICL_MAX_UA) {
	if (icl == chg->wls_icl_ua) {
		/* Upper limit reached; do nothing */
		smblib_dbg(chg, PR_WLS, "hit max ICL: stop\n");
		goto unlock;
	}

	icl += DCIN_ICL_STEP_UA;

	icl = min(chg->wls_icl_ua, icl + DCIN_ICL_STEP_UA);
	icl_save = icl;

	rc = smblib_set_charge_param(chg, &chg->param.dc_icl, icl);
+1 −0
Original line number Diff line number Diff line
@@ -563,6 +563,7 @@ struct smb_charger {
	int			init_thermal_ua;
	u32			comp_clamp_level;
	bool			hvdcp3_standalone_config;
	int			wls_icl_ua;

	/* workaround flag */
	u32			wa_flags;