Message ID | 20240331-adv7511-next-bridge-v2-1-7356d61dc7b2@linaro.org |
---|---|
State | Accepted |
Commit | 14b3cdbd0e5b73824b7b2c7a4b1fbfd743044a5e |
Headers | show |
Series | [v2] drm/bridge: adv7511: make it honour next bridge in DT | expand |
On 31/03/2024 22:45, Dmitry Baryshkov wrote: > DT bindings for adv7511 and adv7533 bridges specify HDMI output to be > present at the port@1. This allows board DT to add e.g. HDMI connector > nodes or any other next chained bridge. Make adv7511 driver discover > that bridge and attach it to the chain. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- > Changes in v2: > - Fixed the absent next bridge usecase > - Link to v1: https://lore.kernel.org/r/20240309-adv7511-next-bridge-v1-1-d1ad522ef623@linaro.org > --- > drivers/gpu/drm/bridge/adv7511/adv7511.h | 1 + > drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 12 ++++++++++++ > 2 files changed, 13 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h > index 39c9ece373b0..ea271f62b214 100644 > --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h > @@ -356,6 +356,7 @@ struct adv7511 { > enum drm_connector_status status; > bool powered; > > + struct drm_bridge *next_bridge; > struct drm_display_mode curr_mode; > > unsigned int f_tmds; > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > index b5518ff97165..c50d994a33b5 100644 > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > @@ -17,6 +17,7 @@ > #include <drm/drm_atomic.h> > #include <drm/drm_atomic_helper.h> > #include <drm/drm_edid.h> > +#include <drm/drm_of.h> > #include <drm/drm_print.h> > #include <drm/drm_probe_helper.h> > > @@ -946,6 +947,12 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge, > struct adv7511 *adv = bridge_to_adv7511(bridge); > int ret = 0; > > + if (adv->next_bridge) { > + ret = drm_bridge_attach(bridge->encoder, adv->next_bridge, bridge, flags); > + if (ret) > + return ret; > + } > + > if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { > ret = adv7511_connector_init(adv); > if (ret < 0) > @@ -1216,6 +1223,11 @@ static int adv7511_probe(struct i2c_client *i2c) > > memset(&link_config, 0, sizeof(link_config)); > > + ret = drm_of_find_panel_or_bridge(dev->of_node, 1, -1, NULL, > + &adv7511->next_bridge); > + if (ret && ret != -ENODEV) > + return ret; > + > if (adv7511->info->link_config) > ret = adv7511_parse_dt(dev->of_node, &link_config); > else > > --- > base-commit: 1843e16d2df9d98427ef8045589571749d627cf7 > change-id: 20240309-adv7511-next-bridge-10d8bbe0544e > > Best regards, Indeed looks safer. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Neil
Hi, On Sun, 31 Mar 2024 23:45:48 +0300, Dmitry Baryshkov wrote: > DT bindings for adv7511 and adv7533 bridges specify HDMI output to be > present at the port@1. This allows board DT to add e.g. HDMI connector > nodes or any other next chained bridge. Make adv7511 driver discover > that bridge and attach it to the chain. > > Thanks, Applied to https://gitlab.freedesktop.org/drm/misc/kernel.git (drm-misc-next) [1/1] drm/bridge: adv7511: make it honour next bridge in DT https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/14b3cdbd0e5b73824b7b2c7a4b1fbfd743044a5e
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h index 39c9ece373b0..ea271f62b214 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -356,6 +356,7 @@ struct adv7511 { enum drm_connector_status status; bool powered; + struct drm_bridge *next_bridge; struct drm_display_mode curr_mode; unsigned int f_tmds; diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index b5518ff97165..c50d994a33b5 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -17,6 +17,7 @@ #include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_edid.h> +#include <drm/drm_of.h> #include <drm/drm_print.h> #include <drm/drm_probe_helper.h> @@ -946,6 +947,12 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge, struct adv7511 *adv = bridge_to_adv7511(bridge); int ret = 0; + if (adv->next_bridge) { + ret = drm_bridge_attach(bridge->encoder, adv->next_bridge, bridge, flags); + if (ret) + return ret; + } + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { ret = adv7511_connector_init(adv); if (ret < 0) @@ -1216,6 +1223,11 @@ static int adv7511_probe(struct i2c_client *i2c) memset(&link_config, 0, sizeof(link_config)); + ret = drm_of_find_panel_or_bridge(dev->of_node, 1, -1, NULL, + &adv7511->next_bridge); + if (ret && ret != -ENODEV) + return ret; + if (adv7511->info->link_config) ret = adv7511_parse_dt(dev->of_node, &link_config); else
DT bindings for adv7511 and adv7533 bridges specify HDMI output to be present at the port@1. This allows board DT to add e.g. HDMI connector nodes or any other next chained bridge. Make adv7511 driver discover that bridge and attach it to the chain. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- Changes in v2: - Fixed the absent next bridge usecase - Link to v1: https://lore.kernel.org/r/20240309-adv7511-next-bridge-v1-1-d1ad522ef623@linaro.org --- drivers/gpu/drm/bridge/adv7511/adv7511.h | 1 + drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) --- base-commit: 1843e16d2df9d98427ef8045589571749d627cf7 change-id: 20240309-adv7511-next-bridge-10d8bbe0544e Best regards,