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

Commit 48372ebe authored by Guru Das Srinagesh's avatar Guru Das Srinagesh
Browse files

power: smb5: Obtain DC max voltage from WLS PSY



The default DC max voltage in the absence of a WLS PSY is 12 V.
If WLS PSY is present, obtain this value from it.

Change-Id: If41b747846937b5e4f5f7755753c5827741d5dbb
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent 195a10bd
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -2966,7 +2966,23 @@ int smblib_get_prop_dc_current_max(struct smb_charger *chg,
int smblib_get_prop_dc_voltage_max(struct smb_charger *chg,
				    union power_supply_propval *val)
{
	int rc;
	val->intval = MICRO_12V;

	if (!chg->wls_psy)
		chg->wls_psy = power_supply_get_by_name("wireless");

	if (chg->wls_psy) {
		rc = power_supply_get_property(chg->wls_psy,
				POWER_SUPPLY_PROP_VOLTAGE_MAX,
				val);
		if (rc < 0) {
			dev_err(chg->dev, "Couldn't get VOLTAGE_MAX, rc=%d\n",
					rc);
			return rc;
		}
	}

	return 0;
}