diff mbox

[1/3] drm/omap: add support for ARCH_MULTIPLATFORM

Message ID 1351499474-5937-2-git-send-email-rob.clark@linaro.org
State New
Headers show

Commit Message

Rob Clark Oct. 29, 2012, 8:31 a.m. UTC
From: Rob Clark <rob@ti.com>

Remove usage of plat/cpu.h and get information from platform data
instead.  This enables omapdrm to be built with ARCH_MULTIPLATFORM.

Signed-off-by: Rob Clark <rob@ti.com>
---
 arch/arm/mach-omap2/drm.c                |    7 +++++++
 drivers/staging/omapdrm/Kconfig          |    2 +-
 drivers/staging/omapdrm/omap_dmm_tiler.h |    1 -
 drivers/staging/omapdrm/omap_drv.c       |    6 +++++-
 drivers/staging/omapdrm/omap_drv.h       |    2 ++
 include/linux/platform_data/omap_drm.h   |    1 +
 6 files changed, 16 insertions(+), 3 deletions(-)

Comments

Tomi Valkeinen Oct. 29, 2012, 9:04 a.m. UTC | #1
On 2012-10-29 10:31, Rob Clark wrote:
> From: Rob Clark <rob@ti.com>
> 
> Remove usage of plat/cpu.h and get information from platform data
> instead.  This enables omapdrm to be built with ARCH_MULTIPLATFORM.
> 
> Signed-off-by: Rob Clark <rob@ti.com>
> ---
>  arch/arm/mach-omap2/drm.c                |    7 +++++++
>  drivers/staging/omapdrm/Kconfig          |    2 +-
>  drivers/staging/omapdrm/omap_dmm_tiler.h |    1 -
>  drivers/staging/omapdrm/omap_drv.c       |    6 +++++-
>  drivers/staging/omapdrm/omap_drv.h       |    2 ++
>  include/linux/platform_data/omap_drm.h   |    1 +
>  6 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
> index 72e0f01b..49a7ffb 100644
> --- a/arch/arm/mach-omap2/drm.c
> +++ b/arch/arm/mach-omap2/drm.c
> @@ -23,15 +23,20 @@
>  #include <linux/init.h>
>  #include <linux/platform_device.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/platform_data/omap_drm.h>
>  
>  #include <plat/omap_device.h>
>  #include <plat/omap_hwmod.h>
> +#include <plat/cpu.h>
>  
>  #if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
>  
> +static struct omap_drm_platform_data platform_data;
> +
>  static struct platform_device omap_drm_device = {
>  	.dev = {
>  		.coherent_dma_mask = DMA_BIT_MASK(32),
> +		.platform_data = &platform_data,
>  	},
>  	.name = "omapdrm",
>  	.id = 0,
> @@ -52,6 +57,8 @@ static int __init omap_init_drm(void)
>  			oh->name);
>  	}
>  
> +	platform_data.omaprev = GET_OMAP_REVISION();
> +
>  	return platform_device_register(&omap_drm_device);
>  
>  }
> diff --git a/drivers/staging/omapdrm/Kconfig b/drivers/staging/omapdrm/Kconfig
> index 81a7cba..b724a41 100644
> --- a/drivers/staging/omapdrm/Kconfig
> +++ b/drivers/staging/omapdrm/Kconfig
> @@ -2,7 +2,7 @@
>  config DRM_OMAP
>  	tristate "OMAP DRM"
>  	depends on DRM && !CONFIG_FB_OMAP2
> -	depends on ARCH_OMAP2PLUS
> +	depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM

If you remove the omap include dependencies, is there any reason to keep
ARCH_OMAP2PLUS here? And if you remove that, you don't need
ARCH_MULTIPLATFORM either.

omapdrm is not a driver for OMAP, even if the name so suggests. It's a
driver for a display subsystem hardware, that happens to be used in OMAP
(with the help of omapdss driver), and the tiler memory system used in OMAP.

I just recently removed omap dependencies from omapdss driver, and it
now compiles fine on x86 config also.

 Tomi
