dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] add exynos-drm platform device registration to driver
@ 2012-10-12 16:00 Rahul Sharma
  2012-10-12 16:00 ` [PATCH v1 1/2] drm: exynos: moved exynos drm device registration to drm driver Rahul Sharma
  2012-10-12 16:00 ` [PATCH v1 2/2] drm: exynos: moved exynos drm hdmi " Rahul Sharma
  0 siblings, 2 replies; 4+ messages in thread
From: Rahul Sharma @ 2012-10-12 16:00 UTC (permalink / raw)
  To: dri-devel
  Cc: t.stanislaws, joshi, kyungmin.park, thomas.ab, rahul.sharma,
	prashanth.g, s.shirish

This patch adds drm-exynos and drm-exynos-hdmi device registration to the
drm driver. It was happening in machine init code earlier which is not
acceptable for dt enabled platforms. 

Patch which cleans the respective code from arch/arm is "arm: exynos:
removing exynos-drm device registration from non-dt platforms" is posted
to linux-samsung-soc mailing list.

This patchset is based on branch exynos-drm-next at
git://git.infradead.org/users/kmpark/linux-samsung (linux v3.6-rc4)

v1:
- moved exynos_drm_hdmi_pdev to drm hdmi layer
- added exynos_platform_device_hdmi_register interface

Rahul Sharma (2):
  drm: exynos: moved exynos drm device registration to drm driver
  drm: exynos: moved exynos drm hdmi device registration to drm driver

 drivers/gpu/drm/exynos/exynos_drm_drv.c  |   26 +++++++++++++++++++++++++-
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c |   22 ++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h |    2 ++
 3 files changed, 49 insertions(+), 1 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 1/2] drm: exynos: moved exynos drm device registration to drm driver
  2012-10-12 16:00 [PATCH v1 0/2] add exynos-drm platform device registration to driver Rahul Sharma
@ 2012-10-12 16:00 ` Rahul Sharma
  2012-10-12 16:00 ` [PATCH v1 2/2] drm: exynos: moved exynos drm hdmi " Rahul Sharma
  1 sibling, 0 replies; 4+ messages in thread
From: Rahul Sharma @ 2012-10-12 16:00 UTC (permalink / raw)
  To: dri-devel
  Cc: t.stanislaws, joshi, kyungmin.park, thomas.ab, rahul.sharma,
	prashanth.g, s.shirish

This patch moved the exynos-drm platform device registration to the drm driver.
When DT is enabled, platform devices needs to be registered within the driver
code. This patch fits the requirement of both DT and Non DT based drm drivers.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index d070719..4200f15 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -50,6 +50,9 @@
 
 #define VBLANK_OFF_DELAY	50000
 
