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

Commit 76543a19 authored by Mayank Rana's avatar Mayank Rana
Browse files

ucsi: start usb host mode when partner type is power cable/ufp



Currently UCSI framework doesn't perform anything in terms of USB role
when partner type is reported as power cable or power cable with ufp
connected. This results into no USB host mode functionality. This is
valid usecase where user wants to use legacy type c power cable with
type a female connector to attach different USB devices like mouse,
thumb drive etc. Hence start USB host mode when partner type is
reported as power cable or power cable with ufp connected.

Change-Id: Id9e7fe74f6a50a0fd92d1d13cb54e918d42c7711
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent e2298d13
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -481,6 +481,8 @@ static void ucsi_partner_change(struct ucsi_connector *con)

	switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) {
	case UCSI_CONSTAT_PARTNER_TYPE_UFP:
	case UCSI_CONSTAT_PARTNER_TYPE_CABLE:
	case UCSI_CONSTAT_PARTNER_TYPE_CABLE_AND_UFP:
		u_role = USB_ROLE_HOST;
		typec_set_data_role(con->port, TYPEC_HOST);
		break;
@@ -550,6 +552,8 @@ static void ucsi_handle_connector_change(struct work_struct *work)

		switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) {
		case UCSI_CONSTAT_PARTNER_TYPE_UFP:
		case UCSI_CONSTAT_PARTNER_TYPE_CABLE:
		case UCSI_CONSTAT_PARTNER_TYPE_CABLE_AND_UFP:
			u_role = USB_ROLE_HOST;
			typec_set_data_role(con->port, TYPEC_HOST);
			break;
@@ -858,6 +862,8 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)

	switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) {
	case UCSI_CONSTAT_PARTNER_TYPE_UFP:
	case UCSI_CONSTAT_PARTNER_TYPE_CABLE:
	case UCSI_CONSTAT_PARTNER_TYPE_CABLE_AND_UFP:
		role = USB_ROLE_HOST;
		typec_set_data_role(con->port, TYPEC_HOST);
		break;