Rob Clark Oct. 29, 2012, 9:27 a.m. UTC | #2
On Mon, Oct 29, 2012 at 10:04 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> On 2012-10-29 10:31, Rob Clark wrote:
>> From: Rob Clark <rob@ti.com>
>>
>> Remove usage of plat/cpu.h and get information from platform data
>> instead.  This enables omapdrm to be built with ARCH_MULTIPLATFORM.
>>
>> Signed-off-by: Rob Clark <rob@ti.com>
>> ---
>>  arch/arm/mach-omap2/drm.c                |    7 +++++++
>>  drivers/staging/omapdrm/Kconfig          |    2 +-
>>  drivers/staging/omapdrm/omap_dmm_tiler.h |    1 -
>>  drivers/staging/omapdrm/omap_drv.c       |    6 +++++-
>>  drivers/staging/omapdrm/omap_drv.h       |    2 ++
>>  include/linux/platform_data/omap_drm.h   |    1 +
>>  6 files changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
>> index 72e0f01b..49a7ffb 100644
>> --- a/arch/arm/mach-omap2/drm.c
>> +++ b/arch/arm/mach-omap2/drm.c
>> @@ -23,15 +23,20 @@
>>  #include <linux/init.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/dma-mapping.h>
>> +#include <linux/platform_data/omap_drm.h>
>>
>>  #include <plat/omap_device.h>
>>  #include <plat/omap_hwmod.h>
>> +#include <plat/cpu.h>
>>
>>  #if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
>>
>> +static struct omap_drm_platform_data platform_data;
>> +
>>  static struct platform_device omap_drm_device = {
>>       .dev = {
>>               .coherent_dma_mask = DMA_BIT_MASK(32),
>> +             .platform_data = &platform_data,
>>       },
>>       .name = "omapdrm",
>>       .id = 0,
>> @@ -52,6 +57,8 @@ static int __init omap_init_drm(void)
>>                       oh->name);
>>       }
>>
>> +     platform_data.omaprev = GET_OMAP_REVISION();
>> +
>>       return platform_device_register(&omap_drm_device);
>>
>>  }
>> diff --git a/drivers/staging/omapdrm/Kconfig b/drivers/staging/omapdrm/Kconfig
>> index 81a7cba..b724a41 100644
>> --- a/drivers/staging/omapdrm/Kconfig
>> +++ b/drivers/staging/omapdrm/Kconfig
>> @@ -2,7 +2,7 @@
>>  config DRM_OMAP
>>       tristate "OMAP DRM"
>>       depends on DRM && !CONFIG_FB_OMAP2
>> -     depends on ARCH_OMAP2PLUS
>> +     depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
>
> If you remove the omap include dependencies, is there any reason to keep
> ARCH_OMAP2PLUS here? And if you remove that, you don't need
> ARCH_MULTIPLATFORM either.

I suppose probably not.. although it does seem a bit pointless to
build it for x86 for the most point, other than compile testing
changes in drm core.

I could go with whichever approach that people prefer.

BR,
-R


> omapdrm is not a driver for OMAP, even if the name so suggests. It's a
> driver for a display subsystem hardware, that happens to be used in OMAP
> (with the help of omapdss driver), and the tiler memory system used in OMAP.
>
> I just recently removed omap dependencies from omapdss driver, and it
> now compiles fine on x86 config also.
>
>  Tomi
>
>
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
index 72e0f01b..49a7ffb 100644
--- a/arch/arm/mach-omap2/drm.c
+++ b/arch/arm/mach-omap2/drm.c
@@ -23,15 +23,20 @@ 
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
+#include <linux/platform_data/omap_drm.h>
 
 #include <plat/omap_device.h>
 #include <plat/omap_hwmod.h>
+#include <plat/cpu.h>
 
 #if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
 
+static struct omap_drm_platform_data platform_data;
+
 static struct platform_device omap_drm_device = {
 	.dev = {
 		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &platform_data,
 	},
 	.name = "omapdrm",
 	.id = 0,
@@ -52,6 +57,8 @@  static int __init omap_init_drm(void)
 			oh->name);
 	}
 
