Quoting Dmitry Baryshkov (2024-11-21 14:59:42) > On Tue, Nov 19, 2024 at 08:09:31PM -0500, Stephen Boyd wrote: > > > > It sounds like we're debating how to handle lane assignment in the > > kernel. Either way, the code is going to be implemented in the bridge > > driver because it's the one that has to change what physical lane a > > logical lane is assigned to. The question is if it should be some sort > > of bridge_funcs callback, or should bridge drivers hook into the typec > > framework to expose an orientation switch, or something else? > > I was assuming that orientation switch is such kind of a hook. > > > > > I'm thinking we should introduce some sort of bridge_funcs callback that > > can be called from the DP altmode driver, either parallel to the > > drm_connector_oob_hotplug_event() function or from it directly. If we > > can pass the fwnode for the usb-c-connector to the oob_hotplug_event > > callback, maybe that's all we need to figure out which lanes go where. > > And then in the 2 DP connector muxing world we can call > > drm_connector_oob_hotplug_event() with one or the other DP connector > > node, which will likely be children nodes of the "HPD redriver" device. > > If you call it from drm_bridge_connector's oob_hotplug_event handler, > this should fly. Does it cover your 3-DP or 4-DP usecases? > I think it will work as long as we're able to add some sort of property to the usb-c-connector node to indicate that the DP lanes are flipped. It feels like that should be in the displayport altmode node to keep things tidy because the SuperSpeed port is overloaded. Maybe the drm framework can have some API that can take the fwnode from the oob_hotplug_event handler and tell the bridge driver which way the orientation is. connector { compatible = "usb-c-connector"; altmodes { displayport { orientation-reversed; } }; ports { ... }; }; int drm_dp_typec_orientation_flipped(struct fwnode_handle *fwnode) { struct fwnode_handle *altmodes; struct fwnode_handle *dp; altmodes = fwnode_get_named_child_node(fwnode, "altmodes"); if (!altmodes) return -EINVAL; dp = fwnode_get_named_child_node(altmodes, "displayport"); if (!dp) return -EINVAL; if (fwnode_property_read_bool(dp, "orientation-reversed")) return 1; return 0; } There's another wrinkle on some Corsola devices where the EC says there's a usb-c-connector on the board, but in reality the DP lanes are connected to a DP-to-HDMI bridge that is controlled by the EC which goes to an HDMI connector on the side of the laptop. The EC does the arbitration as usual because there's only one DP source and one or two usb type-c connectors physically on the laptop in addition to the HDMI connector. The easiest way to imagine this is that we took the usb-c-connector and jammed an HDMI dongle in there with some glue so that it can never be removed. There isn't any USB going there either because it can't be used. I suppose we can continue to describe this with an altmodes/displayport node but then add some compatible like "usb-c-hdmi-connector" or another property to the altmodes/displayport node like "type = hdmi" that signifies this is a connector that only outputs HDMI.