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

From: Rob Herring
Date: Sun Feb 05 2017 - 17:26:15 EST


On Sat, Feb 4, 2017 at 2:26 PM, Fabio Estevam <festevam@xxxxxxxxx> wrote:
> Hi Rob,
>
> On Sat, Feb 4, 2017 at 1:36 AM, Rob Herring <robh@xxxxxxxxxx> wrote:
>
>> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_out.c b/drivers/gpu/drm/mxsfb/mxsfb_out.c
>> index fa8d17399407..f7d729aa09bd 100644
>> --- a/drivers/gpu/drm/mxsfb/mxsfb_out.c
>> +++ b/drivers/gpu/drm/mxsfb/mxsfb_out.c
>> @@ -19,6 +19,7 @@
>> #include <drm/drm_crtc_helper.h>
>> #include <drm/drm_fb_cma_helper.h>
>> #include <drm/drm_gem_cma_helper.h>
>> +#include <drm/drm_of.h>
>> #include <drm/drm_panel.h>
>> #include <drm/drm_plane_helper.h>
>> #include <drm/drm_simple_kms_helper.h>
>> @@ -82,20 +83,15 @@ static const struct drm_connector_funcs mxsfb_panel_connector_funcs = {
>> .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>> };
>>
>> -static int mxsfb_attach_endpoint(struct drm_device *drm,
>> - const struct of_endpoint *ep)
>> +int mxsfb_create_output(struct drm_device *drm)
>> {
>> struct mxsfb_drm_private *mxsfb = drm->dev_private;
>> - struct device_node *np;
>> struct drm_panel *panel;
>> - int ret = -EPROBE_DEFER;
>> -
>> - np = of_graph_get_remote_port_parent(ep->local_node);
>> - panel = of_drm_find_panel(np);
>> - of_node_put(np);
>> + int ret;
>>
>> - if (!panel)
>> - return -EPROBE_DEFER;
>> + ret = drm_of_find_panel_or_bridge(drm->dev->of_node, 0, 0, &panel, NULL);
>> + if (ret)
>> + return ret;
>
> I fixed some build issues of this series and I am trying to use it
> with the mxsfb drm driver.
>
> I would like to add bridge support for this driver, so that I can use
> the TDA19988 HDMI bridge on a imx6sx-udoo-neo-full board.
>
> My dts looks like this:
>
> --- a/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi
> +++ b/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi
> @@ -185,6 +185,41 @@
> };
> };
>
> +&i2c3 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_i2c3>;
> + clock-frequency = <100000>;
> + status = "okay";
> +
> + hdmi-transmitter@70 {
> + compatible = "nxp,tda998x";
> + reg = <0x70>;
> + pinctrl-0 = <&pinctrl_hdmi>;
> + pinctrl-names = "default";
> + interrupt-parent = <&gpio3>;
> + interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
> + clocks = <&clks IMX6SX_CLK_CKO2>;
> +
> + port {
> + tda998x_input: endpoint {
> + remote-endpoint = <&lcdif1_output>;
> + };
> + };
> + };
> +};
> +
> +&lcdif1 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_lcd>;
> + status = "okay";
> +
> + port {
> + lcdif1_output: endpoint {
> + remote-endpoint = <&tda998x_input>;
> + };
> + };
> +};
>
> and I changed it to:
>
> ret = drm_of_find_panel_or_bridge(drm->dev->of_node, 0, 0, &panel, &bridge);
>
> ,but drm_of_find_panel_or_bridge() always returns -EPROBE_DEFER.
>
> Shouldn't it be able to find the bridge chip in this case? Any ideas
> of what it is missing?

Did the bridge driver probe? This function just checks lists of
registered panels and bridges.

Rob