Re: [PATCH v3 4/5] drm: convert drivers to use drm_of_find_panel_or_bridge

From: Sean Paul
Date: Fri Mar 24 2017 - 10:23:17 EST


On Wed, Mar 22, 2017 at 08:26:07AM -0500, Rob Herring wrote:
> Similar to the previous commit, convert drivers open coding OF graph
> parsing to use drm_of_find_panel_or_bridge instead.
>
> This changes some error messages to debug messages (in the graph core).
> Graph connections are often "no connects" depending on the particular
> board, so we want to avoid spurious messages. Plus the kernel is not a
> DT validator.
>
> Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> Reviewed-by: Archit Taneja <architt@xxxxxxxxxxxxxx>
> ---
> v3:
> - rebase to v4.11-rc2
> - rework atmel to support 1 to N connections
>
> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 73 ++++++-------------
> drivers/gpu/drm/bridge/nxp-ptn3460.c | 16 ++---
> drivers/gpu/drm/bridge/parade-ps8622.c | 16 ++---
> drivers/gpu/drm/bridge/tc358767.c | 27 +------
> drivers/gpu/drm/exynos/exynos_dp.c | 35 ++++-----
> drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 39 +++-------
> drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 27 ++-----
> drivers/gpu/drm/imx/imx-ldb.c | 27 ++-----
> drivers/gpu/drm/imx/parallel-display.c | 36 ++--------
> drivers/gpu/drm/mediatek/mtk_dsi.c | 23 ++----
> drivers/gpu/drm/mxsfb/mxsfb_out.c | 40 ++---------
> drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 26 ++-----
> drivers/gpu/drm/sun4i/sun4i_rgb.c | 11 +--
> drivers/gpu/drm/sun4i/sun4i_tcon.c | 90 ++----------------------
> 14 files changed, 92 insertions(+), 394 deletions(-)
>
<snip>

> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> index c3651456c963..511d68e22452 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> @@ -15,6 +15,7 @@
> #include <drm/drmP.h>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc_helper.h>
> +#include <drm/drm_of.h>
> #include <drm/drm_panel.h>
>
> #include "fsl_dcu_drm_drv.h"
> @@ -141,28 +142,6 @@ static int fsl_dcu_attach_panel(struct fsl_dcu_drm_device *fsl_dev,
> return ret;
> }
>
> -static int fsl_dcu_attach_endpoint(struct fsl_dcu_drm_device *fsl_dev,
> - const struct of_endpoint *ep)
> -{
> - struct drm_bridge *bridge;
> - struct device_node *np;
> -
> - np = of_graph_get_remote_port_parent(ep->local_node);
> -
> - fsl_dev->connector.panel = of_drm_find_panel(np);
> - if (fsl_dev->connector.panel) {
> - of_node_put(np);
> - return fsl_dcu_attach_panel(fsl_dev, fsl_dev->connector.panel);
> - }
> -
> - bridge = of_drm_find_bridge(np);
> - of_node_put(np);
> - if (!bridge)
> - return -ENODEV;
> -
> - return drm_bridge_attach(&fsl_dev->encoder, bridge, NULL);
> -}
> -
> int fsl_dcu_create_outputs(struct fsl_dcu_drm_device *fsl_dev)
> {
> struct of_endpoint ep;
> @@ -179,14 +158,14 @@ int fsl_dcu_create_outputs(struct fsl_dcu_drm_device *fsl_dev)
> return fsl_dcu_attach_panel(fsl_dev, fsl_dev->connector.panel);
> }
>
> - ep_node = of_graph_get_next_endpoint(fsl_dev->np, NULL);
> - if (!ep_node)
> - return -ENODEV;
> -
> - ret = of_graph_parse_endpoint(ep_node, &ep);
> - of_node_put(ep_node);
> + ret = drm_of_find_panel_or_bridge(fsl_dev->np, 0, 0, &panel, &bridge);

Hi Rob,
Apologies for the delay, I've been dealing with overhead the past few days. I ran across
this compile error when build testing your set.


../drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c: In function
âfsl_dcu_create_outputsâ:
../drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c:161:56: error: âpanelâ undeclared
(first use in this function)
../drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c:161:56: note: each undeclared
identifier is reported only once for each function it appears in
../drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c:161:64: error: âbridgeâ undeclared
(first use in this function)
../drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c:148:22: warning: unused variable
âep_nodeâ [-Wunused-variable]
../drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c:147:21: warning: unused variable
âepâ [-Wunused-variable]
../drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c:171:1: warning: control reaches end
of non-void function [-Wreturn-type]
make[5]: *** [drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.o] Error 1
make[4]: *** [drivers/gpu/drm/fsl-dcu] Error 2
make[4]: *** Waiting for unfinished jobs....


The defconfigs we use can be found here:
https://cgit.freedesktop.org/drm/drm-tip/tree/?h=rerere-cache

Sean


> if (ret)
> - return -ENODEV;
> + return ret;
>
> - return fsl_dcu_attach_endpoint(fsl_dev, &ep);
> + if (panel) {
> + fsl_dev->connector.panel = panel;
> + return fsl_dcu_attach_panel(fsl_dev, panel);
> + }
> +
> + return drm_bridge_attach(&fsl_dev->encoder, bridge, NULL);

<snip>

> --
> 2.10.1
>

--
Sean Paul, Software Engineer, Google / Chromium OS