From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751414AbdBFLIH (ORCPT ); Mon, 6 Feb 2017 06:08:07 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:37017 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750956AbdBFLIG (ORCPT ); Mon, 6 Feb 2017 06:08:06 -0500 Message-ID: <1486379272.3005.50.camel@pengutronix.de> Subject: Re: [PATCH 4/5] drm: convert drivers to use drm_of_find_panel_or_bridge From: Philipp Zabel To: Rob Herring Cc: David Airlie , Daniel Vetter , Sean Paul , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Frank Rowand , Boris Brezillon , Archit Taneja , Jingoo Han , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Kukjin Kim , Krzysztof Kozlowski , Javier Martinez Canillas , Stefan Agner , Alison Wang , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , CK Hu , Matthias Brugger , Marek Vasut , Mark Yao , Heiko Stuebner , Maxime Ripard , Chen-Yu Tsai , Liviu Dudau , Mali DP Maintainers , Neil Armstrong , Carlo Caione , Kevin Hilman , Rob Clark , Jyri Sarha , Tomi Valkeinen , Eric Anholt , Russell King Date: Mon, 06 Feb 2017 12:07:52 +0100 In-Reply-To: <20170204033635.10250-5-robh@kernel.org> References: <20170204033635.10250-1-robh@kernel.org> <20170204033635.10250-5-robh@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-02-03 at 21:36 -0600, 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 > --- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 64 ++++------------- > 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 | 49 ++++--------- > drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 5 +- > drivers/gpu/drm/imx/imx-ldb.c | 28 ++------ > drivers/gpu/drm/imx/parallel-display.c | 35 ++------- > drivers/gpu/drm/mediatek/mtk_dsi.c | 23 ++---- > drivers/gpu/drm/mxsfb/mxsfb_out.c | 36 ++-------- > drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 26 ++----- > drivers/gpu/drm/sun4i/sun4i_rgb.c | 17 ++--- > drivers/gpu/drm/sun4i/sun4i_tcon.c | 90 ++---------------------- > 14 files changed, 88 insertions(+), 379 deletions(-) > [...] > diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c > index 516d06490465..e670993906b8 100644 > --- a/drivers/gpu/drm/imx/imx-ldb.c > +++ b/drivers/gpu/drm/imx/imx-ldb.c > @@ -649,7 +649,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) > > for_each_child_of_node(np, child) { > struct imx_ldb_channel *channel; > - struct device_node *ep; > + struct device_node *remote; > int bus_format; > > ret = of_property_read_u32(child, "reg", &i); > @@ -673,27 +673,11 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) > * The output port is port@4 with an external 4-port mux or > * port@2 with the internal 2-port mux. > */ > - ep = of_graph_get_endpoint_by_regs(child, > - imx_ldb->lvds_mux ? 4 : 2, > - -1); > - if (ep) { > - struct device_node *remote; > - > - remote = of_graph_get_remote_port_parent(ep); > - of_node_put(ep); > - if (remote) { > - channel->panel = of_drm_find_panel(remote); > - channel->bridge = of_drm_find_bridge(remote); > - } else > - return -EPROBE_DEFER; > - of_node_put(remote); > - > - if (!channel->panel && !channel->bridge) { > - dev_err(dev, "panel/bridge not found: %s\n", > - remote->full_name); > - return -EPROBE_DEFER; > - } > - } > + ret = drm_of_find_panel_or_bridge(fsl_dev->np, s/fsl_dev->np/child/ > + imx_ldb->lvds_mux ? 4 : 2, 0, Same comment as for the mediatek changes, this now requires that the endpoints have no reg property set or reg = <0>. This is fine for LVDS links, and I am not aware of any device trees that set the reg propertiy in their LVDS output endpoints, so that should be fine. > + &channel->panel, &channel->bridge); > + if (ret) > + return ret; > > /* panel ddc only if there is no bridge */ > if (!channel->bridge) { > diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c > index 8582a83c0d9b..eb3a0201853a 100644 > --- a/drivers/gpu/drm/imx/parallel-display.c > +++ b/drivers/gpu/drm/imx/parallel-display.c > @@ -210,7 +210,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) > { > struct drm_device *drm = data; > struct device_node *np = dev->of_node; > - struct device_node *ep; > + struct device_node *remote; > const u8 *edidp; > struct imx_parallel_display *imxpd; > int ret; > @@ -239,36 +239,9 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) > imxpd->bus_format = bus_format; > > /* port@1 is the output port */ > - ep = of_graph_get_endpoint_by_regs(np, 1, -1); > - if (ep) { > - struct device_node *remote; > - > - remote = of_graph_get_remote_port_parent(ep); > - if (!remote) { > - dev_warn(dev, "endpoint %s not connected\n", > - ep->full_name); > - of_node_put(ep); > - return -ENODEV; > - } > - of_node_put(ep); > - > - imxpd->panel = of_drm_find_panel(remote); > - if (imxpd->panel) { > - dev_dbg(dev, "found panel %s\n", remote->full_name); > - } else { > - imxpd->bridge = of_drm_find_bridge(remote); > - if (imxpd->bridge) > - dev_dbg(dev, "found bridge %s\n", > - remote->full_name); > - } > - if (!imxpd->panel && !imxpd->bridge) { > - dev_dbg(dev, "waiting for panel or bridge %s\n", > - remote->full_name); > - of_node_put(remote); > - return -EPROBE_DEFER; > - } > - of_node_put(remote); > - } > + ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, &imxpd->bridge); > + if (ret) > + return ret; > > imxpd->dev = dev; The parallel-display change looks good to me. > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > index 2c42f90809d8..14140579f8d4 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -16,11 +16,11 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > -#include > #include > #include > #include