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: 1412091 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 E457EDFFCF for ; Thu, 6 Sep 2012 06:31:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD57E9EB8B for ; Wed, 5 Sep 2012 23:31:03 -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 1DD659E8A8 for ; Wed, 5 Sep 2012 04:36:04 -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 <0M9V00J3OK7PAU60@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 05 Sep 2012 20:36:03 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.115]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 3B.56.11312.22937405; Wed, 05 Sep 2012 20:36:03 +0900 (KST) X-AuditID: cbfee61b-b7f056d000002c30-26-50473922ef58 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id DA.56.11312.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 dri-devel@lists.freedesktop.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+NgFrrFLMWRmVeSWpSXmKPExsWyRsSkWFfZ0j3A4OhuVosrX9+zOTB63O8+ zhTAGMVlk5Kak1mWWqRvl8CVsW5OK3vBavmK4/MrGhjvS3YxcnJICJhILH20khHCFpO4cG89 WxcjF4eQwFJGiYX3Wllgik5N2MQEYgsJTGeUONVVAVG0mkni+o+1zCAJNgFjiftzN4MViQh4 SKyevZQZpIhZYCejxKcFW4EcDg5hgXiJzQcFQUwWAVWJH29MQcp5BVwlprcuYIXYpSDRuuwQ O4jNKeAmsf/CSmaIva4Szx/tBRvPIiAg8W3yIRaQMRICshKbDoBtkhC4zCZxasc2Zog5khIH V9xgmcAovICRYRWjaGpBckFxUnqukV5xYm5xaV66XnJ+7iZGYACe/vdMegfjqgaLQ4wCHIxK PLwKf90ChFgTy4orcw8xSnAwK4nw3l7tGiDEm5JYWZValB9fVJqTWnyI0QfokonMUqLJ+cDo yCuJNzQ2NjEzMbUwMzIzMsEhrCTO63TOLkBIID2xJDU7NbUgtQhmHBMHp1QDo9Z/dl/+x8oX 9mu38eybqrc6ZNPbw3XOvlfDJxwWyt98sezmcYfi/xIiJ2aZNIZ9sy1fN5/5Xk/aQ5kMlZ4U t6LLYpvfs9UEpy5jnXXpdfFUXbGE5qrWO0VqaUaH9vxnlvrXdfVRSfvH/CfH3i0w7fq2sSOi 5UNlhM4MveIw4+LGRB7VEysLlViKMxINtZiLihMB72dcbW0CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkkeLIzCtJLcpLzFFi42I5/e+xoK6SpXuAwc39xhZXvr5nc2D0uN99 nCmAMaqB0SYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH aKySQlliTilQKCCxuFhJ3w7ThNAQN10LmMYIXd+QILgeIwM0kLCGMWPdnFb2gtXyFcfnVzQw 3pfsYuTkkBAwkTg1YRMThC0mceHeejYQW0hgOqPEqa6KLkYuIHs1k8T1H2uZQRJsAsYS9+du BmsQEfCQWD17KTNIEbPATkaJTwu2AjkcHMIC8RKbDwqCmCwCqhI/3piClPMKuEpMb13ACrFL QaJ12SF2EJtTwE1i/4WVzBB7XSWeP9rLNIGRdwEjwypG0dSC5ILipPRcI73ixNzi0rx0veT8 3E2M4PB+Jr2DcVWDxSFGAQ5GJR5ehb9uAUKsiWXFlbmHGCU4mJVEeG+vdg0Q4k1JrKxKLcqP LyrNSS0+xOgDdNREZinR5Hxg7OWVxBsam5gZWRqZG1oYGZvjEFYS53U6ZxcgJJCeWJKanZpa kFoEM46Jg1OqgdEo8bRzyw7dRGeD0w8m+s+X65yz4sq069EbbIMVQz6rrulL0Fn9y3Fqq9op 3htccrcmRp0+5fZE6wFHd6LiqTPRRfZvOxdrC0Z7To+76NDMMan9pqe/btCk9SY8kXVp+eq6 dptObk7SKJnJvLGr7HdNnLGwxMHp0QqrdRWS9L7fOCvEb/LrtBJLcUaioRZzUXEiAK2xQKKc AgAA X-CFilter-Loop: Reflected X-Mailman-Approved-At: Wed, 05 Sep 2012 23:28:15 -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 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, },