diff mbox

[v3,2/2] drm/fsl-dcu: add support for drm bridge

Message ID 1468493684-19501-2-git-send-email-meng.yi@nxp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Meng Yi July 14, 2016, 10:54 a.m. UTC
The current output code only supports connection to drm panels.
Add code to support drm bridge, to support connections to
external connectors.

Signed-off-by: Meng Yi <meng.yi@nxp.com>
---
Changes since V1:
-no change
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Stefan Agner July 15, 2016, 4:29 a.m. UTC | #1
On 2016-07-14 03:54, Meng Yi wrote:
> The current output code only supports connection to drm panels.
> Add code to support drm bridge, to support connections to
> external connectors.
> 
> Signed-off-by: Meng Yi <meng.yi@nxp.com>
> ---
> Changes since V1:
> -no change
> ---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> 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 2e71f4b..e875b4e 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> @@ -189,6 +189,7 @@ err_cleanup:
>  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;
>  	int ret;
>  
> @@ -201,7 +202,17 @@ static int fsl_dcu_attach_endpoint(struct
> fsl_dcu_drm_device *fsl_dev,
>  		return ret;
>  	}
>  
> -	return -ENODEV;
> +	bridge = of_drm_find_bridge(np);

Since you need np here again, you need to move the of_node_put above
back into the if statement...


> +	of_node_put(np);
> +	if (!bridge)
> +		return -ENODEV;
> +
> +	fsl_dev->encoder.bridge = bridge;
> +	bridge->encoder = &fsl_dev->encoder;
> +
> +	ret = drm_bridge_attach(fsl_dev->drm, bridge);
> +
> +	return ret;

Also simplify this return statement.

--
Stefan

>  }
>  
>  int fsl_dcu_create_outputs(struct fsl_dcu_drm_device *fsl_dev)
diff mbox

Patch

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 2e71f4b..e875b4e 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
@@ -189,6 +189,7 @@  err_cleanup:
 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;
 	int ret;
 
@@ -201,7 +202,17 @@  static int fsl_dcu_attach_endpoint(struct fsl_dcu_drm_device *fsl_dev,
 		return ret;
 	}
 
-	return -ENODEV;
+	bridge = of_drm_find_bridge(np);
+	of_node_put(np);
+	if (!bridge)
+		return -ENODEV;
+
+	fsl_dev->encoder.bridge = bridge;
+	bridge->encoder = &fsl_dev->encoder;
+
+	ret = drm_bridge_attach(fsl_dev->drm, bridge);
+
+	return ret;
 }
 
 int fsl_dcu_create_outputs(struct fsl_dcu_drm_device *fsl_dev)