All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Sharma <rahul.sharma@samsung.com>
To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org
Cc: inki.dae@samsung.com, seanpaul@google.com, r.sh.open@gmail.com,
	sw0312.kim@samsung.com, joshi@samsung.com,
	Rahul Sharma <rahul.sharma@samsung.com>
Subject: [PATCH 1/4] drm/exynos: hdmi: move hdmi subsystem registration to drm common hdmi
Date: Mon, 29 Apr 2013 20:20:50 +0530	[thread overview]
Message-ID: <1367247053-17105-2-git-send-email-rahul.sharma@samsung.com> (raw)
In-Reply-To: <1367247053-17105-1-git-send-email-rahul.sharma@samsung.com>

Exynos hdmi sub-system consists of mixer, hdmi ip, hdmi-phy and hdmi-ddc
components. Currently, drivers for these components are getting registered
in exynos_drm_drv.c, which is meant for registration of drm sub-drivers.

In this patch, registration of drm hdmi sub-driver and device, drivers for
hdmi sub-system components are moved to exynos_drm_hdmi.c. This ensures
limited & relevant exposure of hdmi-sub-system components to exynos_drm_drv.c.
It will also help in handling the hdmi-sub-system diversities within the
exynos-common-hdmi.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c  |   25 ++--------------
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |   14 ++++-----
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c |   46 ++++++++++++++++++++++++------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h |    3 ++
 4 files changed, 49 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index ba6d995..4eabb6e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -331,19 +331,9 @@ static int __init exynos_drm_init(void)
 #endif
 
 #ifdef CONFIG_DRM_EXYNOS_HDMI
-	ret = platform_driver_register(&hdmi_driver);
+	ret = exynos_common_hdmi_register();
 	if (ret < 0)
 		goto out_hdmi;
-	ret = platform_driver_register(&mixer_driver);
-	if (ret < 0)
-		goto out_mixer;
-	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
@@ -436,13 +426,7 @@ 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);
-out_mixer:
-	platform_driver_unregister(&hdmi_driver);
+	exynos_common_hdmi_unregister();
 out_hdmi:
 #endif
 
@@ -483,10 +467,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);
+	exynos_common_hdmi_unregister();
 #endif
 
 #ifdef CONFIG_DRM_EXYNOS_VIDI
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index eaa1966..34aa36d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -319,15 +319,16 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file);
 void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file);
 
 /*
- * this function registers exynos drm hdmi platform device. It ensures only one
- * instance of the device is created.
+ * this function registers exynos drm hdmi platform driver and singleton
+ * device. It also registers subdrivers like mixer, hdmi and hdmiphy.
  */
-int exynos_platform_device_hdmi_register(void);
+int exynos_common_hdmi_register(void);
 
 /*
- * this function unregisters exynos drm hdmi platform device if it exists.
+ * this function unregisters exynos drm hdmi platform driver and device,
+ * subdrivers for mixer, hdmi and hdmiphy.
  */
