From patchwork Wed Apr 16 14:33:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4005181 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 049619F387 for ; Thu, 17 Apr 2014 01:06:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 02840202D1 for ; Thu, 17 Apr 2014 01:06:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 12F8A202B4 for ; Thu, 17 Apr 2014 01:06:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ADDCB6EA0F; Wed, 16 Apr 2014 18:06:03 -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 D68796EA92 for ; Wed, 16 Apr 2014 07:33:47 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N44006R6OGBUL70@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 16 Apr 2014 23:33:47 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.124]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id AB.5B.10092.AC49E435; Wed, 16 Apr 2014 23:33:47 +0900 (KST) X-AuditID: cbfee68f-b7f156d00000276c-b5-534e94ca71f2 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AB.93.29263.AC49E435; Wed, 16 Apr 2014 23:33:46 +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 <0N4400B1ROFNHZ40@mmp1.samsung.com>; Wed, 16 Apr 2014 23:33:46 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls Date: Wed, 16 Apr 2014 20:03:06 +0530 Message-id: <1397658786-26138-8-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1397658786-26138-1-git-send-email-ajaykumar.rs@samsung.com> References: <1397658786-26138-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFIsWRmVeSWpSXmKPExsWyRsSkRvf0FL9gg84pbBa31p1jtVj5/i+j xYH3B1ksNrxZyGxx5et7NotJ9yewWHzf9YXd4mzTG3aLGef3MVmsOryB3WLKosOsFnMP5lrc /s3nwOsxu+Eii8fOWXfZPRZsKvW4332cyaO3+R2bR9+WVYwenzfJBbBHcdmkpOZklqUW6dsl cGV8P7mXveC/RsXTn4dZGhg/KnYxcnBICJhILN7D1MXICWSKSVy4t56ti5GLQ0hgKaNE59Zt bDA1Px/GQMQXMUqcPv4HqmgCk8Tqa30sIN1sAtoS26bfBLNFBNwkmg7PZAUpYhboZ5KYducZ I0hCWMBB4vKa/2DrWARUJU4cf8gKYvMKeEg8+tfJBLFNQWLOJBuQMKeAp8S53xfBSoSASqY2 nWMHmSkhcItd4uSH9cwQcwQkvk0+xALRKyux6QAzxDeSEgdX3GCZwCi8gJFhFaNoakFyQXFS epGxXnFibnFpXrpecn7uJkZgvJz+96x/B+PdA9aHGJOBxk1klhJ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ZXLLeczxvM1xw7gfueLMO/v0sc9mzY drDvkQl7wJyuV9O7X4lpZsXEL3o7lY3Z1/rC4j+zpt1S2qSZU6TbntV5oGvz4qgjdqeyPMIO vFiutOi36/+9O6e8FZ7etHSHQeb244pPDiixFGckGmoxFxUnAgBRYfIVCwMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Wed, 16 Apr 2014 18:06:02 -0700 Cc: seanpaul@google.com, abrestic@chromium.org, joshi@samsung.com, a.hajda@samsung.com, kyungmin.park@samsung.com, ajaynumb@gmail.com, treding@nvidia.com, prashanth.g@samsung.com, Ajay Kumar , rahul.sharma@samsung.com 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.9 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 attach ptn3460 connector to drm_panel and support drm_panel routines, if a valid drm_panel object is passed to ptn3460_init. Signed-off-by: Ajay Kumar --- drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/ptn3460.c | 17 ++++++++++++++++- drivers/gpu/drm/exynos/exynos_dp_core.c | 15 +++++++++++---- include/drm/bridge/ptn3460.h | 6 ++++-- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 884923f..3bc6845 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -2,4 +2,5 @@ config DRM_PTN3460 tristate "PTN3460 DP/LVDS bridge" depends on DRM select DRM_KMS_HELPER + select DRM_PANEL ---help--- diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c index f1d2afc..736c7a8 100644 --- a/drivers/gpu/drm/bridge/ptn3460.c +++ b/drivers/gpu/drm/bridge/ptn3460.c @@ -24,6 +24,7 @@ #include "drm_edid.h" #include "drm_crtc.h" #include "drm_crtc_helper.h" +#include #include "bridge/ptn3460.h" @@ -38,6 +39,7 @@ struct ptn3460_bridge { struct i2c_client *client; struct drm_encoder *encoder; struct drm_bridge *bridge; + struct drm_panel *panel; struct edid *edid; int gpio_pd_n; int gpio_rst_n; @@ -126,6 +128,8 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge) gpio_set_value(ptn_bridge->gpio_rst_n, 1); } + drm_panel_pre_enable(ptn_bridge->panel); + /* * There's a bug in the PTN chip where it falsely asserts hotplug before * it is fully functional. We're forced to wait for the maximum start up @@ -142,6 +146,9 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge) static void ptn3460_enable(struct drm_bridge *bridge) { + struct ptn3460_bridge *ptn_bridge = bridge->driver_private; + + drm_panel_enable(ptn_bridge->panel); } static void ptn3460_disable(struct drm_bridge *bridge) @@ -153,6 +160,8 @@ static void ptn3460_disable(struct drm_bridge *bridge) ptn_bridge->enabled = false; + drm_panel_disable(ptn_bridge->panel); + if (gpio_is_valid(ptn_bridge->gpio_rst_n)) gpio_set_value(ptn_bridge->gpio_rst_n, 1); @@ -265,7 +274,8 @@ struct drm_connector_funcs ptn3460_connector_funcs = { }; int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, - struct i2c_client *client, struct device_node *node) + struct i2c_client *client, struct device_node *node, + struct drm_panel *panel) { int ret; struct drm_bridge *bridge; @@ -324,6 +334,11 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, goto err; } + if (panel) { + ptn_bridge->panel = panel; + drm_panel_attach(ptn_bridge->panel, &ptn_bridge->connector); + } + bridge->driver_private = ptn_bridge; encoder->bridge = bridge; ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD; diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 6beeab6..7f550b6 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -989,13 +989,14 @@ static bool find_bridge(const char *compat, struct bridge_init *bridge) /* returns the number of bridges attached */ static int exynos_drm_attach_lcd_bridge(struct drm_device *dev, - struct drm_encoder *encoder) + struct drm_encoder *encoder, struct drm_panel *panel) { struct bridge_init bridge; int ret; if (find_bridge("nxp,ptn3460", &bridge)) { - ret = ptn3460_init(dev, encoder, bridge.client, bridge.node); + ret = ptn3460_init(dev, encoder, bridge.client, bridge.node, + panel); if (!ret) return 1; } @@ -1012,9 +1013,15 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display, dp->encoder = encoder; /* Pre-empt DP connector creation if there's a bridge */ - ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder); - if (ret) + ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder, dp->drm_panel); + if (ret) { + /* Also set "dp->drm_panel = NULL" so that we don't end up + * controlling panel power both in exynos_dp and bridge + * DPMS routines. + */ + dp->drm_panel = NULL; return 0; + } connector->polled = DRM_CONNECTOR_POLL_HPD; diff --git a/include/drm/bridge/ptn3460.h b/include/drm/bridge/ptn3460.h index ff62344..570cebb 100644 --- a/include/drm/bridge/ptn3460.h +++ b/include/drm/bridge/ptn3460.h @@ -18,16 +18,18 @@ struct drm_device; struct drm_encoder; struct i2c_client; struct device_node; +struct drm_panel; #if defined(CONFIG_DRM_PTN3460) || defined(CONFIG_DRM_PTN3460_MODULE) int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, - struct i2c_client *client, struct device_node *node); + struct i2c_client *client, struct device_node *node, + struct drm_panel *panel); #else static inline int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, struct i2c_client *client, - struct device_node *node) + struct device_node *node, struct drm_panel *panel) { return 0; }