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

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

Merge "PD: policy_engine: Add timeout for mode change through sysfs"

parents c42ce055 a64cc72e
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2552,6 +2552,7 @@ static int usbpd_dr_set_property(struct dual_role_phy_instance *dual_role,
{
	struct usbpd *pd = dual_role_get_drvdata(dual_role);
	bool do_swap = false;
	int wait_count = 5;

	if (!pd)
		return -ENODEV;
@@ -2578,9 +2579,15 @@ static int usbpd_dr_set_property(struct dual_role_phy_instance *dual_role,
		set_power_role(pd, PR_NONE);

		/* wait until it takes effect */
		while (pd->forced_pr != POWER_SUPPLY_TYPEC_PR_NONE)
		while (pd->forced_pr != POWER_SUPPLY_TYPEC_PR_NONE &&
							--wait_count)
			msleep(20);

		if (!wait_count) {
			usbpd_err(&pd->dev, "setting mode timed out\n");
			return -ETIMEDOUT;
		}

		break;

	case DUAL_ROLE_PROP_DR: