drm/omap: Factor out display type to connector type conversion
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 26 Feb 2020 11:24:43 +0000 (13:24 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 26 Feb 2020 11:31:46 +0000 (13:31 +0200)
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>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-24-laurent.pinchart@ideasonboard.com
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/omap_connector.c

index a1970b9db6ab20ce8e95ccc4bb8c243b50e2a0ea..cae5687822e29286e4d8d66391eea813de7cbfbf 100644 (file)
@@ -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
  */
index 79f6b195c7cf96c73aad4d62b6eaec6eb6979570..c5672e5174c56f6c10da2987083ae86cc6058baf 100644 (file)
@@ -479,6 +479,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);
 
index 88dbf3fa473fbcb8e315a772852848e6047ffe15..38c7a79c5d4a6d4e3cc90fc38bf31944111ff6ac 100644 (file)
@@ -296,24 +296,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 */