Skip to contentSkip to conversation

arm: omap: display: Ensure DRM/FB/V4L devices are created if DSS is available

PATCH In review Archit Taneja 3 participants 7 messages Sep 16, 2013 – Oct 8, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover arm: omap: display: Ensure DRM/FB/V4L devices are created if DSS is available

Currently, omapdrm, omapfb and omap_vout platform devices are created and registered through omap_arch_initcalls. In a multiplatform config. It's possible that all the corresponding configs for the above drivers along with omapdss config are selected even if the hardware doesn't have a DSS IP.

If the image is booted on a AM33xx platform, the above drm, fb and v4l devices would be registered throuth the omap_arch_initcalls even if omapdss itself isn't registered. These platform devices don't cause any harm, but are unnecessary.

Move the registration of these devices into omap_display_init(), which registers omapdss devices and is called only if the platform has DSS hardware.

Also, the first patch prevents creation of a DMM device when omapdrm device is registered. With the removal of address and irq data from the omap4 hwmods, the probe of DMM driver fails and omapdrm isn't able to utilize the DMM hardware. This will be fixed when DMM DT nodes are added for omap4, omap5 and dra7x.

Changes in v2:
- Move device creation for omapfb and omap_vout to omap_display_init too.
- Keep the DMM DT conversion as a separate patch series since this series does something different now.

Archit Taneja (4):
arm: omap: drm: Don't build device for DMM
arm: omap: display: Create omapdrm device inside omap_display_init
arm: omap: display: Create omapvrfb and omapfb devices inside
omap_display_init
arm: omap: display: Create omap_vout device inside omap_display_init

 arch/arm/mach-omap2/Makefile  |  6 +-----
 arch/arm/mach-omap2/devices.c | 10 +++++-----
 arch/arm/mach-omap2/display.c | 28 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/display.h |  4 ++++
 arch/arm/mach-omap2/drm.c     | 24 +++++-------------------
 arch/arm/mach-omap2/fb.c      | 14 +++++++-------
 6 files changed, 50 insertions(+), 36 deletions(-)
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH v2 1/4 arm: omap: drm: Don't build device for DMM

DMM exists on omap4+ platforms, these platforms are always expected to boot with DT. Remove the current method of searching the dmm hwmod and building an omap_device for dmm.

For OMAP4, the address and irq data for DMM hwmod(along with other blocks) were removed, so the current method fails in the dmm driver's probe anyway.

The addition of DMM nodes in DT will ensure that a DMM device is built correctly.

---
 arch/arm/mach-omap2/drm.c | 14 --------------
 1 file changed, 14 deletions(-)
arch/arm/mach-omap2/drm.c +0 -14
index 59a4af7..e6c38cd 100644
@@ -26,8 +26,6 @@
 #include <linux/platform_data/omap_drm.h>
 
 #include "soc.h"
-#include "omap_device.h"
-#include "omap_hwmod.h"
 
 #if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
 