-void exynos_platform_device_hdmi_unregister(void);
+void exynos_common_hdmi_unregister(void);
 
 /*
  * this function registers exynos drm ipp platform device.
@@ -340,9 +341,6 @@ int exynos_platform_device_ipp_register(void);
 void exynos_platform_device_ipp_unregister(void);
 
 extern struct platform_driver fimd_driver;
-extern struct platform_driver hdmi_driver;
-extern struct platform_driver mixer_driver;
-extern struct platform_driver exynos_drm_common_hdmi_driver;
 extern struct platform_driver vidi_driver;
 extern struct platform_driver g2d_driver;
 extern struct platform_driver fimc_driver;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
index 060fbe8..7ab5f9f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
@@ -41,6 +41,8 @@ static struct exynos_drm_hdmi_context *mixer_ctx;
 static struct exynos_hdmi_ops *hdmi_ops;
 static struct exynos_mixer_ops *mixer_ops;
 
+struct platform_driver exynos_drm_common_hdmi_driver;
+
 struct drm_hdmi_context {
 	struct exynos_drm_subdrv	subdrv;
 	struct exynos_drm_hdmi_context	*hdmi_ctx;
@@ -49,29 +51,55 @@ struct drm_hdmi_context {
 	bool	enabled[MIXER_WIN_NR];
 };
 
-int exynos_platform_device_hdmi_register(void)
+int exynos_common_hdmi_register(void)
 {
 	struct platform_device *pdev;
+	int ret;
 
 	if (exynos_drm_hdmi_pdev)
 		return -EEXIST;
 
+	ret = platform_driver_register(&hdmi_driver);
+	if (ret < 0)
+		goto out_hdmi;
+
+	ret = platform_driver_register(&mixer_driver);
+	if (ret < 0)
+		goto out_mixer;
+
+	ret = platform_driver_register(&exynos_drm_common_hdmi_driver);
+	if (ret < 0)
+		goto out_common_hdmi;
+
 	pdev = platform_device_register_simple(
 			"exynos-drm-hdmi", -1, NULL, 0);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
+	if (IS_ERR(pdev)) {
+		ret = PTR_ERR(pdev);
+		goto out_common_hdmi_dev;
+	}
 
 	exynos_drm_hdmi_pdev = pdev;
-
 	return 0;
+
+out_common_hdmi_dev:
+	platform_driver_unregister(&exynos_drm_common_hdmi_driver);
+out_common_hdmi:
+	platform_driver_unregister(&mixer_driver);
+out_mixer:
+	platform_driver_unregister(&hdmi_driver);
+out_hdmi:
+	return ret;
 }
 
-void exynos_platform_device_hdmi_unregister(void)
+void exynos_common_hdmi_unregister(void)
 {
-	if (exynos_drm_hdmi_pdev) {
-		platform_device_unregister(exynos_drm_hdmi_pdev);
-		exynos_drm_hdmi_pdev = NULL;
-	}
+	if (!exynos_drm_hdmi_pdev)
+		return;
+	platform_device_unregister(exynos_drm_hdmi_pdev);
+	platform_driver_unregister(&exynos_drm_common_hdmi_driver);
+	platform_driver_unregister(&mixer_driver);
+	platform_driver_unregister(&hdmi_driver);
+	exynos_drm_hdmi_pdev = NULL;
 }
 
 void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
index 724cab1..8861b90 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
@@ -60,6 +60,9 @@ struct exynos_mixer_ops {
 	int (*check_mode)(void *ctx, struct drm_display_mode *mode);
 };
 
+extern struct platform_driver hdmi_driver;
+extern struct platform_driver mixer_driver;
+
 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);
-- 
1.7.10.4

  reply	other threads:[~2013-04-29 14:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-29 14:50 [PATCH 0/4] drm/exynos: hdmi: move hdmiphy related code to hdmiphy driver Rahul Sharma
2013-04-29 14:50 ` Rahul Sharma [this message]
2013-04-29 16:36   ` [PATCH 1/4] drm/exynos: hdmi: move hdmi subsystem registration to drm common hdmi Sean Paul
2013-05-03  6:04     ` Rahul Sharma
2013-05-03 16:30       ` Sean Paul
2013-04-29 14:50 ` [PATCH 2/4] drm/exynos: hdmi: register hdmiphy driver from common drm hdmi Rahul Sharma
2013-04-29 16:58   ` Sean Paul
2013-05-03  8:25     ` Rahul Sharma
2013-05-03 16:46       ` Sean Paul
2013-04-29 14:50 ` [PATCH 3/4] drm/exynos: hdmi: move hdmiphy callbacks to hdmiphy driver Rahul Sharma
2013-04-29 14:50 ` [PATCH 4/4] ARM: EXYNOS: remove parent device for hdmiphy clock Rahul Sharma
2013-04-29 17:04   ` Sean Paul
2013-04-29 17:37     ` Sylwester Nawrocki
2013-04-30  4:56       ` Rahul Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367247053-17105-2-git-send-email-rahul.sharma@samsung.com \
    --to=rahul.sharma@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=joshi@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=r.sh.open@gmail.com \
    --cc=seanpaul@google.com \
    --cc=sw0312.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.