+	platform_data.omaprev = GET_OMAP_REVISION();
+
 	return platform_device_register(&omap_drm_device);
 
 }
diff --git a/drivers/staging/omapdrm/Kconfig b/drivers/staging/omapdrm/Kconfig
index 81a7cba..b724a41 100644
--- a/drivers/staging/omapdrm/Kconfig
+++ b/drivers/staging/omapdrm/Kconfig
@@ -2,7 +2,7 @@ 
 config DRM_OMAP
 	tristate "OMAP DRM"
 	depends on DRM && !CONFIG_FB_OMAP2
-	depends on ARCH_OMAP2PLUS
+	depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
 	select DRM_KMS_HELPER
 	select OMAP2_DSS
 	select FB_SYS_FILLRECT
diff --git a/drivers/staging/omapdrm/omap_dmm_tiler.h b/drivers/staging/omapdrm/omap_dmm_tiler.h
index c0271a2..4fdd61e 100644
--- a/drivers/staging/omapdrm/omap_dmm_tiler.h
+++ b/drivers/staging/omapdrm/omap_dmm_tiler.h
@@ -16,7 +16,6 @@ 
 #ifndef OMAP_DMM_TILER_H
 #define OMAP_DMM_TILER_H
 
-#include <plat/cpu.h>
 #include "omap_drv.h"
 #include "tcm.h"
 
diff --git a/drivers/staging/omapdrm/omap_drv.c b/drivers/staging/omapdrm/omap_drv.c
index c27d091..4f5b4c7 100644
--- a/drivers/staging/omapdrm/omap_drv.c
+++ b/drivers/staging/omapdrm/omap_drv.c
@@ -278,13 +278,14 @@  static void omap_modeset_free(struct drm_device *dev)
 static int ioctl_get_param(struct drm_device *dev, void *data,
 		struct drm_file *file_priv)
 {
+	struct omap_drm_private *priv = dev->dev_private;
 	struct drm_omap_param *args = data;
 
 	DBG("%p: param=%llu", dev, args->param);
 
 	switch (args->param) {
 	case OMAP_PARAM_CHIPSET_ID:
-		args->value = GET_OMAP_TYPE;
+		args->value = priv->omaprev;
 		break;
 	default:
 		DBG("unknown parameter %lld", args->param);
@@ -416,6 +417,7 @@  struct drm_ioctl_desc ioctls[DRM_COMMAND_END - DRM_COMMAND_BASE] = {
  */
 static int dev_load(struct drm_device *dev, unsigned long flags)
 {
+	struct omap_drm_platform_data *pdata = dev->dev->platform_data;
 	struct omap_drm_private *priv;
 	int ret;
 
@@ -427,6 +429,8 @@  static int dev_load(struct drm_device *dev, unsigned long flags)
 		return -ENOMEM;
 	}
 
+	priv->omaprev = pdata->omaprev;
+
 	dev->dev_private = priv;
 
 	priv->wq = alloc_ordered_workqueue("omapdrm", 0);
diff --git a/drivers/staging/omapdrm/omap_drv.h b/drivers/staging/omapdrm/omap_drv.h
index 834b4f1..b2f1751 100644
--- a/drivers/staging/omapdrm/omap_drv.h
+++ b/drivers/staging/omapdrm/omap_drv.h
@@ -89,6 +89,8 @@  int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
 		unsigned long timeout);
 
 struct omap_drm_private {
+	uint32_t omaprev;
+
 	unsigned int num_crtcs;
 	struct drm_crtc *crtcs[8];
 
diff --git a/include/linux/platform_data/omap_drm.h b/include/linux/platform_data/omap_drm.h
index 3da73bdc..f4e4a237 100644
--- a/include/linux/platform_data/omap_drm.h
+++ b/include/linux/platform_data/omap_drm.h
@@ -46,6 +46,7 @@  struct omap_kms_platform_data {
 };
 
 struct omap_drm_platform_data {
+	uint32_t omaprev;
 	struct omap_kms_platform_data *kms_pdata;
 };