From patchwork Fri Sep 7 09:07:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leela Krishna Amudala X-Patchwork-Id: 1419481 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 9F912DF283 for ; Fri, 7 Sep 2012 04:53:35 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9qUR-0002mH-E4; Fri, 07 Sep 2012 04:48:23 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9qUM-0002m3-LK for linux-arm-kernel@lists.infradead.org; Fri, 07 Sep 2012 04:48:20 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9Y00CPZQNSBI40@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 07 Sep 2012 13:48:16 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.116]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 02.91.31452.09C79405; Fri, 07 Sep 2012 13:48:16 +0900 (KST) X-AuditID: cbfee61b-b7f586d000007adc-2d-50497c9091c0 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 61.91.31452.F8C79405; Fri, 07 Sep 2012 13:48:15 +0900 (KST) Received: from localhost.localdomain ([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 <0M9Y003HDQN3MW30@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 07 Sep 2012 13:48:15 +0900 (KST) From: Leela Krishna Amudala To: dri-devel@lists.freedesktop.org, devicetree-discuss@lists.ozlabs.org Subject: [PATCH V5 1/2] drm/exynos: add platform_device_id table and driver data for drm fimd Date: Fri, 07 Sep 2012 14:37:37 +0530 Message-id: <1347008858-12069-2-git-send-email-l.krishna@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1347008858-12069-1-git-send-email-l.krishna@samsung.com> References: <1347008858-12069-1-git-send-email-l.krishna@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkRHdCjWeAwaTJAhabHl9jdWD02Lyk PoAxissmJTUnsyy1SN8ugSvjb9sbxoKlchULJng1MH6X6GLk5JAQMJF4v66ZGcIWk7hwbz1b FyMXh5DAUkaJCY+OMMEU/TmxlBkisYhR4vn1XihnA5PE5qfPwarYBIwl7s/dDGaLCHhIrJ4N 0cEssJNR4tOCrWA7hAXiJc5vaWcFsVkEVCVObv4PFOfg4BVwldjy2hNim4JE67JD7CA2p4Cb ROueiSwgthBQydWNvxkhWgUkvk0+xALSKiEgK7HpANgqCYHLbBLzJi1mh5gjKXFwxQ2WCYzC CxgZVjGKphYkFxQnpeca6RUn5haX5qXrJefnbmIEhuDpf8+kdzCuarA4xCjAwajEw2txxSNA iDWxrLgy9xCjBAezkgjvxF9AId6UxMqq1KL8+KLSnNTiQ4w+QJdMZJYSTc4HxkdeSbyhsbGJ mYmphZmRmZEJDmElcV6nc3YBQgLpiSWp2ampBalFMOOYODilGhhX6izeVGflN8lIUFjLlfGe YNmdPIbJOxeJ3hcsV4vvZrZq6lzqOEdH3WFPxekrvX71LNuUHD4b+m07Z2h1R2H/bdOHEcJX im9ddfukciKWt19sQWdG44WLS87vNXZi1vw76alpqOPCi2Z7ThktDKqL8m7TcVoYeuovh/7+ Sg5HhvVqj78v2aTEUpyRaKjFXFScCACwlCbfbgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42I5/e+xgG5/jWeAwbENRhabHl9jdWD02Lyk PoAxqoHRJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VWycUnQNctMwdo qpJCWWJOKVAoILG4WEnfDtOE0BA3XQuYxghd35AguB4jAzSQsIYx42/bG8aCpXIVCyZ4NTB+ l+hi5OSQEDCR+HNiKTOELSZx4d56ti5GLg4hgUWMEs+v9zJDOBuYJDY/fc4EUsUmYCxxf+5m MFtEwENi9eylYEXMAjsZJT4t2Ao2SlggXuL8lnZWEJtFQFXi5Ob/QHEODl4BV4ktrz0htilI tC47xA5icwq4SbTumcgCYgsBlVzd+JtxAiPvAkaGVYyiqQXJBcVJ6blGesWJucWleel6yfm5 mxjBAf5MegfjqgaLQ4wCHIxKPLwWVzwChFgTy4orcw8xSnAwK4nwTvwFFOJNSaysSi3Kjy8q zUktPsToA3TURGYp0eR8YPTllcQbGpuYGVkamRtaGBmb4xBWEud1OmcXICSQnliSmp2aWpBa BDOOiYNTqoHR6dir28n3Lr/5tncF39M7HHdeTI1/YccWN6Vl9qMPmqfO8zcLb37/u7ril3HB aY/lt0pcV6XN6Vt9MPjt45sVpxOzW9iWHZJRO9/IIqIukDNhnYbeTLU3vP/fO06fPC9EYJHi I4tzk7tzzoR+qe24Yt0139HaRfNWyiYjs8i/B67evG4/IdzCUomlOCPRUIu5qDgRAKuUp9Sd AgAA X-CFilter-Loop: Reflected X-Spam-Note: CRM114 invocation failed X-Spam-Score: -3.9 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.34 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 3.0 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kgene.kim@samsung.com, inki.dae@samsung.com, linux-samsung-soc@vger.kernel.org, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, m.szyprowski@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 Two device ids are created for exynos4-fb and exynos5-fb. Also, added driver data for exynos4 and exynos5 to pick the timing base address at runtime to write data into appropriate register address. Signed-off-by: Leela Krishna Amudala --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 43 +++++++++++++++++++++++++++--- 1 files changed, 39 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 24c0bd4..65e927b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -57,6 +57,18 @@ #define get_fimd_context(dev) platform_get_drvdata(to_platform_device(dev)) +struct fimd_driver_data { + unsigned int timing_base; +}; + +struct fimd_driver_data exynos4_fimd_driver_data = { + .timing_base = 0x0, +}; + +struct fimd_driver_data exynos5_fimd_driver_data = { + .timing_base = 0x20000, +}; + struct fimd_win_data { unsigned int offset_x; unsigned int offset_y; @@ -91,6 +103,13 @@ struct fimd_context { struct exynos_drm_panel_info *panel; }; +static inline struct fimd_driver_data *drm_fimd_get_driver_data( + struct platform_device *pdev) +{ + return (struct fimd_driver_data *) + platform_get_device_id(pdev)->driver_data; +} + static bool fimd_display_is_connected(struct device *dev) { DRM_DEBUG_KMS("%s\n", __FILE__); @@ -194,32 +213,35 @@ static void fimd_commit(struct device *dev) struct fimd_context *ctx = get_fimd_context(dev); struct exynos_drm_panel_info *panel = ctx->panel; struct fb_videomode *timing = &panel->timing; + struct fimd_driver_data *driver_data; + struct platform_device *pdev = to_platform_device(dev); u32 val; + driver_data = drm_fimd_get_driver_data(pdev); if (ctx->suspended) return; DRM_DEBUG_KMS("%s\n", __FILE__); /* setup polarity values from machine code. */ - writel(ctx->vidcon1, ctx->regs + VIDCON1); + writel(ctx->vidcon1, ctx->regs + driver_data->timing_base + VIDCON1); /* setup vertical timing values. */ val = VIDTCON0_VBPD(timing->upper_margin - 1) | VIDTCON0_VFPD(timing->lower_margin - 1) | VIDTCON0_VSPW(timing->vsync_len - 1); - writel(val, ctx->regs + VIDTCON0); + writel(val, ctx->regs + driver_data->timing_base + VIDTCON0); /* setup horizontal timing values. */ val = VIDTCON1_HBPD(timing->left_margin - 1) | VIDTCON1_HFPD(timing->right_margin - 1) | VIDTCON1_HSPW(timing->hsync_len - 1); - writel(val, ctx->regs + VIDTCON1); + writel(val, ctx->regs + driver_data->timing_base + VIDTCON1); /* setup horizontal and vertical display size. */ val = VIDTCON2_LINEVAL(timing->yres - 1) | VIDTCON2_HOZVAL(timing->xres - 1); - writel(val, ctx->regs + VIDTCON2); + writel(val, ctx->regs + driver_data->timing_base + VIDTCON2); /* setup clock source, clock divider, enable dma. */ val = ctx->vidcon0; @@ -982,6 +1004,18 @@ static int fimd_runtime_resume(struct device *dev) } #endif +static struct platform_device_id fimd_driver_ids[] = { + { + .name = "exynos4-fb", + .driver_data = (unsigned long)&exynos4_fimd_driver_data, + }, { + .name = "exynos5-fb", + .driver_data = (unsigned long)&exynos5_fimd_driver_data, + }, + {}, +}; +MODULE_DEVICE_TABLE(platform, fimd_driver_ids); + static const struct dev_pm_ops fimd_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume) SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL) @@ -990,6 +1024,7 @@ static const struct dev_pm_ops fimd_pm_ops = { struct platform_driver fimd_driver = { .probe = fimd_probe, .remove = __devexit_p(fimd_remove), + .id_table = fimd_driver_ids, .driver = { .name = "exynos4-fb", .owner = THIS_MODULE,