From patchwork Wed Sep 12 12:08:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1444041 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id E01F3DF28C for ; Wed, 12 Sep 2012 13:38:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E05079E923 for ; Wed, 12 Sep 2012 06:38:48 -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 BF61D9E762 for ; Wed, 12 Sep 2012 00:16:37 -0700 (PDT) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MA800CAW6DOWNK0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 12 Sep 2012 16:06:36 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.116]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E5.45.31452.C7430505; Wed, 12 Sep 2012 16:06:36 +0900 (KST) X-AuditID: cbfee61b-b7f586d000007adc-d2-5050347c5cad Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B2.45.31452.B7430505; Wed, 12 Sep 2012 16:06:36 +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 <0MA8008HH6AD6W40@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 12 Sep 2012 16:06:35 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm: exynos: hdmi: clean dependency on plf data for mixer, hdmi context Date: Wed, 12 Sep 2012 17:38:47 +0530 Message-id: <1347451727-13386-4-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1347451727-13386-1-git-send-email-rahul.sharma@samsung.com> References: <1347451727-13386-1-git-send-email-rahul.sharma@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkRLfGJCDAoPGcnMWVr+/ZHBg97ncf ZwpgjOKySUnNySxLLdK3S+DKWH69uuCXSsXx+5vYGhib5LsYOTkkBEwkFj16wQ5hi0lcuLee rYuRi0NIYCmjxIFre1hgim5d/sYEkZjOKPFuziFWCGc1k8Spt+tYQarYBHQlZh98xghiiwgo S/yduIoRpIhZoINJoqNhKtAODg5hgTiJL29CQGpYBFQlVv2+zQRi8wp4SMw90wy1TUGiddkh sJM4BTwl7r2CmCkEVHOldQETRK+AxLfJh1hARkoIyEpsOsAM0XqZTeLmvhIIW1Li4IobLBMY hRcwMqxiFE0tSC4oTkrPNdIrTswtLs1L10vOz93ECAzB0/+eSe9gXNVgcYhRgINRiYc3MdM/ QIg1say4MvcQowQHs5II7wbdgAAh3pTEyqrUovz4otKc1OJDjD5Ah0xklhJNzgfGR15JvKGx sYmZiamFmZGZkQkOYSVxXqdzdgFCAumJJanZqakFqUUw45g4OKUaGK1eals/evXv4IWeqBVb Hp8u0OE+uz7jufuP8zM1VH4EhJtL6tw8t7J168Nn4X4XvvHwJU8vb+kscUnbcmLBpYiOMCWD UI+Pd3/v2zPn7qXgCPMP7Hr/thm17tkSsUwhluVHU9zNlleXS9fwqood79dau6akZAYnf7yx Xx+juZ73nPm3km+s3qzEUpyRaKjFXFScCACSxFZwbgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xoG6NSUCAQfNBJosrX9+zOTB63O8+ zhTAGNXAaJORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+TiE6DrlpkD NFZJoSwxpxQoFJBYXKykb4dpQmiIm64FTGOErm9IEFyPkQEaSFjDmLH8enXBL5WK4/c3sTUw Nsl3MXJySAiYSNy6/I0JwhaTuHBvPVsXIxeHkMB0Rol3cw6xQjirmSROvV3HClLFJqArMfvg M0YQW0RAWeLvxFWMIEXMAh1MEh0NU9m7GDk4hAXiJL68CQGpYRFQlVj1+zbYBl4BD4m5Z5pZ ILYpSLQuO8QOYnMKeErcewUxUwio5krrAqYJjLwLGBlWMYqmFiQXFCel5xrpFSfmFpfmpesl 5+duYgSH+DPpHYyrGiwOMQpwMCrx8CZm+gcIsSaWFVfmHmKU4GBWEuHdoBsQIMSbklhZlVqU H19UmpNafIjRB+iqicxSosn5wPjLK4k3NDYxM7I0Mje0MDI2xyGsJM7rdM4uQEggPbEkNTs1 tSC1CGYcEwenVANjpv6Om+V2y140aAqZ32EoP5ii9dot0tc9q3uxjIClXGancb5kK1Oe8AWt 7VrePd4axT9L437y7RTw635yyFDLe+1SHf/iy7xcmxRXNqtZTtfinh3qtCXg+tpHwTIMK/PM YosNupcFvuvaX84wbfeVlZdkvwa/Ms5njV/8screzipTzl0+UYmlOCPRUIu5qDgRAGevyGCe AgAA X-CFilter-Loop: Reflected X-Mailman-Approved-At: Wed, 12 Sep 2012 06:35:13 -0700 Cc: l.krishna@samsung.com, joshi@samsung.com, kyungmin.park@samsung.com, fahad.k@samsung.com, rahul.sharma@samsung.com, prashanth.g@samsung.com, s.shirish@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org exynos-drm-hdmi need context pointers from hdmi and mixer. These pointers were expected from the plf data. Cleaned this dependency by exporting i/f which are called by hdmi, mixer driver probes for setting their context. Signed-off-by: Rahul Sharma --- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 47 +++++++++++++++-------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 2 + drivers/gpu/drm/exynos/exynos_hdmi.c | 3 ++ drivers/gpu/drm/exynos/exynos_mixer.c | 3 ++ 4 files changed, 32 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 0584132..4c8d933 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -29,6 +29,11 @@ #define get_ctx_from_subdrv(subdrv) container_of(subdrv,\ struct drm_hdmi_context, subdrv); +/* Common hdmi subdrv needs to access the hdmi and mixer though context. +* These should be initialied by the repective drivers */ +static struct exynos_drm_hdmi_context *hdmi_ctx; +static struct exynos_drm_hdmi_context *mixer_ctx; + /* these callback points shoud be set by specific drivers. */ static struct exynos_hdmi_ops *hdmi_ops; static struct exynos_mixer_ops *mixer_ops; @@ -41,6 +46,18 @@ struct drm_hdmi_context { bool enabled[MIXER_WIN_NR]; }; +void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx) +{ + if (ctx) + hdmi_ctx = ctx; +} + +void exynos_mixer_drv_attach(struct exynos_drm_hdmi_context *ctx) +{ + if (ctx) + mixer_ctx = ctx; +} + void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops) { DRM_DEBUG_KMS("%s\n", __FILE__); @@ -303,46 +320,30 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev, { struct exynos_drm_subdrv *subdrv = to_subdrv(dev); struct drm_hdmi_context *ctx; - struct platform_device *pdev = to_platform_device(dev); - struct exynos_drm_common_hdmi_pd *pd; DRM_DEBUG_KMS("%s\n", __FILE__); - pd = pdev->dev.platform_data; - - if (!pd) { - DRM_DEBUG_KMS("platform data is null.\n"); - return -EFAULT; - } - - if (!pd->hdmi_dev) { + if (!hdmi_ctx) { DRM_DEBUG_KMS("hdmi device is null.\n"); return -EFAULT; } - if (!pd->mixer_dev) { + if (!mixer_ctx) { DRM_DEBUG_KMS("mixer device is null.\n"); return -EFAULT; } ctx = get_ctx_from_subdrv(subdrv); - ctx->hdmi_ctx = (struct exynos_drm_hdmi_context *) - to_context(pd->hdmi_dev); - if (!ctx->hdmi_ctx) { - DRM_DEBUG_KMS("hdmi context is null.\n"); + if (!ctx) { + DRM_DEBUG_KMS("context is null.\n"); return -EFAULT; } - ctx->hdmi_ctx->drm_dev = drm_dev; - - ctx->mixer_ctx = (struct exynos_drm_hdmi_context *) - to_context(pd->mixer_dev); - if (!ctx->mixer_ctx) { - DRM_DEBUG_KMS("mixer context is null.\n"); - return -EFAULT; - } + ctx->hdmi_ctx = hdmi_ctx; + ctx->mixer_ctx = mixer_ctx; + ctx->hdmi_ctx->drm_dev = drm_dev; ctx->mixer_ctx->drm_dev = drm_dev; return 0; diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index d9f9e9f..2da5ffd 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -73,6 +73,8 @@ struct exynos_mixer_ops { void (*win_disable)(void *ctx, int zpos); }; +void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx); +void exynos_mixer_drv_attach(struct exynos_drm_hdmi_context *ctx); void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops); void exynos_mixer_ops_register(struct exynos_mixer_ops *ops); #endif diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 5236256..82ee810 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2599,6 +2599,9 @@ static int __devinit hdmi_probe(struct platform_device *pdev) drm_hdmi_ctx = platform_get_drvdata(pdev); + /* Attach HDMI Driver to common hdmi. */ + exynos_hdmi_drv_attach(drm_hdmi_ctx); + /* register specific callbacks to common hdmi. */ exynos_hdmi_ops_register(&hdmi_ops); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 7d04a40..f9e26f2 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1165,6 +1165,9 @@ static int __devinit mixer_probe(struct platform_device *pdev) if (ret) goto fail; + /* attach mixer driver to common hdmi. */ + exynos_mixer_drv_attach(drm_hdmi_ctx); + /* register specific callback point to common hdmi. */ exynos_mixer_ops_register(&mixer_ops);