From patchwork Thu Aug 16 10:08:08 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: 1337331 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 C0462DF266 for ; Fri, 17 Aug 2012 06:33:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 42BA99E917 for ; Thu, 16 Aug 2012 23:33:47 -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 F28359E9FE for ; Thu, 16 Aug 2012 01:59:59 -0700 (PDT) Received: from epcpsbgm1.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8U00ICPBNT6KL0@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 16 Aug 2012 17:59:57 +0900 (KST) X-AuditID: cbfee61a-b7fc66d0000043b7-bb-502cb68d637b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id FF.E8.17335.D86BC205; Thu, 16 Aug 2012 17:59:57 +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 <0M8U008MUBNQAS90@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 16 Aug 2012 17:59:57 +0900 (KST) From: Leela Krishna Amudala To: dri-devel@lists.freedesktop.org, devicetree-discuss@lists.ozlabs.org Subject: [PATCH V3 1/2] drm/exynos: add platform_device_id table and driver data for exynos5 drm fimd Date: Thu, 16 Aug 2012 15:38:08 +0530 Message-id: <1345111689-14601-2-git-send-email-l.krishna@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1345111689-14601-1-git-send-email-l.krishna@samsung.com> References: <1345111689-14601-1-git-send-email-l.krishna@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrAJMWRmVeSWpSXmKPExsVy+t9jQd3ebToBBg+2qlhc+fqezYHR4373 caYAxigum5TUnMyy1CJ9uwSujPv9h5kLTipW9HceZWtgPC3dxcjBISFgIrHoiXoXIyeQKSZx 4d56ti5GLg4hgemMEgteNjJDOKuZJHbOOMUEUsUmYCxxf+5mMFtEwENi9eylzCA2s0CexKv3 U5hAhgoLpEu8+A1WwiKgKrF3/g0wm1fAVeLknVNsEMsUJFqXHWIHsTkF3CTWdzxhA2kVAqq5 NEdrAiPvAkaGVYyiqQXJBcVJ6bmGesWJucWleel6yfm5mxjB/n4mtYNxZYPFIUYBDkYlHl4J Jp0AIdbEsuLK3EOMEhzMSiK8t2uBQrwpiZVVqUX58UWlOanFhxilOViUxHmNvb/6CwmkJ5ak ZqemFqQWwWSZODilGhjln/RkvN50TNWy2fpm64+5Sz7oTzQ7FLeh1sSo9fGd5k3flM971e76 pTlzrpDpFKbUV57sXG9uftTuedfS0T+15Syr19nHTAcFXtc9fJLh5uv6ty1EoO1D6SYGyT2l e1b9+Biz9NmZBOFvwkKT+KzifsmGreeQe2gZz5iSdcd7o1yQWESxmZESS3FGoqEWc1FxIgDH kB6E8wEAAA== X-TM-AS-MML: No X-Mailman-Approved-At: Thu, 16 Aug 2012 23:21:26 -0700 Cc: kgene.kim@samsung.com, laurent.pinchart@ideasonboard.com, 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-drm-fimd. Also, added driver data for exynos5 to pick the fimd version at runtime and to choose the VIDTCON register offsets accordingly. Signed-off-by: Leela Krishna Amudala --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 56 +++++++++++++++++++++++++++--- 1 files changed, 51 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..8379c59 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)) +enum fimd_version_type { + VERSION_8, /* FIMD_VERSION8 */ +}; + +struct drm_fimd_driver_data { + enum fimd_version_type fimd_ver; +}; + +struct drm_fimd_driver_data exynos5_drm_fimd_driver_data = { + .fimd_ver = VERSION_8, +}; + 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 drm_fimd_driver_data *drm_fimd_get_driver_data( + struct platform_device *pdev) +{ + return (struct drm_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,47 @@ 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 drm_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); + if (driver_data->fimd_ver == VERSION_8) + writel(ctx->vidcon1, ctx->regs + FIMD_V8_VIDCON1); + else + writel(ctx->vidcon1, ctx->regs + 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); + if (driver_data->fimd_ver == VERSION_8) + writel(val, ctx->regs + FIMD_V8_VIDTCON0); + else + writel(val, ctx->regs + 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); + if (driver_data->fimd_ver == VERSION_8) + writel(val, ctx->regs + FIMD_V8_VIDTCON1); + else + writel(val, ctx->regs + VIDTCON1); /* setup horizontal and vertical display size. */ val = VIDTCON2_LINEVAL(timing->yres - 1) | VIDTCON2_HOZVAL(timing->xres - 1); - writel(val, ctx->regs + VIDTCON2); + if (driver_data->fimd_ver == VERSION_8) + writel(val, ctx->regs + FIMD_V8_VIDTCON2); + else + writel(val, ctx->regs + VIDTCON2); /* setup clock source, clock divider, enable dma. */ val = ctx->vidcon0; @@ -982,6 +1016,17 @@ static int fimd_runtime_resume(struct device *dev) } #endif +static struct platform_device_id exynos_drm_fimd_driver_ids[] = { + { + .name = "exynos4-fb", + }, { + .name = "exynos5-drm-fimd", + .driver_data = (unsigned long)&exynos5_drm_fimd_driver_data, + }, + {}, +}; +MODULE_DEVICE_TABLE(platform, exynos_drm_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 +1035,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 = exynos_drm_fimd_driver_ids, .driver = { - .name = "exynos4-fb", + .name = "exynos-drm-fimd", .owner = THIS_MODULE, .pm = &fimd_pm_ops, },