From patchwork Thu Oct 4 15:42:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1545111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id A12B9DF6DA for ; Thu, 4 Oct 2012 07:27:36 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TJfoN-0003Hy-UL; Thu, 04 Oct 2012 07:25:36 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TJfnZ-00035B-KA for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2012 07:24:47 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBC00LFOXWSZVQ0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2012 16:24:41 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 34.A5.03783.9B93D605; Thu, 04 Oct 2012 16:24:41 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-98-506d39b92ced Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 23.A5.03783.9B93D605; Thu, 04 Oct 2012 16:24:41 +0900 (KST) Received: from localhost.localdomain ([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 <0MBC006I9XWMLU10@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2012 16:24:41 +0900 (KST) From: Rahul Sharma To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Subject: [PATCH v1 04/14] drm: exynos: hdmi: use s5p-hdmi platform data Date: Thu, 04 Oct 2012 21:12:42 +0530 Message-id: <1349365372-21417-5-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1349365372-21417-1-git-send-email-rahul.sharma@samsung.com> References: <1349365372-21417-1-git-send-email-rahul.sharma@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkTnenZW6Awdt1shabHl9jdWD02Lyk PoAxissmJTUnsyy1SN8ugSvjUt8jtoLPOhUnd01ibWDsU+1i5OSQEDCRWNN7mB3CFpO4cG89 WxcjF4eQwFJGiVMLtrHAFL39sJYdIjGdUeLG/0YoZwOTxJ22VkaQKjYBXYnZB5+B2SICrhJb t9wEs5kFkiS+/5zEBGILC7hLTJm9hxXEZhFQlXi/aQLYBl4BD4nbE2cwQWxTkGhddghoAQcH p4CnxJGfiSBhIaCSSR86oFoFJL5NPsQCUiIhICux6QAzyDkSApfZJF5ffQj1jaTEwRU3WCYw Ci9gZFjFKJpakFxQnJSea6hXnJhbXJqXrpecn7uJERiCp/89k9rBuLLB4hCjAAejEg+vYXdO gBBrYllxZe4hRgkOZiUR3s2KuQFCvCmJlVWpRfnxRaU5qcWHGH2ALpnILCWanA+Mj7ySeENj E3NTY1NLIyMzU1McwkrivM0eKQFCAumJJanZqakFqUUw45g4OKUaGJNufX+y0VtP7NA/G5vP L7MNmM40pC+quPnVZMmXnFveU85Z8bNdP77+a3yreLeO41fDNA/psrRDSnvz7+1e9SHyNrvc tS+fan7/eLtxxhMW0705HMpKTumnjnkvqWi7xcW/vuKI+cQrb7drWlz+7JUttHBXfFZnp5Hn laltZzO8578UWfXCZqoSS3FGoqEWc1FxIgAcdlhfbgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42I5/e+xoO5Oy9wAgws7+Sw2Pb7G6sDosXlJ fQBjVAOjTUZqYkpqkUJqXnJ+SmZeuq2Sd3C8c7ypmYGhrqGlhbmSQl5ibqqtkotPgK5bZg7Q VCWFssScUqBQQGJxsZK+HaYJoSFuuhYwjRG6viFBcD1GBmggYQ1jxqW+R2wFn3UqTu6axNrA 2KfaxcjJISFgIvH2w1p2CFtM4sK99WxdjFwcQgLTGSVu/G9kh3A2MEncaWtlBKliE9CVmH3w GZgtIuAqsXXLTTCbWSBJ4vvPSUwgtrCAu8SU2XtYQWwWAVWJ95smsIDYvAIeErcnzmCC2KYg 0brsENACDg5OAU+JIz8TQcJCQCWTPnSwTmDkXcDIsIpRNLUguaA4KT3XUK84Mbe4NC9dLzk/ dxMjOMCfSe1gXNlgcYhRgINRiYfXsDsnQIg1say4MvcQowQHs5II72bF3AAh3pTEyqrUovz4 otKc1OJDjD5AR01klhJNzgdGX15JvKGxibmpsamliYWJmSUOYSVx3maPlAAhgfTEktTs1NSC 1CKYcUwcnFINjM3lUSxz/5audTNV8znKc1xZX+Jxe2NU0+mCUu5HMvw2f5c9VRZ98ackLXpW yQ7Rq6mc4drRPj9MP/84o75Pyp/vt+0j5evi/+WWGSq+afN5Fpcwu+KQS9/aPj/m91OuVCcd bJv+8HvO843SbpsWVU/4cNd7xflHWzPVT+1tnPazwHHFLLktYUosxRmJhlrMRcWJAJzbhCCd AgAA X-CFilter-Loop: Reflected X-Spam-Note: CRM114 invocation failed X-Spam-Score: -7.1 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.9 DATE_IN_FUTURE_06_12 Date: is 6 to 12 hours after Received: date -2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: t.stanislaws@samsung.com, inki.dae@samsung.com, kyungmin.park@samsung.com, joshi@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tomasz Stanislawski The 'exynos-drm-hdmi' driver makes use of s5p-tv platform devices. Therefore the driver should use the same platform data to prevent crashes caused by dereferencing incorrect types. This patch corrects the exynos-drm-hdmi driver to the platform data from s5p-hdmi. Signed-off-by: Tomasz Stanislawski Signed-off-by: Joonyoung Shim Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_hdmi.c | 55 +++++++++++++++------------------- 1 files changed, 24 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 3902917..90dce8c 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -40,6 +40,9 @@ #include "exynos_hdmi.h" +#include +#include + #define MAX_WIDTH 1920 #define MAX_HEIGHT 1080 #define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) @@ -76,8 +79,7 @@ struct hdmi_context { struct hdmi_resources res; void *parent_ctx; - void (*cfg_hpd)(bool external); - int (*get_hpd)(void); + int hpd_gpio; }; /* HDMI Version 1.3 */ @@ -2024,8 +2026,6 @@ static void hdmi_poweron(struct hdmi_context *hdata) hdata->powered = true; - if (hdata->cfg_hpd) - hdata->cfg_hpd(true); mutex_unlock(&hdata->hdmi_mutex); pm_runtime_get_sync(hdata->dev); @@ -2061,8 +2061,6 @@ static void hdmi_poweroff(struct hdmi_context *hdata) pm_runtime_put_sync(hdata->dev); mutex_lock(&hdata->hdmi_mutex); - if (hdata->cfg_hpd) - hdata->cfg_hpd(false); hdata->powered = false; @@ -2110,17 +2108,13 @@ static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) struct exynos_drm_hdmi_context *ctx = arg; struct hdmi_context *hdata = ctx->ctx; - if (!hdata->get_hpd) - goto out; - mutex_lock(&hdata->hdmi_mutex); - hdata->hpd = hdata->get_hpd(); + hdata->hpd = gpio_get_value(hdata->hpd_gpio); mutex_unlock(&hdata->hdmi_mutex); if (ctx->drm_dev) drm_helper_hpd_irq_event(ctx->drm_dev); -out: return IRQ_HANDLED; } @@ -2143,18 +2137,9 @@ static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) HDMI_INTC_FLAG_HPD_PLUG); } - mutex_lock(&hdata->hdmi_mutex); - hdata->hpd = hdmi_reg_read(hdata, HDMI_HPD_STATUS); - if (hdata->powered && hdata->hpd) { - mutex_unlock(&hdata->hdmi_mutex); - goto out; - } - mutex_unlock(&hdata->hdmi_mutex); - if (ctx->drm_dev) drm_helper_hpd_irq_event(ctx->drm_dev); -out: return IRQ_HANDLED; } @@ -2287,7 +2272,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct exynos_drm_hdmi_context *drm_hdmi_ctx; struct hdmi_context *hdata; - struct exynos_drm_hdmi_pdata *pdata; + struct s5p_hdmi_platform_data *pdata; struct resource *res; int ret; enum hdmi_type hdmi_type; @@ -2323,8 +2308,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) hdmi_type = platform_get_device_id(pdev)->driver_data; hdata->is_v13 = (hdmi_type == HDMI_TYPE13); - hdata->cfg_hpd = pdata->cfg_hpd; - hdata->get_hpd = pdata->get_hpd; + hdata->hpd_gpio = pdata->hpd_gpio; hdata->dev = dev; ret = hdmi_resources_init(hdata); @@ -2342,11 +2326,17 @@ static int __devinit hdmi_probe(struct platform_device *pdev) goto err_resource; } + ret = gpio_request(hdata->hpd_gpio, "HPD"); + if (ret) { + DRM_ERROR("failed to request HPD gpio\n"); + goto err_resource; + } + /* DDC i2c driver */ if (i2c_add_driver(&ddc_driver)) { DRM_ERROR("failed to register ddc i2c driver\n"); ret = -ENOENT; - goto err_resource; + goto err_gpio; } hdata->ddc_port = hdmi_ddc; @@ -2360,32 +2350,31 @@ static int __devinit hdmi_probe(struct platform_device *pdev) hdata->hdmiphy_port = hdmi_hdmiphy; - hdata->external_irq = platform_get_irq_byname(pdev, "external_irq"); + hdata->external_irq = gpio_to_irq(hdata->hpd_gpio); if (hdata->external_irq < 0) { - DRM_ERROR("failed to get platform irq\n"); + DRM_ERROR("failed to get GPIO external irq\n"); ret = hdata->external_irq; goto err_hdmiphy; } - hdata->internal_irq = platform_get_irq_byname(pdev, "internal_irq"); + hdata->internal_irq = platform_get_irq(pdev, 0); if (hdata->internal_irq < 0) { DRM_ERROR("failed to get platform internal irq\n"); ret = hdata->internal_irq; goto err_hdmiphy; } + hdata->hpd = gpio_get_value(hdata->hpd_gpio); + ret = request_threaded_irq(hdata->external_irq, NULL, hdmi_external_irq_thread, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "hdmi_external", drm_hdmi_ctx); if (ret) { - DRM_ERROR("failed to register hdmi internal interrupt\n"); + DRM_ERROR("failed to register hdmi external interrupt\n"); goto err_hdmiphy; } - if (hdata->cfg_hpd) - hdata->cfg_hpd(false); - ret = request_threaded_irq(hdata->internal_irq, NULL, hdmi_internal_irq_thread, IRQF_ONESHOT, "hdmi_internal", drm_hdmi_ctx); @@ -2407,6 +2396,8 @@ err_hdmiphy: i2c_del_driver(&hdmiphy_driver); err_ddc: i2c_del_driver(&ddc_driver); +err_gpio: + gpio_free(hdata->hpd_gpio); err_resource: hdmi_resources_cleanup(hdata); err_data: @@ -2426,6 +2417,8 @@ static int __devexit hdmi_remove(struct platform_device *pdev) free_irq(hdata->internal_irq, hdata); free_irq(hdata->external_irq, hdata); + gpio_free(hdata->hpd_gpio); + hdmi_resources_cleanup(hdata); /* hdmiphy i2c driver */