From: Badhri Jagan Sridharan Date: Mon, 28 Aug 2017 17:23:13 +0000 (-0700) Subject: staging: typec: tcpm: Check for port type for Try.SRC/Try.SNK X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ff6c8cb172269cb9102a1f247d093ae628f3f23b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git staging: typec: tcpm: Check for port type for Try.SRC/Try.SNK Enable Try.SRC or Try.SNK only when port_type is DRP. Try.SRC or Try.SNK state machines are not valid for SRC only or SNK only ports. Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c index 7c9b1485818b..81b052384cd5 100644 --- a/drivers/staging/typec/tcpm.c +++ b/drivers/staging/typec/tcpm.c @@ -328,10 +328,12 @@ struct pd_rx_event { (tcpm_cc_is_audio((port)->cc2) && tcpm_cc_is_open((port)->cc1))) #define tcpm_try_snk(port) \ - ((port)->try_snk_count == 0 && (port)->try_role == TYPEC_SINK) + ((port)->try_snk_count == 0 && (port)->try_role == TYPEC_SINK && \ + (port)->port_type == TYPEC_PORT_DRP) #define tcpm_try_src(port) \ - ((port)->try_src_count == 0 && (port)->try_role == TYPEC_SOURCE) + ((port)->try_src_count == 0 && (port)->try_role == TYPEC_SOURCE && \ + (port)->port_type == TYPEC_PORT_DRP) static enum tcpm_state tcpm_default_state(struct tcpm_port *port) {