+/* platform device pointer for eynos drm device. */
+static struct platform_device *exynos_drm_pdev;
+
 static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 {
 	struct exynos_drm_private *private;
@@ -280,6 +283,7 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
 {
 	DRM_DEBUG_DRIVER("%s\n", __FILE__);
 
+	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 	exynos_drm_driver.num_ioctls = DRM_ARRAY_SIZE(exynos_ioctls);
 
 	return drm_platform_init(&exynos_drm_driver, pdev);
@@ -341,11 +345,21 @@ static int __init exynos_drm_init(void)
 
 	ret = platform_driver_register(&exynos_drm_platform_driver);
 	if (ret < 0)
+		goto out_drm;
+
+	exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1,
+				NULL, 0);
+	if (IS_ERR_OR_NULL(exynos_drm_pdev)) {
+		ret = PTR_ERR(exynos_drm_pdev);
 		goto out;
+	}
 
 	return 0;
 
 out:
+	platform_driver_unregister(&exynos_drm_platform_driver);
+
+out_drm:
 #ifdef CONFIG_DRM_EXYNOS_G2D
 	platform_driver_unregister(&g2d_driver);
 out_g2d:
@@ -376,6 +390,8 @@ static void __exit exynos_drm_exit(void)
 {
 	DRM_DEBUG_DRIVER("%s\n", __FILE__);
 
+	platform_device_unregister(exynos_drm_pdev);
+
 	platform_driver_unregister(&exynos_drm_platform_driver);
 
 #ifdef CONFIG_DRM_EXYNOS_G2D
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v1 2/2] drm: exynos: moved exynos drm hdmi device registration to drm driver
  2012-10-12 16:00 [PATCH v1 0/2] add exynos-drm platform device registration to driver Rahul Sharma
  2012-10-12 16:00 ` [PATCH v1 1/2] drm: exynos: moved exynos drm device registration to drm driver Rahul Sharma
@ 2012-10-12 16:00 ` Rahul Sharma
  2012-10-15  4:04   ` Inki Dae
  1 sibling, 1 reply; 4+ messages in thread
From: Rahul Sharma @ 2012-10-12 16:00 UTC (permalink / raw)
  To: dri-devel
  Cc: t.stanislaws, joshi, kyungmin.park, thomas.ab, rahul.sharma,
	prashanth.g, s.shirish

This patch moved the exynos-drm-hdmi platform device registration to the drm
driver. When DT is enabled, platform devices needs to be registered within the
driver code. This patch fits the requirement of both DT and Non DT based drm
drivers.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c  |   10 +++++++++-
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c |   22 ++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h |    2 ++
 3 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 4200f15..b491847 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -41,6 +41,7 @@
 #include "exynos_drm_vidi.h"
 #include "exynos_drm_dmabuf.h"
 #include "exynos_drm_g2d.h"
+#include "exynos_drm_hdmi.h"
 
 #define DRIVER_NAME	"exynos"
 #define DRIVER_DESC	"Samsung SoC DRM"
@@ -329,6 +330,10 @@ static int __init exynos_drm_init(void)
 	ret = platform_driver_register(&exynos_drm_common_hdmi_driver);
 	if (ret < 0)
 		goto out_common_hdmi;
+
+	ret = exynos_platform_device_hdmi_register();
+	if (ret < 0)
+		goto out_common_hdmi_dev;
 #endif
 
 #ifdef CONFIG_DRM_EXYNOS_VIDI
@@ -366,11 +371,13 @@ out_g2d:
 #endif
 
 #ifdef CONFIG_DRM_EXYNOS_VIDI
-out_vidi:
 	platform_driver_unregister(&vidi_driver);
+out_vidi:
 #endif
 
 #ifdef CONFIG_DRM_EXYNOS_HDMI
+	exynos_platform_device_hdmi_unregister();
+out_common_hdmi_dev:
 	platform_driver_unregister(&exynos_drm_common_hdmi_driver);
 out_common_hdmi:
 	platform_driver_unregister(&mixer_driver);
@@ -399,6 +406,7 @@ static void __exit exynos_drm_exit(void)
 #endif
 
 #ifdef CONFIG_DRM_EXYNOS_HDMI
+	exynos_platform_device_hdmi_unregister();
 	platform_driver_unregister(&exynos_drm_common_hdmi_driver);
 	platform_driver_unregister(&mixer_driver);
 	platform_driver_unregister(&hdmi_driver);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
index 85304c4..a4c84c1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
@@ -29,6 +29,9 @@
 #define get_ctx_from_subdrv(subdrv)	container_of(subdrv,\
 					struct drm_hdmi_context, subdrv);
 
+/* platform device pointer for common drm hdmi device. */
+static struct platform_device *exynos_drm_hdmi_pdev;
+
 /* Common hdmi subdrv needs to access the hdmi and mixer though context.
 * These should be initialied by the repective drivers */
 static struct exynos_drm_hdmi_context *hdmi_ctx;
@@ -46,6 +49,25 @@ struct drm_hdmi_context {
 	bool	enabled[MIXER_WIN_NR];
 };
 
+int exynos_platform_device_hdmi_register(void)
+{
+	if (exynos_drm_hdmi_pdev)
+		return -EEXIST;
+
+	exynos_drm_hdmi_pdev = platform_device_register_simple(
+			"exynos-drm-hdmi", -1, NULL, 0);
+	if (IS_ERR_OR_NULL(exynos_drm_hdmi_pdev))
+		return PTR_ERR(exynos_drm_hdmi_pdev);
+
+	return 0;
+}
+
+void exynos_platform_device_hdmi_unregister(void)
+{
+	if (exynos_drm_hdmi_pdev)
+		platform_device_unregister(exynos_drm_hdmi_pdev);
+}
+
 void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx)
 {
 	if (ctx)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
index 2da5ffd..192329c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
@@ -77,4 +77,6 @@ void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx);
 void exynos_mixer_drv_attach(struct exynos_drm_hdmi_context *ctx);
 void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops);
 void exynos_mixer_ops_register(struct exynos_mixer_ops *ops);
+int exynos_platform_device_hdmi_register(void);
+void exynos_platform_device_hdmi_unregister(void);
 #endif
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH v1 2/2] drm: exynos: moved exynos drm hdmi device registration to drm driver
  2012-10-12 16:00 ` [PATCH v1 2/2] drm: exynos: moved exynos drm hdmi " Rahul Sharma
@ 2012-10-15  4:04   ` Inki Dae
  0 siblings, 0 replies; 4+ messages in thread
From: Inki Dae @ 2012-10-15  4:04 UTC (permalink / raw)
  To: 'Rahul Sharma', dri-devel
  Cc: t.stanislaws, joshi, kyungmin.park, thomas.ab, prashanth.g,
	s.shirish



> -----Original Message-----
> From: Rahul Sharma [mailto:rahul.sharma@samsung.com]
> Sent: Saturday, October 13, 2012 1:01 AM
> To: dri-devel@lists.freedesktop.org
> Cc: t.stanislaws@samsung.com; sw0312.kim@samsung.com;
inki.dae@samsung.com;
> jy0922.shim@samsung.com; kyungmin.park@samsung.com; thomas.ab@samsung.com;
> prashanth.g@samsung.com; joshi@samsung.com; s.shirish@samsung.com;
> r.sh.open@gmail.com; rahul.sharma@samsung.com
> Subject: [PATCH v1 2/2] drm: exynos: moved exynos drm hdmi device
> registration to drm driver
> 
> This patch moved the exynos-drm-hdmi platform device registration to the
> drm
> driver. When DT is enabled, platform devices needs to be registered within
> the
> driver code. This patch fits the requirement of both DT and Non DT based
> drm
> drivers.
> 
> Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c  |   10 +++++++++-
>  drivers/gpu/drm/exynos/exynos_drm_hdmi.c |   22 ++++++++++++++++++++++
>  drivers/gpu/drm/exynos/exynos_drm_hdmi.h |    2 ++
>  3 files changed, 33 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 4200f15..b491847 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -41,6 +41,7 @@
>  #include "exynos_drm_vidi.h"
>  #include "exynos_drm_dmabuf.h"
>  #include "exynos_drm_g2d.h"
> +#include "exynos_drm_hdmi.h"

One more thing, could you move below declarations into exynos_drm_drv.h and
remove above "#include "exynos_drm_hdmi.h"? this makes unnecessary
declarations and definitions are included. and also leave comments to each
declaration.

	"int exynos_platform_device_hdmi_register(void);
	 void exynos_platform_device_hdmi_unregister(void);"

Thanks,
Inki Dae

> 
>  #define DRIVER_NAME	"exynos"
>  #define DRIVER_DESC	"Samsung SoC DRM"
> @@ -329,6 +330,10 @@ static int __init exynos_drm_init(void)
>  	ret = platform_driver_register(&exynos_drm_common_hdmi_driver);
>  	if (ret < 0)
>  		goto out_common_hdmi;
> +
> +	ret = exynos_platform_device_hdmi_register();
> +	if (ret < 0)
> +		goto out_common_hdmi_dev;
>  #endif
> 
>  #ifdef CONFIG_DRM_EXYNOS_VIDI
> @@ -366,11 +371,13 @@ out_g2d:
>  #endif
> 
>  #ifdef CONFIG_DRM_EXYNOS_VIDI
> -out_vidi:
>  	platform_driver_unregister(&vidi_driver);
> +out_vidi:
>  #endif
> 
>  #ifdef CONFIG_DRM_EXYNOS_HDMI
> +	exynos_platform_device_hdmi_unregister();
> +out_common_hdmi_dev:
>  	platform_driver_unregister(&exynos_drm_common_hdmi_driver);
>  out_common_hdmi:
>  	platform_driver_unregister(&mixer_driver);
> @@ -399,6 +406,7 @@ static void __exit exynos_drm_exit(void)
>  #endif
> 
>  #ifdef CONFIG_DRM_EXYNOS_HDMI
> +	exynos_platform_device_hdmi_unregister();
>  	platform_driver_unregister(&exynos_drm_common_hdmi_driver);
>  	platform_driver_unregister(&mixer_driver);
>  	platform_driver_unregister(&hdmi_driver);
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> index 85304c4..a4c84c1 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> @@ -29,6 +29,9 @@
>  #define get_ctx_from_subdrv(subdrv)	container_of(subdrv,\
>  					struct drm_hdmi_context, subdrv);
> 
> +/* platform device pointer for common drm hdmi device. */
> +static struct platform_device *exynos_drm_hdmi_pdev;
> +
>  /* Common hdmi subdrv needs to access the hdmi and mixer though context.
>  * These should be initialied by the repective drivers */
>  static struct exynos_drm_hdmi_context *hdmi_ctx;
> @@ -46,6 +49,25 @@ struct drm_hdmi_context {
>  	bool	enabled[MIXER_WIN_NR];
>  };
> 
> +int exynos_platform_device_hdmi_register(void)
> +{
> +	if (exynos_drm_hdmi_pdev)
> +		return -EEXIST;
> +
> +	exynos_drm_hdmi_pdev = platform_device_register_simple(
> +			"exynos-drm-hdmi", -1, NULL, 0);
> +	if (IS_ERR_OR_NULL(exynos_drm_hdmi_pdev))
> +		return PTR_ERR(exynos_drm_hdmi_pdev);
> +
> +	return 0;
> +}
> +
> +void exynos_platform_device_hdmi_unregister(void)
> +{
> +	if (exynos_drm_hdmi_pdev)
> +		platform_device_unregister(exynos_drm_hdmi_pdev);
> +}
> +
>  void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx)
>  {
>  	if (ctx)
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> index 2da5ffd..192329c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> @@ -77,4 +77,6 @@ void exynos_hdmi_drv_attach(struct
> exynos_drm_hdmi_context *ctx);
>  void exynos_mixer_drv_attach(struct exynos_drm_hdmi_context *ctx);
>  void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops);
>  void exynos_mixer_ops_register(struct exynos_mixer_ops *ops);
> +int exynos_platform_device_hdmi_register(void);
> +void exynos_platform_device_hdmi_unregister(void);
>  #endif
> --
> 1.7.0.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-15  4:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-12 16:00 [PATCH v1 0/2] add exynos-drm platform device registration to driver Rahul Sharma
2012-10-12 16:00 ` [PATCH v1 1/2] drm: exynos: moved exynos drm device registration to drm driver Rahul Sharma
2012-10-12 16:00 ` [PATCH v1 2/2] drm: exynos: moved exynos drm hdmi " Rahul Sharma
2012-10-15  4:04   ` Inki Dae

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox