From patchwork Fri Oct 12 16:00:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1585861 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 552B3DFF71 for ; Fri, 12 Oct 2012 09:02:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 376FFA0E03 for ; Fri, 12 Oct 2012 02:02:30 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id C7807A0D99 for ; Thu, 11 Oct 2012 23:32:50 -0700 (PDT) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBR0013FOU5WST0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 12 Oct 2012 15:32:35 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.123]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id E7.2F.07865.389B7705; Fri, 12 Oct 2012 15:32:35 +0900 (KST) X-AuditID: cbfee61a-b7f976d000001eb9-55-5077b983477c Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 47.2F.07865.389B7705; Fri, 12 Oct 2012 15:32:35 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBR00LMHOTLXQ10@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 12 Oct 2012 15:32:35 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Subject: [PATCH v1 2/2] drm: exynos: moved exynos drm hdmi device registration to drm driver Date: Fri, 12 Oct 2012 21:30:40 +0530 Message-id: <1350057640-20984-3-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1350057640-20984-1-git-send-email-rahul.sharma@samsung.com> References: <1350057640-20984-1-git-send-email-rahul.sharma@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLLMWRmVeSWpSXmKPExsWyRsSkWrd5Z3mAQcNdJYsrX9+zOTB63O8+ zhTAGMVlk5Kak1mWWqRvl8CV0Xd6DXvBPrmKjrdN7A2MG6W6GDk5JARMJF7vvMAMYYtJXLi3 nq2LkYtDSGApo8SC3jssMEX/t+xjhEgsYpR4+7yTHcJZzSTx8cYzJpAqNgFdidkHnzGC2CIC yhJ/J64C62AW6GWSmDf/MBtIQlggTmLeysmsIDaLgKrE4a7rYLt5BTwkvpx/A7VOQaJ12SF2 EJtTwFNi8sdbYAuEgGp2d3xigugVkPg2+RBQPQdQvazEpgNQL1xnk2j9wgVhS0ocXHGDZQKj 8AJGhlWMoqkFyQXFSem5hnrFibnFpXnpesn5uZsYgWF4+t8zqR2MKxssDjEKcDAq8fBm/C0L EGJNLCuuzD3EKMHBrCTCe7CvPECINyWxsiq1KD++qDQntfgQow/QIROZpUST84ExklcSb2hs Ym5qbGppZGRmaopDWEmct9kjJUBIID2xJDU7NbUgtQhmHBMHp1QDo/udN7WbbeM0ivf/OeD3 Zkee55+GtPnv/BvPsvkklZ2YLdAq1vpXO7Vi+ssX5R4fkk5+nsXUHC7XIyAYJ5r/VPpW/cFp Ug2za/+1c7SLz63e/6vxYaz/t20fnjzdkcgqKRO68ILFStnZHGfLZ3pX30iz6xNc85ft4WvB lT2Lr/4LUlF4EqSsqcRSnJFoqMVcVJwIAF3iZZdwAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeLIzCtJLcpLzFFi42I5/e+xgG7zzvIAg8nPJCyufH3P5sDocb/7 OFMAY1QDo01GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO 0FglhbLEnFKgUEBicbGSvh2mCaEhbroWMI0Rur4hQXA9RgZoIGENY0bf6TXsBfvkKjreNrE3 MG6U6mLk5JAQMJH4v2UfI4QtJnHh3nq2LkYuDiGBRYwSb593skM4q5kkPt54xgRSxSagKzH7 4DOwDhEBZYm/E1cxghQxC/QyScybf5gNJCEsECcxb+VkVhCbRUBV4nDXdWYQm1fAQ+LL+Tcs EOsUJFqXHWIHsTkFPCUmf7wFtkAIqGZ3xyemCYy8CxgZVjGKphYkFxQnpeca6hUn5haX5qXr JefnbmIEh/kzqR2MKxssDjEKcDAq8fBm/C0LEGJNLCuuzD3EKMHBrCTCe7CvPECINyWxsiq1 KD++qDQntfgQow/QVROZpUST84ExmFcSb2hsYm5qbGppYmFiZolDWEmct9kjJUBIID2xJDU7 NbUgtQhmHBMHp1QD44atXycaZU0pVVvIeiK2pdmmQer826UfnZ6KLV26uThyY4yt8vLEuqt5 LEHiWZlrF93LZGfM7cxvqY4T00s0FDs4Q4thu9MCmbnHSng6Ze2ivp8xWLjjUbTIxqOBZmWB WY+39Gut5i56s/T6hBv+cho2yVpJTkYTo8+7NVofVi56blL8XV5QiaU4I9FQi7moOBEA0V7o sqACAAA= X-CFilter-Loop: Reflected X-Mailman-Approved-At: Fri, 12 Oct 2012 01:59:14 -0700 Cc: t.stanislaws@samsung.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 | 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