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

Commit a397bab9 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb5-lib: fix thermal throttling ICL handling"

parents f3587131 41f672fc
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -889,6 +889,7 @@ static int smb5_usb_get_prop(struct power_supply *psy,
	return 0;
}

#define MIN_THERMAL_VOTE_UA	500000
static int smb5_usb_set_prop(struct power_supply *psy,
		enum power_supply_property psp,
		const union power_supply_propval *val)
@@ -940,10 +941,20 @@ static int smb5_usb_set_prop(struct power_supply *psy,
		power_supply_changed(chg->usb_psy);
		break;
	case POWER_SUPPLY_PROP_THERM_ICL_LIMIT:
		icl = get_effective_result(chg->usb_icl_votable);
		if ((icl + val->intval) > 0)
		if (!is_client_vote_enabled(chg->usb_icl_votable,
						THERMAL_THROTTLE_VOTER)) {
			chg->init_thermal_ua = get_effective_result(
							chg->usb_icl_votable);
			icl = chg->init_thermal_ua + val->intval;
		} else {
			icl = get_client_vote(chg->usb_icl_votable,
					THERMAL_THROTTLE_VOTER) + val->intval;
		}

		if (icl >= MIN_THERMAL_VOTE_UA)
			rc = vote(chg->usb_icl_votable, THERMAL_THROTTLE_VOTER,
					true, icl + val->intval);
				(icl != chg->init_thermal_ua) ? true : false,
				icl);
		else
			rc = -EINVAL;
		break;
+1 −0
Original line number Diff line number Diff line
@@ -504,6 +504,7 @@ struct smb_charger {
	int			charge_full_cc;
	int			cc_soc_ref;
	int			usbin_forced_max_uv;
	int			init_thermal_ua;

	/* workaround flag */
	u32			wa_flags;