From patchwork Thu Jul 17 20:43:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4578791 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 1E383C0514 for ; Thu, 17 Jul 2014 20:47:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B96920160 for ; Thu, 17 Jul 2014 20:47:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 099AF2011E for ; Thu, 17 Jul 2014 20:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752849AbaGQUrD (ORCPT ); Thu, 17 Jul 2014 16:47:03 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:33622 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752334AbaGQUrB (ORCPT ); Thu, 17 Jul 2014 16:47:01 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8V00BHRJ2CZW70@mailout3.samsung.com> for linux-samsung-soc@vger.kernel.org; Fri, 18 Jul 2014 05:47:00 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id E0.D7.19452.44638C35; Fri, 18 Jul 2014 05:47:00 +0900 (KST) X-AuditID: cbfee68e-b7fb96d000004bfc-34-53c836449ab3 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 5B.C6.05196.34638C35; Fri, 18 Jul 2014 05:47:00 +0900 (KST) Received: from chromebld-server.sisodomain.com ([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 <0N8V002BCJ1T7D60@mmp1.samsung.com>; Fri, 18 Jul 2014 05:46:59 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: inki.dae@samsung.com, robdclark@gmail.com, daniel.vetter@ffwll.ch, thierry.reding@gmail.com, seanpaul@google.com, ajaynumb@gmail.com, jg1.han@samsung.com, joshi@samsung.com, prashanth.g@samsung.com, javier@dowhile0.org, Ajay Kumar Subject: [RESEND PATCH V5 03/12] drm/exynos: dp: modify driver to support drm_panel Date: Fri, 18 Jul 2014 02:13:49 +0530 Message-id: <1405629839-12086-4-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1405629839-12086-1-git-send-email-ajaykumar.rs@samsung.com> References: <1405629839-12086-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprLIsWRmVeSWpSXmKPExsWyRsSkWtfF7ESwQesMAYsD7w+yWGx4s5DZ YuHDu8wWV76+Z7OYdH8Ci8W13zPYLC4vvMRq8X3XF3aLGef3MVmsOryB3eL5wh/MFnMP5lr8 3DWPxYHX4+/sVmaPvd8WsHjsnHWX3WPBplKP+93HmTz6tqxi9Pi8SS6APYrLJiU1J7MstUjf LoEro33/RPaCT3oV7ev72RsYW9S7GDk5JARMJA7+28AIYYtJXLi3nq2LkYtDSGApo8SFu6dZ YIoOLD0BlVjEKNF86R2UM4FJ4v6ZzcwgVWwC2hLbpt8E6xARcJNoOjyTFaSIWaCbSWLfvbNg CWGBUImVSy6CNbAIqEr0PFjODmLzCnhIrOg4BRTnAFqnIDFnkg1ImFPAU2Jm5w+wViGgkp+7 vz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bmJsam1qaWJiYWSqJ8x5stQ4UEkhPLEnNTk0tSC2C6WPi4JRqYFwruP4zo932 LqGXWe/9TPxUksv25N+WSXDrNEjN0K1t8OULSFCd9WV3yM7vu5z+vlyo+q1oUcVE9ogJok3X lGyf/WS5NGlp6kkNCd6WG+2PU3Mn9d1y/aN/64j/2wt7ekVfCkRNd1plvc9qg72HwN650QtT O2ffeL458or9xW9LnBdn90m/OqDEUpyRaKjFXFScCABdVnM93wIAAA== 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, 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 a94b114..b3d0d9b 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_connector_register(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;