From patchwork Wed Sep 5 15:39:14 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: 1408801 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id B2B8E40220 for ; Wed, 5 Sep 2012 11:39:33 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9Dty-00059l-6Y; Wed, 05 Sep 2012 11:36:10 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9Dtt-00058l-PQ for linux-arm-kernel@lists.infradead.org; Wed, 05 Sep 2012 11:36:07 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9V008ACK7PCWR0@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 05 Sep 2012 20:36:03 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.112]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id FD.97.11106.32937405; Wed, 05 Sep 2012 20:36:03 +0900 (KST) X-AuditID: cbfee61a-b7fd26d000002b62-50-504739235d5b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 3D.97.11106.22937405; Wed, 05 Sep 2012 20:36:02 +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 <0M9V00DX2K4YFTB0@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 05 Sep 2012 20:36:02 +0900 (KST) From: Leela Krishna Amudala To: dri-devel@lists.freedesktop.org, devicetree-discuss@lists.ozlabs.org Subject: [PATCH V4 1/2] drm/exynos: add platform_device_id table and driver data for drm fimd Date: Wed, 05 Sep 2012 21:09:14 +0530 Message-id: <1346859555-13527-2-git-send-email-l.krishna@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1346859555-13527-1-git-send-email-l.krishna@samsung.com> References: <1346859555-13527-1-git-send-email-l.krishna@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRmVeSWpSXmKPExsWyRsSkQFfZ0j3AYNcKDotNj6+xOjB6bF5S H8AYxWWTkpqTWZZapG+XwJWxbk4re8Fq+Yrj8ysaGO9LdjFyckgImEj8/XaBDcIWk7hwbz2Q zcUhJLCUUWLa6T1ADgdY0YpvFRDx6YwSjw+tZIdwNjBJPL4wD6ybTcBY4v7czUwgtoiAh8Tq 2UuZQYqYBXYySnxasJUZZJKwQLzE5oOCICaLgKrEjzemIOW8Aq4S01sXsEIcoSDRuuwQO4jN KeAmsf/CSmYQWwio5vmjvWDjWQQEJL5NPsQCcZusxKYDYJskBK6zSfStnMQCMUdS4uCKGywT GIUXMDKsYhRNLUguKE5KzzXUK07MLS7NS9dLzs/dxAgMv9P/nkntYFzZYHGIUYCDUYmHl8Hb LUCINbGsuDL3EKMEB7OSCO/t1a4BQrwpiZVVqUX58UWlOanFhxh9gC6ZyCwlmpwPjI28knhD Y2MTMxNTCzMjMyMTHMJK4rxO5+wChATSE0tSs1NTC1KLYMYxcXBKNTD2qP5Z9m7aiks/FbNO bnmq4GacM1cvXEbWXVXA/4ZrWPyp3rlhxqs8P16+tr/20oXjUZ94H+7a5mS+fDXHFdurtXf0 7pb/Of67NLvYZGXaR6GKaWu45i2durb9rFHDne5WqeDnc85NvMV089Jv6yqegAfcL5YJWqo+ c9oa4VklVSAz3U7PL1pLiaU4I9FQi7moOBEAgiGSb2wCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeLIzCtJLcpLzFFi42I5/e+xoK6SpXuAwYbnJhabHl9jdWD02Lyk PoAxqoHRJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VWycUnQNctMwdo qpJCWWJOKVAoILG4WEnfDtOE0BA3XQuYxghd35AguB4jAzSQsIYxY92cVvaC1fIVx+dXNDDe l+xi5OCQEDCRWPGtoouRE8gUk7hwbz1bFyMXh5DAdEaJx4dWskM4G5gkHl+YxwZSxSZgLHF/ 7mYmEFtEwENi9eylzCBFzAI7GSU+LdjKDDJVWCBeYvNBQRCTRUBV4scbU5ByXgFXiemtC1gh lilItC47xA5icwq4Sey/sJIZxBYCqnn+aC/TBEbeBYwMqxhFUwuSC4qT0nMN9YoTc4tL89L1 kvNzNzGCg/uZ1A7GlQ0WhxgFOBiVeHgZvN0ChFgTy4orcw8xSnAwK4nw3l7tGiDEm5JYWZVa lB9fVJqTWnyI0QfoqInMUqLJ+cDIyyuJNzQ2MTOyNDI3tDAyNschrCTO63TOLkBIID2xJDU7 NbUgtQhmHBMHp1QDY0yLL1PCx+qjmVbPTacVLPRn602XL91Z84vrry5Hy6PlC+VMskISOg53 JpqdlAj8/qhorusTI43s1gW3jCYV1x9at+3dJ7mUjlyzJdevJr33rPB+XjXJRrBCttJ/ZtqD W3dO7srxDfFfG3BdYMOLNaZrH6S4XjEKN7+3qvbzrWiujoolf4oPKLEUZyQaajEXFScCAA5z ug+bAgAA 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.33 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_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 The name of the exynos drm fimd device is renamed to exynos-drm-fimd and 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 | 45 ++++++++++++++++++++++++++--- 1 files changed, 40 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 24c0bd4..3701fbe 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,8 +1024,9 @@ 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", + .name = "exynos-drm-fimd", .owner = THIS_MODULE, .pm = &fimd_pm_ops, },