From patchwork Tue Oct 16 00:20:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1594411 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id ABAC73FD86 for ; Mon, 15 Oct 2012 15:51:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B46829ED77 for ; Mon, 15 Oct 2012 08:51:56 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 272929F08D for ; Mon, 15 Oct 2012 07:26:15 -0700 (PDT) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBX00BCJURJHWA0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 15 Oct 2012 23:26:14 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.124]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 66.2A.07865.60D1C705; Mon, 15 Oct 2012 23:26:14 +0900 (KST) X-AuditID: cbfee61a-b7f976d000001eb9-0f-507c1d063411 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id D5.2A.07865.60D1C705; Mon, 15 Oct 2012 23:26:14 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBX00GCIULFPNA0@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 15 Oct 2012 23:26:13 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/2] drm: exynos: moved exynos drm hdmi device registration to drm driver Date: Tue, 16 Oct 2012 05:50:13 +0530 Message-id: <1350346813-1040-3-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1350346813-1040-1-git-send-email-rahul.sharma@samsung.com> References: <1350346813-1040-1-git-send-email-rahul.sharma@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRmVeSWpSXmKPExsWyRsSkRpdNtibA4PoRIYsrX9+zOTB63O8+ zhTAGMVlk5Kak1mWWqRvl8CVcf5qC0vBNvmKbYfyGxhbpLsYOTgkBEwk2lZmdjFyApliEhfu rWcDsYUEljJKvDzED1Oyd4FCFyMXUHg6o8T6/uesEM5qJolZzdOYQBrYBHQlZh98xghiiwgo S/yduIoRpIhZYAmTxOH2rWBFwgJxEi+X/mQHsVkEVCVetO1jAbF5BdwlWjsnsEFcoSDRuuwQ WA2ngIfEt44zrBAXuUt8+9MN1Ssg8W3yIRaI62QlNh1ghmi9ziZx9qMUhC0pcXDFDZYJjMIL GBlWMYqmFiQXFCel5xrqFSfmFpfmpesl5+duYgSG3+l/z6R2MK5ssDjEKMDBqMTD+9OrOkCI NbGsuDL3EKMEB7OSCO+zR0Ah3pTEyqrUovz4otKc1OJDjD5Ah0xklhJNzgfGRl5JvKGxibmp samlkZGZqSkOYSVx3maPlAAhgfTEktTs1NSC1CKYcUwcnFINjDpOCTGFll6r/1zTS7EU9Y38 e3LL3yllSz8efNaxYhmDd4mLmn5H2od57bbe72eonVysr1+0aTf/Oa373L/mpvAbiRW/zL/0 dsJi1vX314Xfe3tHNZs1/ifjVSlFV6/fM/8YZETP7PurNdWX6arvq7s7fvYVNJ6U+8/Muv7p nesbp7YmV83kuq3EUpyRaKjFXFScCAC/Km79bAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xoC6bbE2Awe85HBZXvr5nc2D0uN99 nCmAMaqB0SYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH aKySQlliTilQKCCxuFhJ3w7ThNAQN10LmMYIXd+QILgeIwM0kLCGMeP81RaWgm3yFdsO5Tcw tkh3MXJwSAiYSOxdoNDFyAlkiklcuLeerYuRi0NIYDqjxPr+56wQzmomiVnN05hAqtgEdCVm H3zGCGKLCChL/J24ihGkiFlgCZPE4fatYEXCAnESL5f+ZAexWQRUJV607WMBsXkF3CVaOyew QaxTkGhddgishlPAQ+JbxxlWEFsIqObbn272CYy8CxgZVjGKphYkFxQnpeca6hUn5haX5qXr JefnbmIEh/gzqR2MKxssDjEKcDAq8fD+9KoOEGJNLCuuzD3EKMHBrCTC++wRUIg3JbGyKrUo P76oNCe1+BCjD9BVE5mlRJPzgfGXVxJvaGxibmpsamliYWJmiUNYSZy32SMlQEggPbEkNTs1 tSC1CGYcEwenVANjlFXr+Vkncx69V9nIsSnT86ajy5pac5kT39UvzC96a31n2YLlHY9012qc 5zvM3u7PfOiH/4z/O239zx6f5273Jrcn5sSvU1dr7NZ8Ns5f2mJ/O5T30ezHP/4Vt7P9PiEb tyZsvstBF4HKK0b7ZodEnw1Y4verVa2VV0DcXnbnp9AV2yMWPZq7UImlOCPRUIu5qDgRABRk GJeeAgAA X-CFilter-Loop: Reflected X-Mailman-Approved-At: Mon, 15 Oct 2012 08:49:51 -0700 Cc: t.stanislaws@samsung.com, tomasz.figa@gmail.com, joshi@samsung.com, kyungmin.park@samsung.com, thomas.ab@samsung.com, rahul.sharma@samsung.com, prashanth.g@samsung.com, s.shirish@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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 --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 9 ++++++++- drivers/gpu/drm/exynos/exynos_drm_drv.h | 11 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 22 ++++++++++++++++++++++ 3 files changed, 41 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..507f8ba 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -329,6 +329,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 +370,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 +405,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_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index eec77aa..e4abb62 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -319,6 +319,17 @@ int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *drm_subdrv); 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. + */ +extern int exynos_platform_device_hdmi_register(void); + +/* + * this function unregisters exynos drm hdmi platform device if it exists. + */ +void exynos_platform_device_hdmi_unregister(void); + extern struct platform_driver fimd_driver; extern struct platform_driver hdmi_driver; extern struct platform_driver mixer_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)