From patchwork Mon Feb 20 13:38:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 94220 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1327246qgi; Mon, 20 Feb 2017 05:40:06 -0800 (PST) X-Received: by 10.98.131.136 with SMTP id h130mr26104557pfe.4.1487598006626; Mon, 20 Feb 2017 05:40:06 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si18592166pge.343.2017.02.20.05.40.06; Mon, 20 Feb 2017 05:40:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753458AbdBTNkE (ORCPT + 4 others); Mon, 20 Feb 2017 08:40:04 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:21852 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513AbdBTNjS (ORCPT ); Mon, 20 Feb 2017 08:39:18 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLO0082UDXD6950@mailout3.w1.samsung.com>; Mon, 20 Feb 2017 13:39:13 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170220133913eucas1p2c10cf5f9752bdea00fabadfa392a986e~lAnTm98s02797127971eucas1p2v; Mon, 20 Feb 2017 13:39:13 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 1A.12.28517.081FAA85; Mon, 20 Feb 2017 13:39:12 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170220133912eucas1p19fece549b0759c7e6a308e309f6d3081~lAnS7Y41f3063330633eucas1p1g; Mon, 20 Feb 2017 13:39:12 +0000 (GMT) X-AuditID: cbfec7f4-f79716d000006f65-75-58aaf180f804 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 33.FA.10233.581FAA85; Mon, 20 Feb 2017 13:39:17 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLO00HBFDX6PK30@eusync1.samsung.com>; Mon, 20 Feb 2017 13:39:11 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH v2 03/15] media: s5p-mfc: Replace mem_dev_* entries with an array Date: Mon, 20 Feb 2017 14:38:52 +0100 Message-id: <1487597944-2000-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487597944-2000-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djPc7oNH1dFGHRu1Le4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzFZZOS mpNZllqkb5fAlTFl2zvWgq3NjBUHN05nb2BsyO9i5OSQEDCROPG2lR3CFpO4cG89WxcjF4eQ wFJGiT/z1jJBOJ8ZJTb8OcsM07Hx1BqoxDJGidlPl0I5DUwSd6ddZASpYhMwlOh628UGYosI OEksnPWXHaSIWeA7o8S33adZQRLCAsES7feXsIDYLAKqElMuvwA7hFfAXeLhkslQR8lJnDw2 Gaieg4NTwENiR3syyBwJgddsEndvXAGLSwjISmw6AHWdi0TDrHWMELawxKvjW6DGyEhcntzN AmH3M0o0tWpD2DMYJc695YWwrSUOH78IdhqzAJ/EpG3TmSHG80p0tAlBlHhIfHt6mAnCdpSY dOoH2EghgdmMEgt+10xglFnAyLCKUSS1tDg3PbXYRK84Mbe4NC9dLzk/dxMjMG5P/zv+ZQfj 4mNWhxgFOBiVeHg1Zq6MEGJNLCuuzD3EKMHBrCTCe/nlqggh3pTEyqrUovz4otKc1OJDjNIc LErivHsWXAkXEkhPLEnNTk0tSC2CyTJxcEo1MIaFNsz4wJY7+8qqP3FtG1Zu7wvr1S7hejZj s9yWGZb74lzeKSotjBW4eFbuSuL1WTLahT9arvDtXLxWRsWR7+BnP+be/RaVmru0CxXt/nxP erdtewVzSH+FVfPbRFu9xcseBSmrrZS7ECM9acOW+t5fv7Jmam9rWetr/4XngnZ8sr//sW2i G5VYijMSDbWYi4oTAXdkyV7XAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsVy+t/xy7qtH1dFGEyfrmdxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDnKzSYj NTEltUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJ bhlTtr1jLdjazFhxcON09gbGhvwuRk4OCQETiY2n1jBB2GISF+6tZ+ti5OIQEljCKLH0Tysj hNPEJLFk/wlWkCo2AUOJrrddbCC2iICTxMJZf9lBbGaB74wSy26mgdjCAsES7feXsIDYLAKq ElMuvwCr4RVwl3i4ZDI7xDY5iZPHJgPN5ODgFPCQ2NGeDBIWAir58qyXaQIj7wJGhlWMIqml xbnpucVGesWJucWleel6yfm5mxiBIbzt2M8tOxi73gUfYhTgYFTi4dWYuTJCiDWxrLgy9xCj BAezkgjv5ZerIoR4UxIrq1KL8uOLSnNSiw8xmgLdNJFZSjQ5HxhfeSXxhiaG5paGRsYWFuZG RkrivFM/XAkXEkhPLEnNTk0tSC2C6WPi4JRqYLT1Es/o05Q2qNWb+ElQ8webwMrPDbPVWEo7 n79ePHPVJomfJwTnlB8+ZmqmpHxN9+gDTw/56rcud/mOee690OAxs8Uqs3vRkQuTZm95zr2v U+z+5E9CnUpu5QettwurpJ7rV9Rovh/3aXJQVpAiW0B6TIa4PkeTUMUniaipD/uuLb1sO39H lBJLcUaioRZzUXEiAG3mva53AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170220133912eucas1p19fece549b0759c7e6a308e309f6d3081 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170220133912eucas1p19fece549b0759c7e6a308e309f6d3081 X-RootMTR: 20170220133912eucas1p19fece549b0759c7e6a308e309f6d3081 References: <1487597944-2000-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Internal MFC driver device structure contains two pointers to devices used for DMA memory allocation: mem_dev_l and mem_dev_r. Replace them with the mem_dev[] array and use defines for accessing particular banks. This will help to simplify code in the next patches. Signed-off-by: Marek Szyprowski Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 31 +++++++++++++----------- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 11 ++++----- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 23 +++++++++--------- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 8 +++---- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 10 ++++---- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c | 32 ++++++++++++++----------- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 15 ++++++------ 7 files changed, 69 insertions(+), 61 deletions(-) -- 1.9.1 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index ad3d7377f40d..f7664910f12c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1123,7 +1123,8 @@ static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) int ret = exynos_configure_iommu(dev, S5P_MFC_IOMMU_DMA_BASE, S5P_MFC_IOMMU_DMA_SIZE); if (ret == 0) - mfc_dev->mem_dev_l = mfc_dev->mem_dev_r = dev; + mfc_dev->mem_dev[BANK1_CTX] = + mfc_dev->mem_dev[BANK2_CTX] = dev; return ret; } @@ -1131,14 +1132,14 @@ static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) * Create and initialize virtual devices for accessing * reserved memory regions. */ - mfc_dev->mem_dev_l = s5p_mfc_alloc_memdev(dev, "left", - MFC_BANK1_ALLOC_CTX); - if (!mfc_dev->mem_dev_l) + mfc_dev->mem_dev[BANK1_CTX] = s5p_mfc_alloc_memdev(dev, "left", + BANK1_CTX); + if (!mfc_dev->mem_dev[BANK1_CTX]) return -ENODEV; - mfc_dev->mem_dev_r = s5p_mfc_alloc_memdev(dev, "right", - MFC_BANK2_ALLOC_CTX); - if (!mfc_dev->mem_dev_r) { - device_unregister(mfc_dev->mem_dev_l); + mfc_dev->mem_dev[BANK2_CTX] = s5p_mfc_alloc_memdev(dev, "right", + BANK2_CTX); + if (!mfc_dev->mem_dev[BANK2_CTX]) { + device_unregister(mfc_dev->mem_dev[BANK1_CTX]); return -ENODEV; } @@ -1154,8 +1155,8 @@ static void s5p_mfc_unconfigure_dma_memory(struct s5p_mfc_dev *mfc_dev) return; } - device_unregister(mfc_dev->mem_dev_l); - device_unregister(mfc_dev->mem_dev_r); + device_unregister(mfc_dev->mem_dev[BANK1_CTX]); + device_unregister(mfc_dev->mem_dev[BANK2_CTX]); } /* MFC probe function */ @@ -1213,8 +1214,10 @@ static int s5p_mfc_probe(struct platform_device *pdev) goto err_dma; } - vb2_dma_contig_set_max_seg_size(dev->mem_dev_l, DMA_BIT_MASK(32)); - vb2_dma_contig_set_max_seg_size(dev->mem_dev_r, DMA_BIT_MASK(32)); + vb2_dma_contig_set_max_seg_size(dev->mem_dev[BANK1_CTX], + DMA_BIT_MASK(32)); + vb2_dma_contig_set_max_seg_size(dev->mem_dev[BANK2_CTX], + DMA_BIT_MASK(32)); mutex_init(&dev->mfc_mutex); init_waitqueue_head(&dev->queue); @@ -1348,8 +1351,8 @@ static int s5p_mfc_remove(struct platform_device *pdev) v4l2_device_unregister(&dev->v4l2_dev); s5p_mfc_release_firmware(dev); s5p_mfc_unconfigure_dma_memory(dev); - vb2_dma_contig_clear_max_seg_size(dev->mem_dev_l); - vb2_dma_contig_clear_max_seg_size(dev->mem_dev_r); + vb2_dma_contig_clear_max_seg_size(dev->mem_dev[BANK1_CTX]); + vb2_dma_contig_clear_max_seg_size(dev->mem_dev[BANK2_CTX]); s5p_mfc_final_pm(dev); return 0; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 2f1387a4c386..27d4c864e06e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -33,8 +33,9 @@ * while mmaping */ #define DST_QUEUE_OFF_BASE (1 << 30) -#define MFC_BANK1_ALLOC_CTX 0 -#define MFC_BANK2_ALLOC_CTX 1 +#define BANK1_CTX 0 +#define BANK2_CTX 1 +#define BANK_CTX_NUM 2 #define MFC_BANK1_ALIGN_ORDER 13 #define MFC_BANK2_ALIGN_ORDER 13 @@ -254,8 +255,7 @@ struct s5p_mfc_priv_buf { * @vfd_dec: video device for decoding * @vfd_enc: video device for encoding * @plat_dev: platform device - * @mem_dev_l: child device of the left memory bank (0) - * @mem_dev_r: child device of the right memory bank (1) + * @mem_dev[]: child devices of the memory banks * @regs_base: base address of the MFC hw registers * @irq: irq resource * @dec_ctrl_handler: control framework handler for decoding @@ -297,8 +297,7 @@ struct s5p_mfc_dev { struct video_device *vfd_dec; struct video_device *vfd_enc; struct platform_device *plat_dev; - struct device *mem_dev_l; - struct device *mem_dev_r; + struct device *mem_dev[BANK_CTX_NUM]; void __iomem *regs_base; int irq; struct v4l2_ctrl_handler dec_ctrl_handler; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index cc888713b3b6..cd1406c75d9a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -28,6 +28,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) { void *bank2_virt; dma_addr_t bank2_dma_addr; + unsigned int align_size = 1 << MFC_BASE_ALIGN_ORDER; dev->fw_size = dev->variant->buf_size->fw; @@ -36,8 +37,8 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) return -ENOMEM; } - dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev_l, dev->fw_size, - &dev->bank1, GFP_KERNEL); + dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev[BANK1_CTX], + dev->fw_size, &dev->bank1, GFP_KERNEL); if (!dev->fw_virt_addr) { mfc_err("Allocating bitprocessor buffer failed\n"); @@ -45,13 +46,13 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) } if (HAS_PORTNUM(dev) && IS_TWOPORT(dev)) { - bank2_virt = dma_alloc_coherent(dev->mem_dev_r, 1 << MFC_BASE_ALIGN_ORDER, - &bank2_dma_addr, GFP_KERNEL); + bank2_virt = dma_alloc_coherent(dev->mem_dev[BANK2_CTX], + align_size, &bank2_dma_addr, GFP_KERNEL); if (!bank2_virt) { mfc_err("Allocating bank2 base failed\n"); - dma_free_coherent(dev->mem_dev_l, dev->fw_size, - dev->fw_virt_addr, dev->bank1); + dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_size, + dev->fw_virt_addr, dev->bank1); dev->fw_virt_addr = NULL; return -ENOMEM; } @@ -60,10 +61,10 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) * should not have address of bank2 - MFC will treat it as a null frame. * To avoid such situation we set bank2 address below the pool address. */ - dev->bank2 = bank2_dma_addr - (1 << MFC_BASE_ALIGN_ORDER); + dev->bank2 = bank2_dma_addr - align_size; - dma_free_coherent(dev->mem_dev_r, 1 << MFC_BASE_ALIGN_ORDER, - bank2_virt, bank2_dma_addr); + dma_free_coherent(dev->mem_dev[BANK2_CTX], align_size, + bank2_virt, bank2_dma_addr); } else { /* In this case bank2 can point to the same address as bank1. @@ -123,8 +124,8 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) * that MFC is no longer processing */ if (!dev->fw_virt_addr) return -EINVAL; - dma_free_coherent(dev->mem_dev_l, dev->fw_size, dev->fw_virt_addr, - dev->bank1); + dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_size, + dev->fw_virt_addr, dev->bank1); dev->fw_virt_addr = NULL; return 0; } diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 367ef8e8dbf0..f17062f9070b 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -931,14 +931,14 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, psize[1] = ctx->chroma_size; if (IS_MFCV6_PLUS(dev)) - alloc_devs[0] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK1_CTX]; else - alloc_devs[0] = ctx->dev->mem_dev_r; - alloc_devs[1] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK2_CTX]; + alloc_devs[1] = ctx->dev->mem_dev[BANK1_CTX]; } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && ctx->state == MFCINST_INIT) { psize[0] = ctx->dec_src_buf_size; - alloc_devs[0] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK1_CTX]; } else { mfc_err("This video node is dedicated to decoding. Decoding not initialized\n"); return -EINVAL; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index e39d9e06e299..2eea21f06d7e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1832,7 +1832,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, if (*buf_count > MFC_MAX_BUFFERS) *buf_count = MFC_MAX_BUFFERS; psize[0] = ctx->enc_dst_buf_size; - alloc_devs[0] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK1_CTX]; } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (ctx->src_fmt) *plane_count = ctx->src_fmt->num_planes; @@ -1848,11 +1848,11 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, psize[1] = ctx->chroma_size; if (IS_MFCV6_PLUS(dev)) { - alloc_devs[0] = ctx->dev->mem_dev_l; - alloc_devs[1] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK1_CTX]; + alloc_devs[1] = ctx->dev->mem_dev[BANK1_CTX]; } else { - alloc_devs[0] = ctx->dev->mem_dev_r; - alloc_devs[1] = ctx->dev->mem_dev_r; + alloc_devs[0] = ctx->dev->mem_dev[BANK2_CTX]; + alloc_devs[1] = ctx->dev->mem_dev[BANK2_CTX]; } } else { mfc_err("invalid queue type: %d\n", vq->type); diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c index f4301d5bbd32..65dd3e64b4db 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c @@ -41,7 +41,8 @@ static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) int ret; ctx->dsc.size = buf_size->dsc; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, &ctx->dsc); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, + &ctx->dsc); if (ret) { mfc_err("Failed to allocate temporary buffer\n"); return ret; @@ -57,7 +58,7 @@ static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) /* Release temporary buffers for decoding */ static void s5p_mfc_release_dec_desc_buffer_v5(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->dsc); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->dsc); } /* Allocate codec buffers */ @@ -172,8 +173,8 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) /* Allocate only if memory from bank 1 is necessary */ if (ctx->bank1.size > 0) { - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, - &ctx->bank1); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], + dev->bank1, &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 temporary buffer\n"); return ret; @@ -182,11 +183,12 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) } /* Allocate only if memory from bank 2 is necessary */ if (ctx->bank2.size > 0) { - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_r, dev->bank2, - &ctx->bank2); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK2_CTX], + dev->bank2, &ctx->bank2); if (ret) { mfc_err("Failed to allocate Bank2 temporary buffer\n"); - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], + &ctx->bank1); return ret; } BUG_ON(ctx->bank2.dma & ((1 << MFC_BANK2_ALIGN_ORDER) - 1)); @@ -197,8 +199,8 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) /* Release buffers allocated for codec */ static void s5p_mfc_release_codec_buffers_v5(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1); - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_r, &ctx->bank2); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->bank1); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK2_CTX], &ctx->bank2); } /* Allocate memory for instance data buffer */ @@ -214,7 +216,8 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) else ctx->ctx.size = buf_size->non_h264_ctx; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, + &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -227,10 +230,11 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) /* Initialize shared memory */ ctx->shm.size = buf_size->shm; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, &ctx->shm); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, + &ctx->shm); if (ret) { mfc_err("Failed to allocate shared memory buffer\n"); - s5p_mfc_release_priv_buf(dev->mem_dev_l, &ctx->ctx); + s5p_mfc_release_priv_buf(dev->mem_dev[BANK1_CTX], &ctx->ctx); return ret; } @@ -246,8 +250,8 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) /* Release instance buffer */ static void s5p_mfc_release_instance_buffer_v5(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->ctx); - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->shm); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->ctx); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->shm); } static int s5p_mfc_alloc_dev_context_buffer_v5(struct s5p_mfc_dev *dev) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index d6f207e859ab..d2bc938253bc 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c @@ -239,8 +239,8 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) /* Allocate only if memory from bank 1 is necessary */ if (ctx->bank1.size > 0) { - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, - &ctx->bank1); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], + dev->bank1, &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 memory\n"); return ret; @@ -253,7 +253,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) /* Release buffers allocated for codec */ static void s5p_mfc_release_codec_buffers_v6(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->bank1); } /* Allocate memory for instance data buffer */ @@ -292,7 +292,8 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) break; } - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, + &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -309,7 +310,7 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) /* Release instance buffer */ static void s5p_mfc_release_instance_buffer_v6(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->ctx); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->ctx); } /* Allocate context buffers for SYS_INIT */ @@ -321,7 +322,7 @@ static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev) mfc_debug_enter(); dev->ctx_buf.size = buf_size->dev_ctx; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, &dev->ctx_buf); if (ret) { mfc_err("Failed to allocate device context buffer\n"); @@ -339,7 +340,7 @@ static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev) /* Release context buffers for SYS_INIT */ static void s5p_mfc_release_dev_context_buffer_v6(struct s5p_mfc_dev *dev) { - s5p_mfc_release_priv_buf(dev->mem_dev_l, &dev->ctx_buf); + s5p_mfc_release_priv_buf(dev->mem_dev[BANK1_CTX], &dev->ctx_buf); } static int calc_plane(int width, int height)