From patchwork Fri Aug 9 07:40:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 2842505 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 06AD99F295 for ; Sat, 10 Aug 2013 18:11:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B20E202DB for ; Sat, 10 Aug 2013 18:11:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2D303202C4 for ; Sat, 10 Aug 2013 18:11:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1D3EEE5FA8 for ; Sat, 10 Aug 2013 11:11:56 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 81C90E5C7C for ; Fri, 9 Aug 2013 00:41:09 -0700 (PDT) Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MR9002MD6O6LNC0@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 09 Aug 2013 16:41:07 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.113]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 7A.E7.08825.31D94025; Fri, 09 Aug 2013 16:41:07 +0900 (KST) X-AuditID: cbfee68e-b7f276d000002279-b0-52049d134e54 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 43.76.32250.21D94025; Fri, 09 Aug 2013 16:41:06 +0900 (KST) Received: from localhost.localdomain ([10.252.81.149]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MR900LVT6OG3X20@mmp1.samsung.com>; Fri, 09 Aug 2013 16:41:06 +0900 (KST) From: Chanho Park To: inki.dae@samsung.com, kgene.kim@samsung.com Subject: [PATCHv2 1/5] drm/exynos: add device tree support for rotator Date: Fri, 09 Aug 2013 16:40:49 +0900 Message-id: <1376034053-31910-2-git-send-email-chanho61.park@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1376034053-31910-1-git-send-email-chanho61.park@samsung.com> References: <1376034053-31910-1-git-send-email-chanho61.park@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGIsWRmVeSWpSXmKPExsWyRsSkUFd4LkuQwe7rbBaX92tbzD9yjtXi ytf3bBaT7k9gsehdcJXN4mzTG3aLB3NvMllsenyN1WLG+X1MFkuvX2SyOPymndVi1a4/jA48 HmvmrWH02DnrLrvH/e7jTB6bl9R79P818OjbsorR4/MmuQD2KC6blNSczLLUIn27BK6Miy+3 MBacVKjYePYgUwPjOckuRk4OCQETiWWnj7JD2GISF+6tZ+ti5OIQEljKKPHp2SoWmKLlh5ey gthCAosYJTbNU4UoamOSmH7nECNIgk1AV2LL81dgtoiAvsTUHXfYQYqYBTYySfRu2sUEkhAW cJOYdfwhmM0ioCpxbeZNZhCbV8BT4sOFT0CrOYC2KUjMmWQDEuYU8JL4cGIpG8RiT4nnu6ay gMyUEDjHLjHr8kRWiDkCEt8mH2KB6JWV2HSAGeJoSYmDK26wTGAUXsDIsIpRNLUguaA4Kb3I SK84Mbe4NC9dLzk/dxMjME5O/3vWt4Px5gHrQ4zJQOMmMkuJJucD4yyvJN7Q2MzIwtTE1NjI 3N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5wSf8Ql3qNPW9JysNVYRPOBHz063PnTjM4vtpWN6NUoEx+lsGmV3vXPo8z 2+sz251Tsohhs9KFVYly7voPlFiKMxINtZiLihMB9Nv+oAYDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Sat, 10 Aug 2013 11:06:26 -0700 Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, dri-devel@lists.freedesktop.org, kyungmin.park@samsung.com, s.nawrocki@samsung.com, Chanho Park , linux-arm-kernel@lists.infradead.org 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The exynos4 platform is only dt-based since 3.10, we should convert driver data and ids to dt-based parsing methods. The rotator driver has a limit table to get size limit of input picture. Each SoCs has slightly different limit value compared with any others. For example, exynos4210's max_size of RGB888 is 16k x 16k. But, others have 8k x 8k. Another example the exynos5250 should have multiple of 2 pixel size for its X/Y axis. Thus, we should keep different tables for each of them. Signed-off-by: Chanho Park Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_rotator.c | 109 ++++++++++++++++++++------- 1 file changed, 81 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 427640a..39b09e0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c @@ -632,6 +632,73 @@ static int rotator_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) return 0; } +static struct rot_limit_table rot_limit_tbl_4210 = { + .ycbcr420_2p = { + .min_w = 32, + .min_h = 32, + .max_w = SZ_64K, + .max_h = SZ_64K, + .align = 3, + }, + .rgb888 = { + .min_w = 8, + .min_h = 8, + .max_w = SZ_16K, + .max_h = SZ_16K, + .align = 2, + }, +}; + +static struct rot_limit_table rot_limit_tbl_4x12 = { + .ycbcr420_2p = { + .min_w = 32, + .min_h = 32, + .max_w = SZ_32K, + .max_h = SZ_32K, + .align = 3, + }, + .rgb888 = { + .min_w = 8, + .min_h = 8, + .max_w = SZ_8K, + .max_h = SZ_8K, + .align = 2, + }, +}; + +static struct rot_limit_table rot_limit_tbl_5250 = { + .ycbcr420_2p = { + .min_w = 32, + .min_h = 32, + .max_w = SZ_32K, + .max_h = SZ_32K, + .align = 3, + }, + .rgb888 = { + .min_w = 8, + .min_h = 8, + .max_w = SZ_8K, + .max_h = SZ_8K, + .align = 1, + }, +}; + +static const struct of_device_id exynos_rotator_match[] = { + { + .compatible = "samsung,exynos4210-rotator", + .data = &rot_limit_tbl_4210, + }, + { + .compatible = "samsung,exynos4212-rotator", + .data = &rot_limit_tbl_4x12, + }, + { + .compatible = "samsung,exynos5250-rotator", + .data = &rot_limit_tbl_5250, + }, + {}, +}; + static int rotator_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -645,8 +712,19 @@ static int rotator_probe(struct platform_device *pdev) return -ENOMEM; } - rot->limit_tbl = (struct rot_limit_table *) - platform_get_device_id(pdev)->driver_data; + if (dev->of_node) { + const struct of_device_id *match; + match = of_match_node(of_match_ptr(exynos_rotator_match), + dev->of_node); + if (match == NULL) { + dev_err(dev, "failed to match node\n"); + return -ENODEV; + } + rot->limit_tbl = (struct rot_limit_table *)match->data; + } else { + dev_err(dev, "cannot find binding\n"); + return -ENODEV; + } rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rot->regs = devm_ioremap_resource(dev, rot->regs_res); @@ -718,31 +796,6 @@ static int rotator_remove(struct platform_device *pdev) return 0; } -static struct rot_limit_table rot_limit_tbl = { - .ycbcr420_2p = { - .min_w = 32, - .min_h = 32, - .max_w = SZ_32K, - .max_h = SZ_32K, - .align = 3, - }, - .rgb888 = { - .min_w = 8, - .min_h = 8, - .max_w = SZ_8K, - .max_h = SZ_8K, - .align = 2, - }, -}; - -static struct platform_device_id rotator_driver_ids[] = { - { - .name = "exynos-rot", - .driver_data = (unsigned long)&rot_limit_tbl, - }, - {}, -}; - static int rotator_clk_crtl(struct rot_context *rot, bool enable) { if (enable) { @@ -804,10 +857,10 @@ static const struct dev_pm_ops rotator_pm_ops = { struct platform_driver rotator_driver = { .probe = rotator_probe, .remove = rotator_remove, - .id_table = rotator_driver_ids, .driver = { .name = "exynos-rot", .owner = THIS_MODULE, .pm = &rotator_pm_ops, + .of_match_table = of_match_ptr(exynos_rotator_match), }, };