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: 1420011 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 DDC20DF283 for ; Fri, 7 Sep 2012 06:37:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F32F69E927 for ; Thu, 6 Sep 2012 23:37:10 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A5ACA0DFE for ; Thu, 6 Sep 2012 21:48:17 -0700 (PDT) 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 <0M9Y00DKWQNF1PC0@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 07 Sep 2012 13:48:16 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.115]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 98.91.32095.09C79405; Fri, 07 Sep 2012 13:48:16 +0900 (KST) X-AuditID: cbfee61a-b7fba6d000007d5f-16-50497c906b54 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id C5.91.32095.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 dri-devel@lists.freedesktop.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+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkWHdCjWeAwbVvAhZXvr5nc2D0uN99 nCmAMYrLJiU1J7MstUjfLoEr42/bG8aCpXIVCyZ4NTB+l+hi5OSQEDCRaF9wnhXCFpO4cG89 G4gtJLCUUeLRbG2YmoMHDgHFuYDiixglzravYYJwVjNJbL/1HqybTcBY4v7czUwgtoiAh8Tq 2UuZQYqYBXYySnxasJUZJCEsEC9xfks7WAOLgKrEyc3/geIcHLwCrhJbXntCbFOQaF12iB3E 5hRwk2jdM5EF4iJXiasbfzNCtApIfJt8iAWkVUJAVmLTAbBVEgLX2SSO/53PAjFHUuLgihss ExiFFzAyrGIUTS1ILihOSs811CtOzC0uzUvXS87P3cQIDMHT/55J7WBc2WBxiFGAg1GJh9fi ikeAEGtiWXFl7iFGCQ5mJRHeib+AQrwpiZVVqUX58UWlOanFhxh9gC6ZyCwlmpwPjI+8knhD Y2MTMxNTCzMjMyMTHMJK4rxO5+wChATSE0tSs1NTC1KLYMYxcXBKNTBOD2E16Q98HNNzyEJU rvPJ46Obt5js2t7yY1nlmd/Hi3N+B7nu6BZWX+Rcna/Z0zftL/evVtcLb0o79pY/2fDp8Kmg GpVFyhu7HeY15WbX3Ge4HcPbm14+L9eNv8tF4bz16/su7Tm5dUyL4+NdHASULr3ae3HbhaW8 hTWXd07XafGf3rBzRbkSS3FGoqEWc1FxIgB/Q4HQbgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xgG5/jWeAwf1phhZXvr5nc2D0uN99 nCmAMaqB0SYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH aKySQlliTilQKCCxuFhJ3w7ThNAQN10LmMYIXd+QILgeIwM0kLCGMeNv2xvGgqVyFQsmeDUw fpfoYuTkkBAwkTh44BAbhC0mceHeeiCbi0NIYBGjxNn2NUwQzmomie233rOCVLEJGEvcn7uZ CcQWEfCQWD17KTNIEbPATkaJTwu2MoMkhAXiJc5vaQdrYBFQlTi5+T9QnIODV8BVYstrT4ht ChKtyw6xg9icAm4SrXsmsoDYQkAlVzf+ZpzAyLuAkWEVo2hqQXJBcVJ6rqFecWJucWleul5y fu4mRnCIP5PawbiyweIQowAHoxIPr8UVjwAh1sSy4srcQ4wSHMxKIrwTfwGFeFMSK6tSi/Lj i0pzUosPMfoAHTWRWUo0OR8Yf3kl8YbGJmZGlkbmhhZGxuY4hJXEeZ3O2QUICaQnlqRmp6YW pBbBjGPi4JRqYEw9Wn6iZUnUnsPKXtW1z+fYymVPanyXNP0bo5dyhm/fCotDr88tSnQXO84T MTf2vFvAOSbXlJId53ae7u68zD/D6OnkWYsmTjkefPD8De9Miwf3rrczLjH+H76BI/gaX/Ac 7Shtywk/V6SK3up5ryL1wcB792GdMsn65vkmVotkD+wU+blNO02JpTgj0VCLuag4EQAknBkp ngIAAA== X-CFilter-Loop: Reflected X-Mailman-Approved-At: Thu, 06 Sep 2012 23:33:45 -0700 Cc: kgene.kim@samsung.com, linux-samsung-soc@vger.kernel.org, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, m.szyprowski@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 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,