@@ -44,18 +42,6 @@ static struct platform_device omap_drm_device = {
 
 static int __init omap_init_drm(void)
 {
-	struct omap_hwmod *oh = NULL;
-	struct platform_device *pdev;
-
-	/* lookup and populate the DMM information, if present - OMAP4+ */
-	oh = omap_hwmod_lookup("dmm");
-
-	if (oh) {
-		pdev = omap_device_build(oh->name, -1, oh, NULL, 0);
-		WARN(IS_ERR(pdev), "Could not build omap_device for %s\n",
-			oh->name);
-	}
-
 	platform_data.omaprev = GET_OMAP_TYPE;
 
 	return platform_device_register(&omap_drm_device);
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH v2 2/4 arm: omap: display: Create omapdrm device inside omap_display_init

In reply to Archit Taneja

Move omapdrm device creation inside the omap_display_init so that we can correctly create the device based on the presence of omapdss within the platform.

For example, on a kernel image supporting multiple platforms, omap_init_drm will create a omapdrm platform device on a AM33xx platform even though it doesn't have a DSS block.

Originally worked on by Andy Gross.

---
 arch/arm/mach-omap2/Makefile  |  6 +-----
 arch/arm/mach-omap2/display.c |  7 +++++++
 arch/arm/mach-omap2/display.h |  1 +
 arch/arm/mach-omap2/drm.c     | 10 +++++-----
 4 files changed, 14 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/Makefile +1 -5
index ff2c162..cc84b25 100644
@@ -8,7 +8,7 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
 # Common support
 obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \
 	 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
-	 omap_device.o sram.o
+	 omap_device.o sram.o drm.o
 
 omap-2-3-common				= irq.o
 hwmod-common				= omap_hwmod.o omap_hwmod_reset.o \
@@ -229,10 +229,6 @@ endif
 # OMAP2420 MSDI controller integration support ("MMC")
 obj-$(CONFIG_SOC_OMAP2420)		+= msdi.o
 
-ifneq ($(CONFIG_DRM_OMAP),)
-obj-y					+= drm.o
-endif
-
 # Specific board support
 obj-$(CONFIG_MACH_OMAP_GENERIC)		+= board-generic.o
 obj-$(CONFIG_MACH_OMAP_H4)		+= board-h4.o
arch/arm/mach-omap2/display.c +7 -0
index 03a0516..8d8ee474 100644
@@ -416,6 +416,13 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
 		}
 	}
 
+	/* create DRM device */
+	r = omap_init_drm();
+	if (r < 0) {
+		pr_err("Unable to register omapdrm device\n");
+		return r;
+	}
+
 	return 0;
 }
 
arch/arm/mach-omap2/display.h +1 -0
index b871b017..e4e8d39 100644
@@ -26,4 +26,5 @@ struct omap_dss_dispc_dev_attr {
 	bool	has_framedonetv_irq;
 };
 
+int omap_init_drm(void);
 #endif
arch/arm/mach-omap2/drm.c +5 -5
index e6c38cd..facd740 100644
@@ -26,8 +26,9 @@
 #include <linux/platform_data/omap_drm.h>
 
 #include "soc.h"
+#include "display.h"
 
-#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
+#if defined(CONFIG_DRM_OMAP) || defined(CONFIG_DRM_OMAP_MODULE)
 
 static struct omap_drm_platform_data platform_data;
 
@@ -40,14 +41,13 @@ static struct platform_device omap_drm_device = {
 	.id = 0,
 };
 
-static int __init omap_init_drm(void)
+int __init omap_init_drm(void)
 {
 	platform_data.omaprev = GET_OMAP_TYPE;
 
 	return platform_device_register(&omap_drm_device);
 
 }
-
-omap_arch_initcall(omap_init_drm);
-
+#else
+int __init omap_init_drm(void) { return 0; }
 #endif
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH v2 3/4 arm: omap: display: Create omapvrfb and omapfb devices inside omap_display_init

In reply to Archit Taneja

Move omapfb and omapvrfb device creation inside the omap_display_init so that we can correctly create the device based on the presence of omapdss within the platform.

For example, on a kernel image supporting multiple platforms, omap_init_vrfb and omap_init_fb will create omapvrfb and omapfb platform devices respectively on a AM33xx platform even though it doesn't have a VRFB or DSS block.

---
 arch/arm/mach-omap2/display.c | 14 ++++++++++++++
 arch/arm/mach-omap2/display.h |  2 ++
 arch/arm/mach-omap2/fb.c      | 14 +++++++-------
 3 files changed, 23 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/display.c +14 -0
index 8d8ee474..fb66e5a 100644
@@ -423,6 +423,20 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
 		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;
+	}
+
 	return 0;
 }
 
arch/arm/mach-omap2/display.h +2 -0
index e4e8d39..bc7af40 100644
@@ -27,4 +27,6 @@ struct omap_dss_dispc_dev_attr {
 };
 
 int omap_init_drm(void);
+int omap_init_vrfb(void);
+int omap_init_fb(void);
 #endif
