diff mbox

[v2,2/3] drm: simple_kms_helper: make connector optional at init time

Message ID 1472040361-17884-2-git-send-email-andrea.merello@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrea Merello Aug. 24, 2016, 12:06 p.m. UTC
drm_simple_display_pipe_init() pretends to attach a connector
to the display pipe.

In case a drm bridge has to be used, then it's the bridge that
takes care of connectors.

This patch makes the connector parameter optional for
drm_simple_display_pipe_init(), so that a drm bridge could
handle connector by itself later.

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/drm_simple_kms_helper.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Daniel Vetter Aug. 25, 2016, 6:45 a.m. UTC | #1
On Wed, Aug 24, 2016 at 02:06:00PM +0200, Andrea Merello wrote:
> drm_simple_display_pipe_init() pretends to attach a connector
> to the display pipe.
> 
> In case a drm bridge has to be used, then it's the bridge that
> takes care of connectors.
> 
> This patch makes the connector parameter optional for
> drm_simple_display_pipe_init(), so that a drm bridge could
> handle connector by itself later.
> 
> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Noralf Trønnes <noralf@tronnes.org>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_simple_kms_helper.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> index aeb7a75..d07cdb8 100644
> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> @@ -146,10 +146,13 @@ static const struct drm_plane_funcs drm_simple_kms_plane_funcs = {
>   * @funcs: callbacks for the display pipe (optional)
>   * @formats: array of supported formats (%DRM_FORMAT_*)
>   * @format_count: number of elements in @formats
> - * @connector: connector to attach and register
> + * @connector: connector to attach and register (optional)
>   *
>   * Sets up a display pipeline which consist of a really simple
> - * plane-crtc-encoder pipe coupled with the provided connector.
> + * plane-crtc-encoder pipe.

Nit: Empty comment line if you want to start a new paragraph. Otherwise
pls reflow the comment to make it use the full width.

With that Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

I guess I'll let Archit apply the entire series once it's all ready.
-Daniel

> + * If a connector is supplied, the pipe will be coupled with the provided
> + * connector. You may supply a NULL connector when using drm bridges, that
> + * handle connectors themselves (see drm_simple_display_pipe_bridge_attach()).
>   * Teardown of a simple display pipe is all handled automatically by the drm
>   * core through calling drm_mode_config_cleanup(). Drivers afterwards need to
>   * release the memory for the structure themselves.
> @@ -188,7 +191,7 @@ int drm_simple_display_pipe_init(struct drm_device *dev,
>  	encoder->possible_crtcs = 1 << drm_crtc_index(crtc);
>  	ret = drm_encoder_init(dev, encoder, &drm_simple_kms_encoder_funcs,
>  			       DRM_MODE_ENCODER_NONE, NULL);
> -	if (ret)
> +	if (ret || !connector)
>  		return ret;
>  
>  	return drm_mode_connector_attach_encoder(connector, encoder);
> -- 
> 2.7.4
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index aeb7a75..d07cdb8 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -146,10 +146,13 @@  static const struct drm_plane_funcs drm_simple_kms_plane_funcs = {
  * @funcs: callbacks for the display pipe (optional)
  * @formats: array of supported formats (%DRM_FORMAT_*)
  * @format_count: number of elements in @formats
- * @connector: connector to attach and register
+ * @connector: connector to attach and register (optional)
  *
  * Sets up a display pipeline which consist of a really simple
- * plane-crtc-encoder pipe coupled with the provided connector.
+ * plane-crtc-encoder pipe.
+ * If a connector is supplied, the pipe will be coupled with the provided
+ * connector. You may supply a NULL connector when using drm bridges, that
+ * handle connectors themselves (see drm_simple_display_pipe_bridge_attach()).
  * Teardown of a simple display pipe is all handled automatically by the drm
  * core through calling drm_mode_config_cleanup(). Drivers afterwards need to
  * release the memory for the structure themselves.
@@ -188,7 +191,7 @@  int drm_simple_display_pipe_init(struct drm_device *dev,
 	encoder->possible_crtcs = 1 << drm_crtc_index(crtc);
 	ret = drm_encoder_init(dev, encoder, &drm_simple_kms_encoder_funcs,
 			       DRM_MODE_ENCODER_NONE, NULL);
-	if (ret)
+	if (ret || !connector)
 		return ret;
 
 	return drm_mode_connector_attach_encoder(connector, encoder);