diff mbox series

drm: rcar-du: fix probe error when DRM_RCAR_DW_HDMI disabled

Message ID 1537530543-29518-2-git-send-email-na-hoan@jinso.co.jp (mailing list archive)
State Not Applicable
Delegated to: Geert Uytterhoeven
Headers show
Series drm: rcar-du: fix probe error when DRM_RCAR_DW_HDMI disabled | expand

Commit Message

グェン・アン・ホァン Sept. 21, 2018, 11:49 a.m. UTC
From: Hoan Nguyen An <na-hoan@jinso.co.jp>

Skip return EPROBE_DEFER when DRM_RCAR_DW_HDMI is disabled in case HDMI initialize.
At this time, the rcar-du driver not be able to successfully initialize
if disable DRM_RCAR_DW_HDMI (rcar_du_probe return error),
so can not use other features such as RGB Analog, this patch to fix.

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Mark Brown Sept. 21, 2018, 5:21 p.m. UTC | #1
On Fri, Sep 21, 2018 at 08:49:03PM +0900, Nguyen An Hoan wrote:

> @@ -66,8 +66,15 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>  	/* Locate the DRM bridge from the encoder DT node. */
>  	bridge = of_drm_find_bridge(enc_node);
>  	if (!bridge) {
> +#if IS_ENABLED(CONFIG_DRM_RCAR_DW_HDMI)
>  		ret = -EPROBE_DEFER;
>  		goto done;
> +#else
> +		if (output == RCAR_DU_OUTPUT_HDMI0 || 
> +		    output == RCAR_DU_OUTPUT_HDMI1)
> +		    ret = 0;
> +		    goto done;
> +#endif
>  	}

This seems to make sense to me assuming there's no other encoder that
could possibly connected though I'm not 100% up to speed on the DRM
subsystem so it's possible I'm missing some framework feature that
should help here.  I'm not a DRM expert though.
Laurent Pinchart Nov. 22, 2018, 11:23 p.m. UTC | #2
Hello Hoan,

Thank you for the patch.

On Friday, 21 September 2018 14:49:03 EET Nguyen An Hoan wrote:
> From: Hoan Nguyen An <na-hoan@jinso.co.jp>
> 
> Skip return EPROBE_DEFER when DRM_RCAR_DW_HDMI is disabled in case HDMI
> initialize. At this time, the rcar-du driver not be able to successfully
> initialize if disable DRM_RCAR_DW_HDMI (rcar_du_probe return error),
> so can not use other features such as RGB Analog, this patch to fix.
> 
> Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index f9c933d..4dbc508 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> @@ -66,8 +66,15 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>  	/* Locate the DRM bridge from the encoder DT node. */
>  	bridge = of_drm_find_bridge(enc_node);
>  	if (!bridge) {
> +#if IS_ENABLED(CONFIG_DRM_RCAR_DW_HDMI)
>  		ret = -EPROBE_DEFER;
>  		goto done;
> +#else
> +		if (output == RCAR_DU_OUTPUT_HDMI0 ||
> +		    output == RCAR_DU_OUTPUT_HDMI1)
> +		    ret = 0;
> +		    goto done;
> +#endif

The dw-hdmi driver could be compiled out of tree, I don't think is the right 
fix. If the HDMI output should be disabled on a particular system, the 
corresponding DT node should be marked as disable, and no change to the DU 
driver is needed. Otherwise the necessary drivers should be present.

In the long term we should implement support for registration of additional 
encoders at runtime, but that's way down the road.

>  	}
> 
>  	ret = drm_encoder_init(rcdu->ddev, encoder, &encoder_funcs,
diff mbox series

Patch

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index f9c933d..4dbc508 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -66,8 +66,15 @@  int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 	/* Locate the DRM bridge from the encoder DT node. */
 	bridge = of_drm_find_bridge(enc_node);
 	if (!bridge) {
+#if IS_ENABLED(CONFIG_DRM_RCAR_DW_HDMI)
 		ret = -EPROBE_DEFER;
 		goto done;
+#else
+		if (output == RCAR_DU_OUTPUT_HDMI0 || 
+		    output == RCAR_DU_OUTPUT_HDMI1)
+		    ret = 0;
+		    goto done;
+#endif
 	}
 
 	ret = drm_encoder_init(rcdu->ddev, encoder, &encoder_funcs,