fix broken patch

This commit is contained in:
EvilOlaf 2026-01-08 10:53:29 +00:00 committed by Igor
parent ba7701a991
commit 40173173cf

View File

@ -14,16 +14,13 @@ wrong VDO.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/usb/typec/altmodes/displayport.c | 50 +++++++++-
drivers/usb/typec/altmodes/displayport.c | 50 ++++++++++++++++++++++++++++----
1 file changed, 45 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
index 111111111111..222222222222 100644
--- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c
@@ -123,11 +123,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);
+
+ /*
@ -51,7 +48,7 @@ index 111111111111..222222222222 100644
/* Determining the initial pin assignment. */
if (!DP_CONF_GET_PIN_ASSIGN(dp->data.conf)) {
/* Is USB together with DP preferred */
@@ -757,15 +775,37 @@ int dp_altmode_probe(struct typec_altmode *alt)
@@ -757,14 +775,36 @@
struct typec_altmode *plug = typec_altmode_get_plug(alt, TYPEC_PLUG_SOP_P);
struct fwnode_handle *fwnode;
struct dp_altmode *dp;
@ -63,18 +60,18 @@ index 111111111111..222222222222 100644
- if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) &
- DP_CAP_PIN_ASSIGN_UFP_D(alt->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))) {
+ /*
+ * When port is a receptacle DP_CAP_xFP_D_PIN_ASSIGN macros have the
+ * regular meaning. When the port is a plug, the meaning is swapped.
+ *
+ * Check if we have any matching DFP_D<->UFP_D or UFP_D<->DFP_D pin assignment.
+ */
+ port_pins = port->vdo & DP_CAP_RECEPTACLE ?
+ port_pins = port->vdo & DP_CAP_RECEPTACLE ?
+ DP_CAP_DFP_D_PIN_ASSIGN(port->vdo) | DP_CAP_UFP_D_PIN_ASSIGN(port->vdo) << 8 :
+ DP_CAP_UFP_D_PIN_ASSIGN(port->vdo) | DP_CAP_DFP_D_PIN_ASSIGN(port->vdo) << 8;
+
+ alt_pins = alt->vdo & DP_CAP_RECEPTACLE ?
+ alt_pins = alt->vdo & DP_CAP_RECEPTACLE ?
+ DP_CAP_UFP_D_PIN_ASSIGN(alt->vdo) | DP_CAP_DFP_D_PIN_ASSIGN(alt->vdo) << 8 :
+ DP_CAP_DFP_D_PIN_ASSIGN(alt->vdo) | DP_CAP_UFP_D_PIN_ASSIGN(alt->vdo) << 8;
+
@ -82,6 +79,7 @@ index 111111111111..222222222222 100644
+ 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",
+ port->vdo, alt->vdo);
+ typec_altmode_put_plug(plug);
+ return -ENODEV;
+ }
+
@ -89,11 +87,8 @@ index 111111111111..222222222222 100644
+ 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",
+ port->vdo, alt->vdo, port_pins, alt_pins);
typec_altmode_put_plug(plug);
return -ENODEV;
+ }
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
if (!dp)
--
}
--
Armbian