fix broken patch

This commit is contained in:
EvilOlaf 2026-01-08 13:04:03 +00:00 committed by Werner
parent e38d028214
commit 45aac305ac

View File

@ -1,4 +1,4 @@
From 4924272fe0385296f3e06d7f9aff5166815c86db Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz> From: Ondrej Jirman <megi@xff.cz>
Date: Mon, 5 Sep 2022 00:56:07 +0200 Date: Mon, 5 Sep 2022 00:56:07 +0200
Subject: usb: typec: altmodes: displayport: Respect DP_CAP_RECEPTACLE bit Subject: usb: typec: altmodes: displayport: Respect DP_CAP_RECEPTACLE bit
@ -14,16 +14,13 @@ wrong VDO.
Signed-off-by: Ondrej Jirman <megi@xff.cz> Signed-off-by: Ondrej Jirman <megi@xff.cz>
--- ---
drivers/usb/typec/altmodes/displayport.c | 48 ++++++++++++++++++++++-- drivers/usb/typec/altmodes/displayport.c | 50 ++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 4 deletions(-) 1 file changed, 45 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
index 6964f403a2d5..9af15469fc3a 100644 index 111111111111..222222222222 100644
--- a/drivers/usb/typec/altmodes/displayport.c --- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c
@@ -116,11 +116,29 @@ static int dp_altmode_configure(struct dp_altmode *dp, u8 con)
/* Account for active cable capabilities */
if (dp->plug_prime)
pin_assign &= DP_CAP_UFP_D_PIN_ASSIGN(dp->plug_prime->vdo); pin_assign &= DP_CAP_UFP_D_PIN_ASSIGN(dp->plug_prime->vdo);
+ +
+ /* + /*
@ -45,18 +42,18 @@ index 6964f403a2d5..9af15469fc3a 100644
break; break;
} }
+
+ dev_info(&dp->alt->dev, "con=%d pin_assign=%x (port=%x alt=%x)\n", + dev_info(&dp->alt->dev, "con=%d pin_assign=%x (port=%x alt=%x)\n",
+ (int)con, (unsigned)pin_assign, dp->port->vdo, dp->alt->vdo); + (int)con, (unsigned)pin_assign, dp->port->vdo, dp->alt->vdo);
+ +
/* Determining the initial pin assignment. */ /* Determining the initial pin assignment. */
if (!DP_CONF_GET_PIN_ASSIGN(dp->data.conf)) { if (!DP_CONF_GET_PIN_ASSIGN(dp->data.conf)) {
/* Is USB together with DP preferred */ /* Is USB together with DP preferred */
@@ -729,15 +747,37 @@ int dp_altmode_probe(struct typec_altmode *alt) @@ -730,13 +749,35 @@
struct typec_altmode *plug = typec_altmode_get_plug(alt, TYPEC_PLUG_SOP_P);
struct fwnode_handle *fwnode; struct fwnode_handle *fwnode;
struct dp_altmode *dp; struct dp_altmode *dp;
+ u32 port_pins, alt_pins;
+ u32 port_pins, alt_pins;
/* FIXME: Port can only be DFP_U. */ /* FIXME: Port can only be DFP_U. */
+/* +/*
@ -77,6 +74,7 @@ index 6964f403a2d5..9af15469fc3a 100644
+ if (!(port->vdo & DP_CAP_RECEPTACLE) && !(alt->vdo & DP_CAP_RECEPTACLE)) { + if (!(port->vdo & DP_CAP_RECEPTACLE) && !(alt->vdo & DP_CAP_RECEPTACLE)) {
+ dev_warn(&alt->dev, "Our Alt-DP VDO 0x%06x and peer port VDO 0x%06x are not compatible (both are reported as plugs!)\n", + dev_warn(&alt->dev, "Our Alt-DP VDO 0x%06x and peer port VDO 0x%06x are not compatible (both are reported as plugs!)\n",
+ port->vdo, alt->vdo); + port->vdo, alt->vdo);
+ typec_altmode_put_plug(plug);
+ return -ENODEV; + return -ENODEV;
+ } + }
+ +
@ -84,15 +82,12 @@ index 6964f403a2d5..9af15469fc3a 100644
- if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) & - if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) &
- DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) && - DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) &&
- !(DP_CAP_PIN_ASSIGN_UFP_D(port->vdo) & - !(DP_CAP_PIN_ASSIGN_UFP_D(port->vdo) &
- DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo))) - DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo))) {
+ if (!(port_pins & alt_pins)) { + if (!(port_pins & alt_pins)) {
+ dev_warn(&alt->dev, "Our Alt-DP VDO 0x%06x and peer port VDO 0x%06x are not compatible (no shared pinconf %04x<->%04x (UUDD))\n", + dev_warn(&alt->dev, "Our Alt-DP VDO 0x%06x and peer port VDO 0x%06x are not compatible (no shared pinconf %04x<->%04x (UUDD))\n",
+ port->vdo, alt->vdo, port_pins, alt_pins); + port->vdo, alt->vdo, port_pins, alt_pins);
typec_altmode_put_plug(plug);
return -ENODEV; return -ENODEV;
+ } }
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
if (!dp)
-- --
2.43.0 2.43.0