On Sun, 11 Feb 2024 at 10:52, Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote: > > Quoting Dmitry Baryshkov (2024-02-10 06:10:31) > > On Sat, 10 Feb 2024 at 09:14, Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote: > > > diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c > > > index 769de2889f2f..d8fb6662cf8d 100644 > > > --- a/drivers/platform/chrome/cros_typec_switch.c > > > +++ b/drivers/platform/chrome/cros_typec_switch.c > > > @@ -18,6 +19,15 @@ > > > #include <linux/usb/typec_mux.h> > > > #include <linux/usb/typec_retimer.h> > > > > > > +#include <drm/drm_bridge.h> > > > +#include <drm/drm_print.h> > > > + > > > +struct cros_typec_dp_bridge { > > > + struct cros_typec_switch_data *sdata; > > > + bool hpd_enabled; > > > + struct drm_bridge bridge; > > > +}; > > > > Is there any chance that you can use drm_dp_hpd_bridge_register() / > > drm_aux_hpd_bridge_notify() instead of implementing another > > drm_bridge? > > If something is missing from the existing implementation we can > > probably work that out. > > Yeah I think that can work. I had put the drm_bridge in this driver > because I needed a 'struct device' per DP phy, but I think that problem > goes away with an auxiliary device, so that is nicely solved. > > I'll have to add logic about typec ports to that auxiliary driver > though, like mapping data-lanes and handling lane assignments. And then > I'll move this code from the cros_typec_switch driver to the > cros_ec_typec driver so it can be called outside of the typec mux set > path. That's probably better because it's sort of bolted on to the > cros_typec_switch driver. We'll need to know if the DP phy needs to > handle orientation or if the EC is doing that somehow, so probably I'll > need to add a DT property to the google,cros-ec-typec binding to > indicate that orientation control is needed. I still haven't fully got into your usage of data-lanes. I hope to be able to comment on that part and on the ports / endpoints tomorrow. > > It looks like I should add a new auxiliary device, like > 'dp_typec_bridge', and have some other function like > drm_dp_typec_bridge_register() for that. I can wrap the 'struct > drm_aux_hpd_bridge_data' with a 'struct drm_aux_typec_bridge_data' and > then the typec port information can live there. HPD can still be > signaled with drm_aux_hpd_bridge_notify() but other functions can be > used to set the active typec port, e.g. > drm_aux_typec_bridge_set_active_port(), and then get orientation with > typec_get_orientation() in the atomic_check(). -- With best wishes Dmitry