From patchwork Wed Jun 11 18:27:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4338901 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A688F9F314 for ; Thu, 12 Jun 2014 00:23:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B991B20320 for ; Thu, 12 Jun 2014 00:23:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B751220340 for ; Thu, 12 Jun 2014 00:23:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 47DCD6E8CD; Wed, 11 Jun 2014 17:23:26 -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 E51306E897 for ; Wed, 11 Jun 2014 11:29:11 -0700 (PDT) Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N7000MI5OOMXZ80@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 12 Jun 2014 03:29:10 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 4A.A4.13369.6FF98935; Thu, 12 Jun 2014 03:29:10 +0900 (KST) X-AuditID: cbfee690-b7fb56d000003439-72-53989ff65e0b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 0F.FA.07139.6FF98935; Thu, 12 Jun 2014 03:29:10 +0900 (KST) Received: from chromebld-server.sisodomain.com ([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 <0N70000F9OO6ED50@mmp2.samsung.com>; Thu, 12 Jun 2014 03:29:10 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH V4 03/10] drm/exynos: dp: modify driver to support drm_panel Date: Wed, 11 Jun 2014 23:57:01 +0530 Message-id: <1402511228-18945-4-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1402511228-18945-1-git-send-email-ajaykumar.rs@samsung.com> References: <1402511228-18945-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOIsWRmVeSWpSXmKPExsWyRsSkTvfb/BnBBm/36FgceH+QxWLDm4XM Fgsf3mW2mH/kHKvFla/v2Swm3Z/AYvF91xd2ixnn9zFZzDv0m9Fi1eEN7BbPF/5gtph7MNfi 5655LA68HrMbLrJ47P22gMVj56y77B4LNpV63O8+zuTRt2UVo8fnTXIB7FFcNimpOZllqUX6 dglcGbvucxR81qvYdD65gbFVvYuRk0NCwESi4d8uFghbTOLCvfVsILaQwFJGiScHDWBqdl5b z9jFyAUUn84oseZUPzOEM4FJYu2cVWDdbALaEtum3wSyOThEBFIknv/lA6lhFvjOKLH98ENm kLiwgI/Eg24BkHIWAVWJNy8XsILYvAIeEks+/2MCKZEQUJCYM8kGxOQU8JTYvTsQ4hwPib/z GlhAJkoIXGOXWHhtNSPEGAGJb5MPsUC0ykpsOsAMcbKkxMEVN1gmMAovYGRYxSiaWpBcUJyU XmSiV5yYW1yal66XnJ+7iREYKaf/PZuwg/HeAetDjMlA4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DZ6yF1RjnG8ancnP5bJS3/NAt77xgWXs iaDuRO3u1IKtgvfX7HxxS/Dd/kzpmTklt7Vkj8+Z9G1za2P2Ibv5+iJh1xwamT2Mlzk6zW33 jL0vfHC+PNMztjnvtn40v54ntOux/wIlluKMREMt5qLiRACId3aeCAMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Wed, 11 Jun 2014 17:23:23 -0700 Cc: seanpaul@google.com, daniel.vetter@ffwll.ch, joshi@samsung.com, ajaynumb@gmail.com, marcheu@chromium.org, prashanth.g@samsung.com, Ajay Kumar X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Add drm_panel controls to support powerup/down of the eDP panel, if one is present at the sink side. Signed-off-by: Ajay Kumar --- .../devicetree/bindings/video/exynos_dp.txt | 2 + drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 45 ++++++++++++++++---- drivers/gpu/drm/exynos/exynos_dp_core.h | 2 + 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt b/Documentation/devicetree/bindings/video/exynos_dp.txt index 53dbccf..c029a09 100644 --- a/Documentation/devicetree/bindings/video/exynos_dp.txt +++ b/Documentation/devicetree/bindings/video/exynos_dp.txt @@ -51,6 +51,8 @@ Required properties for dp-controller: LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4 - display-timings: timings for the connected panel as described by Documentation/devicetree/bindings/video/display-timing.txt + -edp-panel: + phandle for the edp/lvds drm_panel node. Optional properties for dp-controller: -interlaced: diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 178d2a9..fd1c070 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -52,6 +52,7 @@ config DRM_EXYNOS_DP bool "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 help This enables support for DP device. diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 96b4e82..aca739d 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "exynos_drm_drv.h" @@ -1029,6 +1030,9 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display, drm_sysfs_connector_add(connector); drm_mode_connector_attach_encoder(connector, encoder); + if (dp->edp_panel) + drm_panel_attach(dp->edp_panel, &dp->connector); + return 0; } @@ -1063,11 +1067,13 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) if (dp->dpms_mode == DRM_MODE_DPMS_ON) return; + drm_panel_prepare(dp->edp_panel); clk_prepare_enable(dp->clock); exynos_dp_phy_init(dp); exynos_dp_init_dp(dp); enable_irq(dp->irq); exynos_dp_setup(dp); + drm_panel_enable(dp->edp_panel); } static void exynos_dp_poweroff(struct exynos_dp_device *dp) @@ -1075,10 +1081,12 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp) if (dp->dpms_mode != DRM_MODE_DPMS_ON) return; + drm_panel_disable(dp->edp_panel); disable_irq(dp->irq); flush_work(&dp->hotplug_work); exynos_dp_phy_exit(dp); clk_disable_unprepare(dp->clock); + drm_panel_unprepare(dp->edp_panel); } static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) @@ -1209,8 +1217,17 @@ err: static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp) { int ret; + struct device_node *videomode_parent; + + /* Receive video timing info from panel node + * if there is a panel node + */ + if (dp->panel_node) + videomode_parent = dp->panel_node; + else + videomode_parent = dp->dev->of_node; - ret = of_get_videomode(dp->dev->of_node, &dp->panel.vm, + ret = of_get_videomode(videomode_parent, &dp->panel.vm, OF_USE_NATIVE_MODE); if (ret) { DRM_ERROR("failed: of_get_videomode() : %d\n", ret); @@ -1224,16 +1241,10 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) struct platform_device *pdev = to_platform_device(dev); struct drm_device *drm_dev = data; struct resource *res; - struct exynos_dp_device *dp; + struct exynos_dp_device *dp = exynos_dp_display.ctx; unsigned int irq_flags; - int ret = 0; - dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device), - GFP_KERNEL); - if (!dp) - return -ENOMEM; - dp->dev = &pdev->dev; dp->dpms_mode = DRM_MODE_DPMS_OFF; @@ -1307,7 +1318,6 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) disable_irq(dp->irq); dp->drm_dev = drm_dev; - exynos_dp_display.ctx = dp; platform_set_drvdata(pdev, &exynos_dp_display); @@ -1334,6 +1344,8 @@ static const struct component_ops exynos_dp_ops = { static int exynos_dp_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; + struct exynos_dp_device *dp; int ret; ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR, @@ -1341,6 +1353,21 @@ static int exynos_dp_probe(struct platform_device *pdev) if (ret) return ret; + dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device), + GFP_KERNEL); + if (!dp) + return -ENOMEM; + + dp->panel_node = of_parse_phandle(dev->of_node, "edp-panel", 0); + if (dp->panel_node) { + dp->edp_panel = of_drm_find_panel(dp->panel_node); + of_node_put(dp->panel_node); + if (!dp->edp_panel) + return -EPROBE_DEFER; + } + + exynos_dp_display.ctx = dp; + ret = component_add(&pdev->dev, &exynos_dp_ops); if (ret) exynos_drm_component_del(&pdev->dev, diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h index 02cc4f9..3c29e4e 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.h +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h @@ -146,9 +146,11 @@ struct link_train { struct exynos_dp_device { struct device *dev; + struct device_node *panel_node; struct drm_device *drm_dev; struct drm_connector connector; struct drm_encoder *encoder; + struct drm_panel *edp_panel; struct clk *clock; unsigned int irq; void __iomem *reg_base;