Skip to content

Commit f8949c4

Browse files
author
Desnes Nunes
committed
usb: typec: tcpm: allow to use sink in accessory mode
JIRA: https://issues.redhat.com/browse/RHEL-116016 commit 64843d0 Author: Michael Grzeschik <m.grzeschik@pengutronix.de> Date: Fri, 4 Apr 2025 00:43:04 +0200 Since the function tcpm_acc_attach is not setting the data and role for for the sink case we extend it to check for it first. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20250404-ml-topic-tcpm-v1-1-b99f44badce8@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Desnes Nunes <desnesn@redhat.com>
1 parent 44269d2 commit f8949c4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4551,12 +4551,17 @@ static void tcpm_snk_detach(struct tcpm_port *port)
45514551
static int tcpm_acc_attach(struct tcpm_port *port)
45524552
{
45534553
int ret;
4554+
enum typec_role role;
4555+
enum typec_data_role data;
45544556

45554557
if (port->attached)
45564558
return 0;
45574559

4558-
ret = tcpm_set_roles(port, true, TYPEC_SOURCE,
4559-
tcpm_data_role_for_source(port));
4560+
role = tcpm_port_is_sink(port) ? TYPEC_SINK : TYPEC_SOURCE;
4561+
data = tcpm_port_is_sink(port) ? tcpm_data_role_for_sink(port)
4562+
: tcpm_data_role_for_source(port);
4563+
4564+
ret = tcpm_set_roles(port, true, role, data);
45604565
if (ret < 0)
45614566
return ret;
45624567

0 commit comments

Comments
 (0)