arch/arm/mach-omap2/fb.c +7 -7
index 2ca33cc..26e28e9 100644
@@ -32,6 +32,7 @@
 #include <asm/mach/map.h>
 
 #include "soc.h"
+#include "display.h"
 
 #ifdef CONFIG_OMAP2_VRFB
 
@@ -64,7 +65,7 @@ static const struct resource omap3_vrfb_resources[] = {
 	DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"),
 };
 
-static int __init omap_init_vrfb(void)
+int __init omap_init_vrfb(void)
 {
 	struct platform_device *pdev;
 	const struct resource *res;
@@ -85,8 +86,8 @@ static int __init omap_init_vrfb(void)
 
 	return PTR_RET(pdev);
 }
-
-omap_arch_initcall(omap_init_vrfb);
+#else
+int __init omap_init_vrfb(void) { return 0; }
 #endif
 
 #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
@@ -105,11 +106,10 @@ static struct platform_device omap_fb_device = {
 	.num_resources = 0,
 };
 
-static int __init omap_init_fb(void)
+int __init omap_init_fb(void)
 {
 	return platform_device_register(&omap_fb_device);
 }
-
-omap_arch_initcall(omap_init_fb);
-
+#else
+int __init omap_init_fb(void) { return 0; }
 #endif
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH v2 4/4 arm: omap: display: Create omap_vout device inside omap_display_init

In reply to Archit Taneja

Move omap_vout device creation inside the omap_display_init so that we can correctly create the device based on the presence of omapdss within the platform.

For example, on a kernel image supporting multiple platforms, omap_init_vout will create a omapdrm platform device on a AM33xx platform even though it doesn't have a DSS block.

---
 arch/arm/mach-omap2/devices.c | 10 +++++-----
 arch/arm/mach-omap2/display.c |  7 +++++++
 arch/arm/mach-omap2/display.h |  1 +
 3 files changed, 13 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/devices.c +5 -5
index 3c1279f..520a4be 100644
@@ -37,6 +37,7 @@
 #include "mux.h"
 #include "control.h"
 #include "devices.h"
+#include "display.h"
 
 #define L3_MODULES_MAX_LEN 12
 #define L3_MODULES 3
@@ -504,13 +505,13 @@ static struct platform_device omap_vout_device = {
 	.resource 	= &omap_vout_resource[0],
 	.id		= -1,
 };
-static void omap_init_vout(void)
+
+int __init omap_init_vout(void)
 {
-	if (platform_device_register(&omap_vout_device) < 0)
-		printk(KERN_ERR "Unable to register OMAP-VOUT device\n");
+	return platform_device_register(&omap_vout_device);
 }
 #else
-static inline void omap_init_vout(void) {}
+int __init omap_init_vout(void) { return 0; }
 #endif
 
 #if IS_ENABLED(CONFIG_WL12XX)
@@ -576,7 +577,6 @@ static int __init omap2_init_devices(void)
 	}
 	omap_init_sti();
 	omap_init_rng();
-	omap_init_vout();
 
 	return 0;
 }
arch/arm/mach-omap2/display.c +7 -0
index fb66e5a..a4e536b 100644
@@ -437,6 +437,13 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
 		return r;
 	}
 
+	/* create V4L2 display device */
+	r = omap_init_vout();
+	if (r < 0) {
+		pr_err("Unable to register omap_vout device\n");
+		return r;
+	}
+
 	return 0;
 }
 
