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

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

Merge "usb: typec: ucsi: Notify USB role switch only if partner supports USB data"

parents 3d7b513f 0efff128
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -498,6 +498,10 @@ static void ucsi_partner_change(struct ucsi_connector *con)
	if (!completion_done(&con->complete))
		complete(&con->complete);

	/* Only notify USB controller if partner supports USB data */
	if (!(UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) & UCSI_CONSTAT_PARTNER_FLAG_USB))
		u_role = USB_ROLE_NONE;

	ret = usb_role_switch_set_role(ucsi->usb_role_sw, u_role);
	if (ret)
		dev_err(ucsi->dev, "%s(): failed to set role(%d):%d\n",
@@ -570,6 +574,11 @@ static void ucsi_handle_connector_change(struct work_struct *work)
		else
			ucsi_unregister_partner(con);

		/* Only notify USB controller if partner supports USB data */
		if (!(UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) &
				UCSI_CONSTAT_PARTNER_FLAG_USB))
			u_role = USB_ROLE_NONE;

		ret = usb_role_switch_set_role(ucsi->usb_role_sw, u_role);
		if (ret)
			dev_err(ucsi->dev, "%s(): failed to set role(%d):%d\n",
@@ -883,6 +892,10 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
		ucsi_register_partner(con);
	}

	/* Only notify USB controller if partner supports USB data */
	if (!(UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) & UCSI_CONSTAT_PARTNER_FLAG_USB))
		role = USB_ROLE_NONE;

	ret = usb_role_switch_set_role(ucsi->usb_role_sw, role);
	if (ret)
		dev_err(ucsi->dev, "%s(): failed to set role(%d):%d\n",