diff mbox series

[28/60] drm/omap: Factor out display type to connector type conversion

Message ID 20190707181937.6250-25-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series drm/omap: Replace custom display drivers with drm_bridge and drm_panel | expand

Commit Message

Laurent Pinchart July 7, 2019, 6:19 p.m. UTC
Move the code that computes the DRM connector type for the
omapdss_device display type to a new omapdss_device_connector_type()
function for later reuse.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c       | 23 +++++++++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h    |  1 +
 drivers/gpu/drm/omapdrm/omap_connector.c | 19 +------------------
 3 files changed, 25 insertions(+), 18 deletions(-)

Comments

Tomi Valkeinen Aug. 13, 2019, 7:32 a.m. UTC | #1
On 07/07/2019 21:19, Laurent Pinchart wrote:
> Move the code that computes the DRM connector type for the
> omapdss_device display type to a new omapdss_device_connector_type()
> function for later reuse.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>   drivers/gpu/drm/omapdrm/dss/base.c       | 23 +++++++++++++++++++++++
>   drivers/gpu/drm/omapdrm/dss/omapdss.h    |  1 +
>   drivers/gpu/drm/omapdrm/omap_connector.c | 19 +------------------
>   3 files changed, 25 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index a1970b9db6ab..cae5687822e2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -285,6 +285,29 @@ void omapdss_device_post_disable(struct omap_dss_device *dssdev)
>   }
>   EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
>   
> +unsigned int omapdss_device_connector_type(enum omap_display_type type)
> +{
> +	switch (type) {
> +	case OMAP_DISPLAY_TYPE_HDMI:
> +		return DRM_MODE_CONNECTOR_HDMIA;
> +	case OMAP_DISPLAY_TYPE_DVI:
> +		return DRM_MODE_CONNECTOR_DVID;
> +	case OMAP_DISPLAY_TYPE_DSI:
> +		return DRM_MODE_CONNECTOR_DSI;
> +	case OMAP_DISPLAY_TYPE_DPI:
> +	case OMAP_DISPLAY_TYPE_DBI:
> +		return DRM_MODE_CONNECTOR_DPI;
> +	case OMAP_DISPLAY_TYPE_VENC:
> +		/* TODO: This could also be composite */
> +		return DRM_MODE_CONNECTOR_SVIDEO;
> +	case OMAP_DISPLAY_TYPE_SDI:
> +		return DRM_MODE_CONNECTOR_LVDS;
> +	default:
> +		return DRM_MODE_CONNECTOR_Unknown;
> +	}
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_connector_type);

Why do we need to export this? In the end enum omap_display_type should 
go away or be private to omapdrm, right?

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

  Tomi
Laurent Pinchart Aug. 13, 2019, 3:18 p.m. UTC | #2
Hi Tomi,

On Tue, Aug 13, 2019 at 10:32:10AM +0300, Tomi Valkeinen wrote:
> On 07/07/2019 21:19, Laurent Pinchart wrote:
> > Move the code that computes the DRM connector type for the
> > omapdss_device display type to a new omapdss_device_connector_type()
> > function for later reuse.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >   drivers/gpu/drm/omapdrm/dss/base.c       | 23 +++++++++++++++++++++++
> >   drivers/gpu/drm/omapdrm/dss/omapdss.h    |  1 +
> >   drivers/gpu/drm/omapdrm/omap_connector.c | 19 +------------------
> >   3 files changed, 25 insertions(+), 18 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> > index a1970b9db6ab..cae5687822e2 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/base.c
> > +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> > @@ -285,6 +285,29 @@ void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> >   }
> >   EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> >   
> > +unsigned int omapdss_device_connector_type(enum omap_display_type type)
> > +{
> > +	switch (type) {
> > +	case OMAP_DISPLAY_TYPE_HDMI:
> > +		return DRM_MODE_CONNECTOR_HDMIA;
> > +	case OMAP_DISPLAY_TYPE_DVI:
> > +		return DRM_MODE_CONNECTOR_DVID;
> > +	case OMAP_DISPLAY_TYPE_DSI:
> > +		return DRM_MODE_CONNECTOR_DSI;
> > +	case OMAP_DISPLAY_TYPE_DPI:
> > +	case OMAP_DISPLAY_TYPE_DBI:
> > +		return DRM_MODE_CONNECTOR_DPI;
> > +	case OMAP_DISPLAY_TYPE_VENC:
> > +		/* TODO: This could also be composite */
> > +		return DRM_MODE_CONNECTOR_SVIDEO;
> > +	case OMAP_DISPLAY_TYPE_SDI:
> > +		return DRM_MODE_CONNECTOR_LVDS;
> > +	default:
> > +		return DRM_MODE_CONNECTOR_Unknown;
> > +	}
> > +}
> > +EXPORT_SYMBOL_GPL(omapdss_device_connector_type);
> 
> Why do we need to export this? In the end enum omap_display_type should 
> go away or be private to omapdrm, right?