arch/arm/mach-omap2/display.h +1 -0
index bc7af40..f3d2ce4 100644
@@ -29,4 +29,5 @@ struct omap_dss_dispc_dev_attr {
 int omap_init_drm(void);
 int omap_init_vrfb(void);
 int omap_init_fb(void);
+int omap_init_vout(void);
 #endif
Signature · 1 line
1.8.1.2
Acked-by on the v2 series
#5 lore raw
In reply to Archit Taneja
Quoted 29 lines · Archit Taneja

Currently, omapdrm, omapfb and omap_vout platform devices are created and registered through omap_arch_initcalls. In a multiplatform config. It's possible that all the corresponding configs for the above drivers along with omapdss config are selected even if the hardware doesn't have a DSS IP.

If the image is booted on a AM33xx platform, the above drm, fb and v4l devices would be registered throuth the omap_arch_initcalls even if omapdss itself isn't registered. These platform devices don't cause any harm, but are unnecessary.

Move the registration of these devices into omap_display_init(), which registers omapdss devices and is called only if the platform has DSS hardware.

Also, the first patch prevents creation of a DMM device when omapdrm device is registered. With the removal of address and irq data from the omap4 hwmods, the probe of DMM driver fails and omapdrm isn't able to utilize the DMM hardware. This will be fixed when DMM DT nodes are added for omap4, omap5 and dra7x.

Changes in v2:
- Move device creation for omapfb and omap_vout to omap_display_init too.
- Keep the DMM DT conversion as a separate patch series since this series does something different now.

Archit Taneja (4):
arm: omap: drm: Don't build device for DMM
arm: omap: display: Create omapdrm device inside omap_display_init
arm: omap: display: Create omapvrfb and omapfb devices inside
omap_display_init
arm: omap: display: Create omap_vout device inside omap_display_init

Quoted 7 lines
 arch/arm/mach-omap2/Makefile  |  6 +-----
 arch/arm/mach-omap2/devices.c | 10 +++++-----
 arch/arm/mach-omap2/display.c | 28 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/display.h |  4 ++++
 arch/arm/mach-omap2/drm.c     | 24 +++++-------------------
 arch/arm/mach-omap2/fb.c      | 14 +++++++-------
 6 files changed, 50 insertions(+), 36 deletions(-)

Tony, since there are no driver changes here, and it's unlikely that we'd have a conflict between the dss driver changes and these changes, I think it's best if this goes through linux-omap.

Tomi

maintainer
#6 lore raw
Quoted 38 lines · Tomi Valkeinen
Quoted 29 lines · Archit Taneja

Currently, omapdrm, omapfb and omap_vout platform devices are created and registered through omap_arch_initcalls. In a multiplatform config. It's possible that all the corresponding configs for the above drivers along with omapdss config are selected even if the hardware doesn't have a DSS IP.

If the image is booted on a AM33xx platform, the above drm, fb and v4l devices would be registered throuth the omap_arch_initcalls even if omapdss itself isn't registered. These platform devices don't cause any harm, but are unnecessary.

Move the registration of these devices into omap_display_init(), which registers omapdss devices and is called only if the platform has DSS hardware.

Also, the first patch prevents creation of a DMM device when omapdrm device is registered. With the removal of address and irq data from the omap4 hwmods, the probe of DMM driver fails and omapdrm isn't able to utilize the DMM hardware. This will be fixed when DMM DT nodes are added for omap4, omap5 and dra7x.

Changes in v2:
- Move device creation for omapfb and omap_vout to omap_display_init too.
- Keep the DMM DT conversion as a separate patch series since this series does something different now.

Archit Taneja (4):
arm: omap: drm: Don't build device for DMM
arm: omap: display: Create omapdrm device inside omap_display_init
arm: omap: display: Create omapvrfb and omapfb devices inside
omap_display_init
arm: omap: display: Create omap_vout device inside omap_display_init

Quoted 7 lines
 arch/arm/mach-omap2/Makefile  |  6 +-----
 arch/arm/mach-omap2/devices.c | 10 +++++-----
 arch/arm/mach-omap2/display.c | 28 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/display.h |  4 ++++
 arch/arm/mach-omap2/drm.c     | 24 +++++-------------------
 arch/arm/mach-omap2/fb.c      | 14 +++++++-------
 6 files changed, 50 insertions(+), 36 deletions(-)
Quoted 5 lines

Tony, since there are no driver changes here, and it's unlikely that we'd have a conflict between the dss driver changes and these changes, I think it's best if this goes through linux-omap.

OK applying into omap-for-v3.13/display, thanks.

Tony