Message ID | 20230709202511.287794-4-dmitry.baryshkov@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | drm/bridge_connector: implement OOB HPD handling | expand |
On 2023-07-09 23:25:11 +0300, Dmitry Baryshkov wrote: > Implement the oob_hotplug_event() callback. Translate it to the HPD > notification sent to the HPD bridge in the chain. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Janne Grunau <j@jannau.net> > --- > drivers/gpu/drm/drm_bridge_connector.c | 29 +++++++++++++++++++++++--- > 1 file changed, 26 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c > index 84d8d310ef04..364f6e37fbdc 100644 > --- a/drivers/gpu/drm/drm_bridge_connector.c > +++ b/drivers/gpu/drm/drm_bridge_connector.c > @@ -5,6 +5,8 @@ > > #include <linux/kernel.h> > #include <linux/module.h> > +#include <linux/of.h> > +#include <linux/property.h> > #include <linux/slab.h> > > #include <drm/drm_atomic_state_helper.h> > @@ -107,10 +109,9 @@ static void drm_bridge_connector_hpd_notify(struct drm_connector *connector, > } > } > > -static void drm_bridge_connector_hpd_cb(void *cb_data, > - enum drm_connector_status status) > +static void drm_bridge_connector_handle_hpd(struct drm_bridge_connector *drm_bridge_connector, > + enum drm_connector_status status) > { > - struct drm_bridge_connector *drm_bridge_connector = cb_data; > struct drm_connector *connector = &drm_bridge_connector->base; > struct drm_device *dev = connector->dev; > > @@ -123,6 +124,21 @@ static void drm_bridge_connector_hpd_cb(void *cb_data, > drm_kms_helper_hotplug_event(dev); > } > > +static void drm_bridge_connector_hpd_cb(void *cb_data, > + enum drm_connector_status status) > +{ > + drm_bridge_connector_handle_hpd(cb_data, status); > +} > + > +static void drm_bridge_connector_oob_hotplug_event(struct drm_connector *connector, > + enum drm_connector_status status) > +{ > + struct drm_bridge_connector *bridge_connector = > + to_drm_bridge_connector(connector); > + > + drm_bridge_connector_handle_hpd(bridge_connector, status); > +} > + > static void drm_bridge_connector_enable_hpd(struct drm_connector *connector) > { > struct drm_bridge_connector *bridge_connector = > @@ -216,6 +232,7 @@ static const struct drm_connector_funcs drm_bridge_connector_funcs = { > .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, > .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > .debugfs_init = drm_bridge_connector_debugfs_init, > + .oob_hotplug_event = drm_bridge_connector_oob_hotplug_event, > }; > > /* ----------------------------------------------------------------------------- > @@ -351,6 +368,12 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, > if (!drm_bridge_get_next_bridge(bridge)) > connector_type = bridge->type; > > +#ifdef CONFIG_OF > + if (!drm_bridge_get_next_bridge(bridge) && > + bridge->of_node) > + connector->fwnode = fwnode_handle_get(of_fwnode_handle(bridge->of_node)); > +#endif > + > if (bridge->ddc) > ddc = bridge->ddc; > > -- > 2.39.2 >
diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 84d8d310ef04..364f6e37fbdc 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -5,6 +5,8 @@ #include <linux/kernel.h> #include <linux/module.h> +#include <linux/of.h> +#include <linux/property.h> #include <linux/slab.h> #include <drm/drm_atomic_state_helper.h> @@ -107,10 +109,9 @@ static void drm_bridge_connector_hpd_notify(struct drm_connector *connector, } } -static void drm_bridge_connector_hpd_cb(void *cb_data, - enum drm_connector_status status) +static void drm_bridge_connector_handle_hpd(struct drm_bridge_connector *drm_bridge_connector, + enum drm_connector_status status) { - struct drm_bridge_connector *drm_bridge_connector = cb_data; struct drm_connector *connector = &drm_bridge_connector->base; struct drm_device *dev = connector->dev; @@ -123,6 +124,21 @@ static void drm_bridge_connector_hpd_cb(void *cb_data, drm_kms_helper_hotplug_event(dev); } +static void drm_bridge_connector_hpd_cb(void *cb_data, + enum drm_connector_status status) +{ + drm_bridge_connector_handle_hpd(cb_data, status); +} + +static void drm_bridge_connector_oob_hotplug_event(struct drm_connector *connector, + enum drm_connector_status status) +{ + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + + drm_bridge_connector_handle_hpd(bridge_connector, status); +} + static void drm_bridge_connector_enable_hpd(struct drm_connector *connector) { struct drm_bridge_connector *bridge_connector = @@ -216,6 +232,7 @@ static const struct drm_connector_funcs drm_bridge_connector_funcs = { .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .debugfs_init = drm_bridge_connector_debugfs_init, + .oob_hotplug_event = drm_bridge_connector_oob_hotplug_event, }; /* ----------------------------------------------------------------------------- @@ -351,6 +368,12 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, if (!drm_bridge_get_next_bridge(bridge)) connector_type = bridge->type; +#ifdef CONFIG_OF + if (!drm_bridge_get_next_bridge(bridge) && + bridge->of_node) + connector->fwnode = fwnode_handle_get(of_fwnode_handle(bridge->of_node)); +#endif + if (bridge->ddc) ddc = bridge->ddc;
Implement the oob_hotplug_event() callback. Translate it to the HPD notification sent to the HPD bridge in the chain. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/drm_bridge_connector.c | 29 +++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)