Eventually :-) The function is implemented in dss/base.c and used in
omap_connector.c in this patch, so it has to be exported. However, patch
"drm/omap: Simplify connector implementation" then removes the need to
export the function, so I'll remove the EXPORT_SYMBOL_GPL in that patch.

> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index a1970b9db6ab..cae5687822e2 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -285,6 +285,29 @@  void omapdss_device_post_disable(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
 
+unsigned int omapdss_device_connector_type(enum omap_display_type type)
+{
+	switch (type) {
+	case OMAP_DISPLAY_TYPE_HDMI:
+		return DRM_MODE_CONNECTOR_HDMIA;
+	case OMAP_DISPLAY_TYPE_DVI:
+		return DRM_MODE_CONNECTOR_DVID;
+	case OMAP_DISPLAY_TYPE_DSI:
+		return DRM_MODE_CONNECTOR_DSI;
+	case OMAP_DISPLAY_TYPE_DPI:
+	case OMAP_DISPLAY_TYPE_DBI:
+		return DRM_MODE_CONNECTOR_DPI;
+	case OMAP_DISPLAY_TYPE_VENC:
+		/* TODO: This could also be composite */
+		return DRM_MODE_CONNECTOR_SVIDEO;
+	case OMAP_DISPLAY_TYPE_SDI:
+		return DRM_MODE_CONNECTOR_LVDS;
+	default:
+		return DRM_MODE_CONNECTOR_Unknown;
+	}
+}
+EXPORT_SYMBOL_GPL(omapdss_device_connector_type);
+
 /* -----------------------------------------------------------------------------
  * Components Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 0c734d1f89e1..0063477b670f 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -490,6 +490,7 @@  void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
 void omapdss_device_enable(struct omap_dss_device *dssdev);
 void omapdss_device_disable(struct omap_dss_device *dssdev);
 void omapdss_device_post_disable(struct omap_dss_device *dssdev);
+unsigned int omapdss_device_connector_type(enum omap_display_type type);
 
 int omap_dss_get_num_overlay_managers(void);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index a59cca2883b1..322158ef15f6 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -306,24 +306,7 @@  static int omap_connector_get_type(struct omap_dss_device *output)
 	type = display->type;
 	omapdss_device_put(display);
 
-	switch (type) {
-	case OMAP_DISPLAY_TYPE_HDMI:
-		return DRM_MODE_CONNECTOR_HDMIA;
-	case OMAP_DISPLAY_TYPE_DVI:
-		return DRM_MODE_CONNECTOR_DVID;
-	case OMAP_DISPLAY_TYPE_DSI:
-		return DRM_MODE_CONNECTOR_DSI;
-	case OMAP_DISPLAY_TYPE_DPI:
-	case OMAP_DISPLAY_TYPE_DBI:
-		return DRM_MODE_CONNECTOR_DPI;
-	case OMAP_DISPLAY_TYPE_VENC:
-		/* TODO: This could also be composite */
-		return DRM_MODE_CONNECTOR_SVIDEO;
-	case OMAP_DISPLAY_TYPE_SDI:
-		return DRM_MODE_CONNECTOR_LVDS;
-	default:
-		return DRM_MODE_CONNECTOR_Unknown;
-	}
+	return omapdss_device_connector_type(type);
 }
 
 /* initialize connector */