ARM: OMAP2+: Don't register omapdss device for omapdrm
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 11 Aug 2017 13:49:11 +0000 (16:49 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 16 Aug 2017 12:38:51 +0000 (15:38 +0300)
The omapdrm driver doesn't need the omapdss device anymore. Although it
can't be removed completely as the fbdev driver still requires it, we
can condition its registration to the usage of the omapfb driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
arch/arm/mach-omap2/display.c

index 5f5697668de8f24daafeab2ef108eef02b3d7a5f..798fc718fffebf4b09e9f1aa82aa8a4b85436839 100644 (file)
@@ -66,6 +66,7 @@
  */
 #define FRAMEDONE_IRQ_TIMEOUT          100
 
+#if defined(CONFIG_FB_OMAP2)
 static struct platform_device omap_display_device = {
        .name          = "omapdss",
        .id            = -1,
@@ -163,6 +164,64 @@ static enum omapdss_version __init omap_display_get_version(void)
                return OMAPDSS_VER_UNKNOWN;
 }
 
+static int __init omapdss_init_fbdev(void)
+{
+       static struct omap_dss_board_info board_data = {
+               .dsi_enable_pads = omap_dsi_enable_pads,
+               .dsi_disable_pads = omap_dsi_disable_pads,
+               .set_min_bus_tput = omap_dss_set_min_bus_tput,
+       };
+       struct device_node *node;
+
+       board_data.version = omap_display_get_version();
+       if (board_data.version == OMAPDSS_VER_UNKNOWN) {
+               pr_err("DSS not supported on this SoC\n");
+               return -ENODEV;
+       }
+
+       omap_display_device.dev.platform_data = &board_data;
+
+       r = platform_device_register(&omap_display_device);
+       if (r < 0) {
+               pr_err("Unable to register omapdss device\n");
+               return r;
+       }
+
+       /* create vrfb device */
+       r = omap_init_vrfb();
+       if (r < 0) {
+               pr_err("Unable to register omapvrfb device\n");
+               return r;
+       }
+
+       /* create FB device */
+       r = omap_init_fb();
+       if (r < 0) {
+               pr_err("Unable to register omapfb device\n");
+               return r;
+       }
+
+       /* create V4L2 display device */
+       r = omap_init_vout();
+       if (r < 0) {
+               pr_err("Unable to register omap_vout device\n");
+               return r;
+       }
+
+       /* add DSI info for omap4 */
+       node = of_find_node_by_name(NULL, "omap4_padconf_global");
+       if (node)
+               omap4_dsi_mux_syscon = syscon_node_to_regmap(node);
+
+       return 0;
+}
+#else
+static inline int omapdss_init_fbdev(void)
+{
+       return 0;
+}
+#endif /* CONFIG_FB_OMAP2 */
+
 static void dispc_disable_outputs(void)
 {
        u32 v, irq_mask = 0;
@@ -335,16 +394,9 @@ static struct device_node * __init omapdss_find_dss_of_node(void)
 int __init omapdss_init_of(void)
 {
        int r;
-       enum omapdss_version ver;
        struct device_node *node;
        struct platform_device *pdev;
 
-       static struct omap_dss_board_info board_data = {
-               .dsi_enable_pads = omap_dsi_enable_pads,
-               .dsi_disable_pads = omap_dsi_disable_pads,
-               .set_min_bus_tput = omap_dss_set_min_bus_tput,
-       };
-
        /* only create dss helper devices if dss is enabled in the .dts */
 
        node = omapdss_find_dss_of_node();
@@ -354,13 +406,6 @@ int __init omapdss_init_of(void)
        if (!of_device_is_available(node))
                return 0;
 
-       ver = omap_display_get_version();
-
-       if (ver == OMAPDSS_VER_UNKNOWN) {
-               pr_err("DSS not supported on this SoC\n");
-               return -ENODEV;
-       }
-
        pdev = of_find_device_by_node(node);
 
        if (!pdev) {
@@ -374,41 +419,5 @@ int __init omapdss_init_of(void)
                return r;
        }
 
-       board_data.version = ver;
-
-       omap_display_device.dev.platform_data = &board_data;
-
-       r = platform_device_register(&omap_display_device);
-       if (r < 0) {
-               pr_err("Unable to register omapdss device\n");
-               return r;
-       }
-
-       /* create vrfb device */
-       r = omap_init_vrfb();
-       if (r < 0) {
-               pr_err("Unable to register omapvrfb device\n");
-               return r;
-       }
-
-       /* create FB device */
-       r = omap_init_fb();
-       if (r < 0) {
-               pr_err("Unable to register omapfb device\n");
-               return r;
-       }
-
-       /* create V4L2 display device */
-       r = omap_init_vout();
-       if (r < 0) {
-               pr_err("Unable to register omap_vout device\n");
-               return r;
-       }
-
-       /* add DSI info for omap4 */
-       node = of_find_node_by_name(NULL, "omap4_padconf_global");
-       if (node)
-               omap4_dsi_mux_syscon = syscon_node_to_regmap(node);
-
-       return 0;
+       return omapdss_init_fbdev();
 }