rockchip64-6.19: update rk3399 typec alt mode patch
This commit is contained in:
parent
30fba6f1b1
commit
a345becef5
@ -18,10 +18,10 @@ Signed-off-by: Ondrej Jirman <megi@xff.cz>
|
||||
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
|
||||
index d96ab106a980b..2ef5fe61421be 100644
|
||||
--- a/drivers/usb/typec/altmodes/displayport.c
|
||||
+++ b/drivers/usb/typec/altmodes/displayport.c
|
||||
@@ -177,11 +177,29 @@ static int dp_altmode_configure(struct dp_altmode *dp, u8 con)
|
||||
@@ -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,9 +51,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 */
|
||||
@@ -830,21 +830,43 @@ int dp_altmode_probe(struct typec_altmode *alt)
|
||||
{
|
||||
const struct typec_altmode *port = typec_altmode_get_partner(alt);
|
||||
@@ -757,16 +775,38 @@ int dp_altmode_probe(struct typec_altmode *alt)
|
||||
struct typec_altmode *plug = typec_altmode_get_plug(alt, TYPEC_PLUG_SOP_P);
|
||||
struct fwnode_handle *fwnode;
|
||||
struct dp_altmode *dp;
|
||||
@ -67,18 +65,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;
|
||||
+
|
||||
@ -86,20 +84,17 @@ 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);
|
||||
return -ENODEV;
|
||||
+ typec_altmode_put_plug(plug);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ /* Make sure we have compatiple pin configurations */
|
||||
+ 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);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
|
||||
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
|
||||
if (!dp)
|
||||
return -ENOMEM;
|
||||
|
||||
typec_altmode_put_plug(plug);
|
||||
return -ENODEV;
|
||||
}
|
||||
--
|
||||
Armbian
|
||||
|
||||
Loading…
Reference in New Issue
Block a user