From patchwork Tue Nov 18 15:26:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 5331141 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0ADF3C11AD for ; Tue, 18 Nov 2014 15:26:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD15C201BC for ; Tue, 18 Nov 2014 15:26:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 33D36200E7 for ; Tue, 18 Nov 2014 15:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757216AbaKRP0t (ORCPT ); Tue, 18 Nov 2014 10:26:49 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:26693 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757211AbaKRP0r (ORCPT ); Tue, 18 Nov 2014 10:26:47 -0500 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NF800KQ2QWMHC30@mailout4.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 19 Nov 2014 00:26:46 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.115]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 16.71.17016.5356B645; Wed, 19 Nov 2014 00:26:45 +0900 (KST) X-AuditID: cbfee68d-f79296d000004278-62-546b6535ee18 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id A0.2A.09430.5356B645; Wed, 19 Nov 2014 00:26:45 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.252.83.67]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NF800D1LQWLLG30@mmp1.samsung.com>; Wed, 19 Nov 2014 00:26:45 +0900 (KST) From: Inki Dae To: dri-devel@lists.freedesktop.org Cc: airlied@linux.ie, linux-samsung-soc@vger.kernel.org, Inki Dae Subject: [RFC PATCH 1/3] drm/exynos: make kms drivers to be independent modules Date: Wed, 19 Nov 2014 00:26:42 +0900 Message-id: <1416324404-28153-2-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1416324404-28153-1-git-send-email-inki.dae@samsung.com> References: <1416324404-28153-1-git-send-email-inki.dae@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsWyRsSkWNc0NTvEoGmfjUXvuZNMFle+vmez mHR/AovFjPP7mBxYPLZ/e8Dqcb/7OJNH35ZVjB6fN8kFsERx2aSk5mSWpRbp2yVwZazqns9c MMu14t6e74wNjG+suhg5OSQETCT23lrFCGGLSVy4t54NxBYSWMooMeNfJkzN2cYG9i5GLqD4 IkaJ/ll3WSCcbiaJTTP/g3WzCahKTFxxH6xbREBZ4u9EiKnMAlESyw8vZQexhQX8JZYdvMcM YrMA1fd/nssCYvMKuEg8vNEHVM8BtE1BYs4kGxCTU8BVovcnG4gpBFTx/6okyFYJge9sEg/b JrJBTBGQ+Db5EAtEp6zEpgPMECdLShxccYNlAqPwAkaGVYyiqQXJBcVJ6UWGesWJucWleel6 yfm5mxiBgXv637PeHYy3D1gfYhTgYFTi4U2YmhUixJpYVlyZe4jRFGjDRGYp0eR8YHzklcQb GpsZWZiamBobmVuaKYnzKkr9DBYSSE8sSc1OTS1ILYovKs1JLT7EyMTBKdXAuGuh9TTRPpbZ Yu8YWlVuCXF/+1glajfx8zEG08CfbY+jWgPWcuhFLdHeyj4t01tkDutyAw4250+XnzKs2vaM s1L5fOGtivj+2Ae+b1tjvipPO/bVxTDejPfWuob3ry91CLKemNI2fX9eeka1Xu/bhEk5BRw/ 6kUPiJr2luTN7qpcdWlXiKCYEktxRqKhFnNRcSIAvihtBFcCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeLIzCtJLcpLzFFi42I5/e+xgK5panaIwY1pZha9504yWVz5+p7N YtL9CSwWM87vY3Jg8dj+7QGrx/3u40wefVtWMXp83iQXwBLVwGiTkZqYklqkkJqXnJ+SmZdu q+QdHO8cb2pmYKhraGlhrqSQl5ibaqvk4hOg65aZA7RTSaEsMacUKBSQWFyspG+HaUJoiJuu BUxjhK5vSBBcj5EBGkhYw5ixqns+c8Es14p7e74zNjC+sepi5OSQEDCRONvYwA5hi0lcuLee rYuRi0NIYBGjRP+suywQTjeTxKaZ/xlBqtgEVCUmrrjPBmKLCChL/J24CizOLBAlsfzwUrBJ wgL+EssO3mMGsVmA6vs/z2UBsXkFXCQe3ugDqucA2qYgMWeSDYjJKeAq0fuTDcQUAqr4f1Vy AiPvAkaGVYyiqQXJBcVJ6blGesWJucWleel6yfm5mxjBkfFMegfjqgaLQ4wCHIxKPLyJU7NC hFgTy4orcw8xSnAwK4nwnusGCvGmJFZWpRblxxeV5qQWH2I0BTppIrOUaHI+MGrzSuINjU3M jCyNzA0tjIzNlcR5D7ZaBwoJpCeWpGanphakFsH0MXFwSjUwmofdE3VOCg3UiJNJaN2XXtid 0h7CONli6e39PH/s9qzes6/90x+eoG9/bu1ZLyqt8jtnVYWZsP8asaXx9oar7P4YLn9gqxAd JVz89KTKwq3BTtOOTjMoljyiUFgZEXd8TvwU60v+YoZMsT6lcevPeRvlb+Grnb1JbceCu0sO h6ay5soaG/cpsRRnJBpqMRcVJwIAjaHssKICAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch makes kms drivers to be independent modules. For this, it removes all register codes to kms drivers from exynos_drm_drv module and adds module_init/exit for each kms driver so that each kms driver can be called independently. Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/Kconfig | 8 +++--- drivers/gpu/drm/exynos/exynos_dp_core.c | 13 +++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.c | 43 +++--------------------------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 5 ---- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 13 +++++++++ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 13 +++++++++ drivers/gpu/drm/exynos/exynos_hdmi.c | 13 +++++++++ drivers/gpu/drm/exynos/exynos_mixer.c | 13 +++++++++ 8 files changed, 72 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 7f9f6f9..3d5fa69 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -25,7 +25,7 @@ config DRM_EXYNOS_DMABUF Choose this option if you want to use DMABUF feature for DRM. config DRM_EXYNOS_FIMD - bool "Exynos DRM FIMD" + tristate "Exynos DRM FIMD" depends on DRM_EXYNOS && !FB_S3C select FB_MODE_HELPERS select MFD_SYSCON @@ -41,7 +41,7 @@ config DRM_EXYNOS_DPI This enables support for Exynos parallel output. config DRM_EXYNOS_DSI - bool "EXYNOS DRM MIPI-DSI driver support" + tristate "EXYNOS DRM MIPI-DSI driver support" depends on DRM_EXYNOS_FIMD select DRM_MIPI_DSI select DRM_PANEL @@ -50,7 +50,7 @@ config DRM_EXYNOS_DSI This enables support for Exynos MIPI-DSI device. config DRM_EXYNOS_DP - bool "EXYNOS DRM DP driver support" + tristate "EXYNOS DRM DP driver support" depends on DRM_EXYNOS_FIMD && ARCH_EXYNOS && (DRM_PTN3460=n || DRM_PTN3460=y || DRM_PTN3460=DRM_EXYNOS) default DRM_EXYNOS select DRM_PANEL @@ -58,7 +58,7 @@ config DRM_EXYNOS_DP This enables support for DP device. config DRM_EXYNOS_HDMI - bool "Exynos DRM HDMI" + tristate "Exynos DRM HDMI" depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_TV help Choose this option if you want to use Exynos HDMI for DRM. diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index ed818b9..b08d97b 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -1408,6 +1408,19 @@ struct platform_driver dp_driver = { }, }; +static int exynos_dp_init(void) +{ + return platform_driver_register(&dp_driver); +} + +static void exynos_dp_exit(void) +{ + platform_driver_unregister(&dp_driver); +} + +module_init(exynos_dp_init); +module_exit(exynos_dp_exit); + MODULE_AUTHOR("Jingoo Han "); MODULE_DESCRIPTION("Samsung SoC DP Driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index eab12f0..02d4772 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -484,12 +484,6 @@ static struct component_match *exynos_drm_match_add(struct device *dev) mutex_lock(&drm_component_lock); - /* Do not retry to probe if there is no any kms driver regitered. */ - if (list_empty(&drm_component_list)) { - mutex_unlock(&drm_component_lock); - return ERR_PTR(-ENODEV); - } - list_for_each_entry(cdev, &drm_component_list, list) { /* * Add components to master only in case that crtc and @@ -545,22 +539,6 @@ static const struct component_master_ops exynos_drm_ops = { .unbind = exynos_drm_unbind, }; -static struct platform_driver *const exynos_drm_kms_drivers[] = { -#ifdef CONFIG_DRM_EXYNOS_FIMD - &fimd_driver, -#endif -#ifdef CONFIG_DRM_EXYNOS_DP - &dp_driver, -#endif -#ifdef CONFIG_DRM_EXYNOS_DSI - &dsi_driver, -#endif -#ifdef CONFIG_DRM_EXYNOS_HDMI - &mixer_driver, - &hdmi_driver, -#endif -}; - static struct platform_driver *const exynos_drm_non_kms_drivers[] = { #ifdef CONFIG_DRM_EXYNOS_G2D &g2d_driver, @@ -587,22 +565,14 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls); - for (i = 0; i < ARRAY_SIZE(exynos_drm_kms_drivers); ++i) { - ret = platform_driver_register(exynos_drm_kms_drivers[i]); - if (ret < 0) - goto err_unregister_kms_drivers; - } - match = exynos_drm_match_add(&pdev->dev); - if (IS_ERR(match)) { - ret = PTR_ERR(match); - goto err_unregister_kms_drivers; - } + if (IS_ERR(match)) + return PTR_ERR(match); ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops, match); if (ret < 0) - goto err_unregister_kms_drivers; + return ret; for (j = 0; j < ARRAY_SIZE(exynos_drm_non_kms_drivers); ++j) { ret = platform_driver_register(exynos_drm_non_kms_drivers[j]); @@ -632,10 +602,6 @@ err_unregister_non_kms_drivers: err_del_component_master: component_master_del(&pdev->dev, &exynos_drm_ops); -err_unregister_kms_drivers: - while (--i >= 0) - platform_driver_unregister(exynos_drm_kms_drivers[i]); - return ret; } @@ -654,9 +620,6 @@ static int exynos_drm_platform_remove(struct platform_device *pdev) component_master_del(&pdev->dev, &exynos_drm_ops); - for (i = ARRAY_SIZE(exynos_drm_kms_drivers) - 1; i >= 0; --i) - platform_driver_unregister(exynos_drm_kms_drivers[i]); - return 0; } diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 262a459..352a9f9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -331,11 +331,6 @@ int exynos_drm_component_add(struct device *dev, void exynos_drm_component_del(struct device *dev, enum exynos_drm_device_type dev_type); -extern struct platform_driver fimd_driver; -extern struct platform_driver dp_driver; -extern struct platform_driver dsi_driver; -extern struct platform_driver mixer_driver; -extern struct platform_driver hdmi_driver; extern struct platform_driver exynos_drm_common_hdmi_driver; extern struct platform_driver vidi_driver; extern struct platform_driver g2d_driver; diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 66d427e..ebc3383 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1799,6 +1799,19 @@ struct platform_driver dsi_driver = { }, }; +static int exynos_dsi_driver_init(void) +{ + return platform_driver_register(&dsi_driver); +} + +static void exynos_dsi_driver_exit(void) +{ + platform_driver_unregister(&dsi_driver); +} + +module_init(exynos_dsi_driver_init); +module_exit(exynos_dsi_driver_exit); + MODULE_AUTHOR("Tomasz Figa "); MODULE_AUTHOR("Andrzej Hajda "); MODULE_DESCRIPTION("Samsung SoC MIPI DSI Master"); diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 0673a39..eed51c6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -1240,3 +1240,16 @@ struct platform_driver fimd_driver = { .of_match_table = fimd_driver_dt_match, }, }; + +static int exynos_drm_fimd_init(void) +{ + return platform_driver_register(&fimd_driver); +} + +static void exynos_drm_fimd_exit(void) +{ + platform_driver_unregister(&fimd_driver); +} + +module_init(exynos_drm_fimd_init); +module_exit(exynos_drm_fimd_exit); diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 563a19e..83198f7 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2537,3 +2537,16 @@ struct platform_driver hdmi_driver = { .of_match_table = hdmi_match_types, }, }; + +static int hdmi_init(void) +{ + return platform_driver_register(&hdmi_driver); +} + +static void hdmi_exit(void) +{ + platform_driver_unregister(&hdmi_driver); +} + +module_init(hdmi_init); +module_exit(hdmi_exit); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index a41c84e..4d812f1 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1349,3 +1349,16 @@ struct platform_driver mixer_driver = { .remove = mixer_remove, .id_table = mixer_driver_types, }; + +static int mixer_init(void) +{ + return platform_driver_register(&mixer_driver); +} + +static void mixer_exit(void) +{ + platform_driver_unregister(&mixer_driver); +} + +module_init(mixer_init); +module_exit(mixer_exit);