From patchwork Mon Mar 20 10:56:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 95510 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp882305qgd; Mon, 20 Mar 2017 04:00:36 -0700 (PDT) X-Received: by 10.98.200.19 with SMTP id z19mr32638638pff.223.1490007636526; Mon, 20 Mar 2017 04:00:36 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26si17049412pge.228.2017.03.20.04.00.36; Mon, 20 Mar 2017 04:00:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754222AbdCTLAb (ORCPT + 4 others); Mon, 20 Mar 2017 07:00:31 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:27549 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753578AbdCTK5N (ORCPT ); Mon, 20 Mar 2017 06:57:13 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ON400DNK12VCF20@mailout2.w1.samsung.com>; Mon, 20 Mar 2017 10:56:56 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170320105655eucas1p2e02f7a2cdc00115b2557de3c1748fb3c~tkdmZSAxX0928709287eucas1p2j; Mon, 20 Mar 2017 10:56:55 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id B3.BD.28517.775BFC85; Mon, 20 Mar 2017 10:56:55 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170320105654eucas1p26e4fb044e6b814d4a349f2d2831076d7~tkdlwxZK32733227332eucas1p28; Mon, 20 Mar 2017 10:56:54 +0000 (GMT) X-AuditID: cbfec7f4-f79716d000006f65-39-58cfb577f760 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 86.E7.06687.0E5BFC85; Mon, 20 Mar 2017 10:58:40 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ON4005OP12KYT20@eusync4.samsung.com>; Mon, 20 Mar 2017 10:56:54 +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 v3 15/16] media: s5p-mfc: Rename BANK1/2 to BANK_L/R to better match documentation Date: Mon, 20 Mar 2017 11:56:41 +0100 Message-id: <1490007402-30265-16-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1490007402-30265-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsWy7djP87rlW89HGDy6w2txa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK+P9/9nsBVNrKva+fcDYwHgqs4uRk0NCwETi+ZtHrBC2mMSFe+vZuhi5OIQE ljJKzD93iBnC+cwocffbN0aYjk/zPjBBJJYxSlzctRDKaWCSOHp6NRtIFZuAoUTX2y4wW0TA SWLhrL/sIEXMAt8ZJb7tPg22UFggReLJ6icsIDaLgKpEw66HYA28Ap4Sh54sYoNYJydx8thk sHpOoPiL63/BDpQQeM0mMfvvUaBmDiBHVmLTAWaIeheJiROuQtnCEq+Ob2GHsGUkOjsOMkHY /YwSTa3aEPYMRolzb3khbGuJw8cvgu1iFuCTmLRtOjPEeF6JjjYhiBIPiV0H17BA2I4SC569 ggbRHEaJFZd3sk9glFnAyLCKUSS1tDg3PbXYRK84Mbe4NC9dLzk/dxMjMHJP/zv+ZQfj4mNW hxgFOBiVeHhvXDoXIcSaWFZcmXuIUYKDWUmE9+Pc8xFCvCmJlVWpRfnxRaU5qcWHGKU5WJTE efcsuBIuJJCeWJKanZpakFoEk2Xi4JRqYIxjWCGoquBnZyuSvs/fIrRUeV91om5s2bETzicT ZnGtXLSdN1bZMjTA8VX6zUfbGJaZFjU9Fz3nu/XBVYlXvnL3b9Z9Kt1tz1LVN2XKq775AgG+ 58I0g7ii/JpfzpKbovMr2Wjn5b3G5QuOaz8PWR/92fDXw9Tec8sZctsVunlyrm8+PedLuxJL cUaioRZzUXEiACsU02rYAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsVy+t/xa7oPtp6PMPjwSMPi1rpzrBaT7k9g sTh/fgO7Rc+GrawWM87vY7JYe+Quu8XhN+1A7uSXbA4cHptWdbJ59G1ZxejxeZNcAHOUm01G amJKapFCal5yfkpmXrqtUmiIm66FkkJeYm6qrVKErm9IkJJCWWJOKZBnZIAGHJwD3IOV9O0S 3DLe/5/NXjC1pmLv2weMDYynMrsYOTkkBEwkPs37wARhi0lcuLeerYuRi0NIYAmjxI0Lbxkh nCYmidZ3P5lBqtgEDCW63naxgdgiAk4SC2f9ZQexmQW+M0osu5kGYgsLpEhsXNjNCGKzCKhK NOx6CFbPK+ApcejJIjaIbXISJ49NZgWxOYHiL67/BYsLCXhIrPs8kWkCI+8CRoZVjCKppcW5 6bnFhnrFibnFpXnpesn5uZsYgSG87djPzTsYL20MPsQowMGoxMNrcPVchBBrYllxZe4hRgkO ZiUR3o9zz0cI8aYkVlalFuXHF5XmpBYfYjQFOmois5Rocj4wvvJK4g1NDM0tDY2MLSzMjYyU xHlLPlwJFxJITyxJzU5NLUgtgulj4uCUamA0Lol9tTP2dMKnxYmxq32be6xXh934qXT+Tqak 4Xp3Tr6ZM4pTvWTa0/Z+8Ppkyh59OXeaz/xD/68cq6m7otWw4DxDxwztMq4JP46fnWWSeGl1 qfz54wINUl8lmLVe3qlwe5u0tLfop3jxS87Cmje//kjuaRRn3jZhmmBHwZztO62eXtydYrNa iaU4I9FQi7moOBEAQZ0E8XcCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170320105654eucas1p26e4fb044e6b814d4a349f2d2831076d7 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 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: 20170320105654eucas1p26e4fb044e6b814d4a349f2d2831076d7 X-RootMTR: 20170320105654eucas1p26e4fb044e6b814d4a349f2d2831076d7 References: <1490007402-30265-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Documentation for MFC hardware still uses 'left' and 'right' names for the memory channel/banks, so replace BANK1/2 defines with more appropriate BANK_L/R names. Suggested-by: Shuah Khan Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 54 ++++++++++++------------- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 4 +- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 13 +++--- 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 | 28 ++++++------- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 6 +-- 7 files changed, 62 insertions(+), 61 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index a56031c3263e..dc1f6a96877a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1118,34 +1118,34 @@ static int s5p_mfc_configure_2port_memory(struct s5p_mfc_dev *mfc_dev) * Create and initialize virtual devices for accessing * reserved memory regions. */ - mfc_dev->mem_dev[BANK1_CTX] = s5p_mfc_alloc_memdev(dev, "left", - BANK1_CTX); - if (!mfc_dev->mem_dev[BANK1_CTX]) + mfc_dev->mem_dev[BANK_L_CTX] = s5p_mfc_alloc_memdev(dev, "left", + BANK_L_CTX); + if (!mfc_dev->mem_dev[BANK_L_CTX]) return -ENODEV; - 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]); + mfc_dev->mem_dev[BANK_R_CTX] = s5p_mfc_alloc_memdev(dev, "right", + BANK_R_CTX); + if (!mfc_dev->mem_dev[BANK_R_CTX]) { + device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); return -ENODEV; } /* Allocate memory for firmware and initialize both banks addresses */ ret = s5p_mfc_alloc_firmware(mfc_dev); if (ret) { - device_unregister(mfc_dev->mem_dev[BANK2_CTX]); - device_unregister(mfc_dev->mem_dev[BANK1_CTX]); + device_unregister(mfc_dev->mem_dev[BANK_R_CTX]); + device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); return ret; } - mfc_dev->dma_base[BANK1_CTX] = mfc_dev->fw_buf.dma; + mfc_dev->dma_base[BANK_L_CTX] = mfc_dev->fw_buf.dma; - bank2_virt = dma_alloc_coherent(mfc_dev->mem_dev[BANK2_CTX], align_size, - &bank2_dma_addr, GFP_KERNEL); + bank2_virt = dma_alloc_coherent(mfc_dev->mem_dev[BANK_R_CTX], + align_size, &bank2_dma_addr, GFP_KERNEL); if (!bank2_virt) { mfc_err("Allocating bank2 base failed\n"); s5p_mfc_release_firmware(mfc_dev); - device_unregister(mfc_dev->mem_dev[BANK2_CTX]); - device_unregister(mfc_dev->mem_dev[BANK1_CTX]); + device_unregister(mfc_dev->mem_dev[BANK_R_CTX]); + device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); return -ENOMEM; } @@ -1153,14 +1153,14 @@ static int s5p_mfc_configure_2port_memory(struct s5p_mfc_dev *mfc_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. */ - mfc_dev->dma_base[BANK2_CTX] = bank2_dma_addr - align_size; + mfc_dev->dma_base[BANK_R_CTX] = bank2_dma_addr - align_size; - dma_free_coherent(mfc_dev->mem_dev[BANK2_CTX], align_size, bank2_virt, + dma_free_coherent(mfc_dev->mem_dev[BANK_R_CTX], align_size, bank2_virt, bank2_dma_addr); - vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK1_CTX], + vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK_L_CTX], DMA_BIT_MASK(32)); - vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK2_CTX], + vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK_R_CTX], DMA_BIT_MASK(32)); return 0; @@ -1168,10 +1168,10 @@ static int s5p_mfc_configure_2port_memory(struct s5p_mfc_dev *mfc_dev) static void s5p_mfc_unconfigure_2port_memory(struct s5p_mfc_dev *mfc_dev) { - device_unregister(mfc_dev->mem_dev[BANK1_CTX]); - device_unregister(mfc_dev->mem_dev[BANK2_CTX]); - vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK1_CTX]); - vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK2_CTX]); + device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); + device_unregister(mfc_dev->mem_dev[BANK_R_CTX]); + vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK_L_CTX]); + vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK_R_CTX]); } static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) @@ -1201,8 +1201,8 @@ static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) return -ENOMEM; } mfc_dev->mem_size = mem_size; - mfc_dev->dma_base[BANK1_CTX] = mfc_dev->mem_base; - mfc_dev->dma_base[BANK2_CTX] = mfc_dev->mem_base; + mfc_dev->dma_base[BANK_L_CTX] = mfc_dev->mem_base; + mfc_dev->dma_base[BANK_R_CTX] = mfc_dev->mem_base; /* * MFC hardware cannot handle 0 as a base address, so mark first 128K @@ -1212,14 +1212,14 @@ static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) unsigned int offset = 1 << MFC_BASE_ALIGN_ORDER; bitmap_set(mfc_dev->mem_bitmap, 0, offset >> PAGE_SHIFT); - mfc_dev->dma_base[BANK1_CTX] += offset; - mfc_dev->dma_base[BANK2_CTX] += offset; + mfc_dev->dma_base[BANK_L_CTX] += offset; + mfc_dev->dma_base[BANK_R_CTX] += offset; } /* Firmware allocation cannot fail in this case */ s5p_mfc_alloc_firmware(mfc_dev); - mfc_dev->mem_dev[BANK1_CTX] = mfc_dev->mem_dev[BANK2_CTX] = dev; + mfc_dev->mem_dev[BANK_L_CTX] = mfc_dev->mem_dev[BANK_R_CTX] = dev; vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); dev_info(dev, "preallocated %ld MiB buffer for the firmware and context buffers\n", diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index e64dc6e3c75e..4220914529b2 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -33,8 +33,8 @@ * while mmaping */ #define DST_QUEUE_OFF_BASE (1 << 30) -#define BANK1_CTX 0 -#define BANK2_CTX 1 +#define BANK_L_CTX 0 +#define BANK_R_CTX 1 #define BANK_CTX_NUM 2 #define MFC_BANK1_ALIGN_ORDER 13 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index a1811ee538bd..69ef9c23a99a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -36,7 +36,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) return -ENOMEM; } - err = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &dev->fw_buf); + err = s5p_mfc_alloc_priv_buf(dev, BANK_L_CTX, &dev->fw_buf); if (err) { mfc_err("Allocating bitprocessor buffer failed\n"); return err; @@ -177,17 +177,18 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev) static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev *dev) { if (IS_MFCV6_PLUS(dev)) { - mfc_write(dev, dev->dma_base[BANK1_CTX], + mfc_write(dev, dev->dma_base[BANK_L_CTX], S5P_FIMV_RISC_BASE_ADDRESS_V6); mfc_debug(2, "Base Address : %pad\n", - &dev->dma_base[BANK1_CTX]); + &dev->dma_base[BANK_L_CTX]); } else { - mfc_write(dev, dev->dma_base[BANK1_CTX], + mfc_write(dev, dev->dma_base[BANK_L_CTX], S5P_FIMV_MC_DRAMBASE_ADR_A); - mfc_write(dev, dev->dma_base[BANK2_CTX], + mfc_write(dev, dev->dma_base[BANK_R_CTX], S5P_FIMV_MC_DRAMBASE_ADR_B); mfc_debug(2, "Bank1: %pad, Bank2: %pad\n", - &dev->dma_base[BANK1_CTX], &dev->dma_base[BANK2_CTX]); + &dev->dma_base[BANK_L_CTX], + &dev->dma_base[BANK_R_CTX]); } } diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index f17062f9070b..8937b0af7cb3 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[BANK1_CTX]; + alloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX]; else - alloc_devs[0] = ctx->dev->mem_dev[BANK2_CTX]; - alloc_devs[1] = ctx->dev->mem_dev[BANK1_CTX]; + alloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX]; + alloc_devs[1] = ctx->dev->mem_dev[BANK_L_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[BANK1_CTX]; + alloc_devs[0] = ctx->dev->mem_dev[BANK_L_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 2eea21f06d7e..2a5fd7c42cd5 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[BANK1_CTX]; + alloc_devs[0] = ctx->dev->mem_dev[BANK_L_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[BANK1_CTX]; - alloc_devs[1] = ctx->dev->mem_dev[BANK1_CTX]; + alloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX]; + alloc_devs[1] = ctx->dev->mem_dev[BANK_L_CTX]; } else { - alloc_devs[0] = ctx->dev->mem_dev[BANK2_CTX]; - alloc_devs[1] = ctx->dev->mem_dev[BANK2_CTX]; + alloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX]; + alloc_devs[1] = ctx->dev->mem_dev[BANK_R_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 20e8a1bdc984..b41ee608c171 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c @@ -30,8 +30,8 @@ #include #include -#define OFFSETA(x) (((x) - dev->dma_base[BANK1_CTX]) >> MFC_OFFSET_SHIFT) -#define OFFSETB(x) (((x) - dev->dma_base[BANK2_CTX]) >> MFC_OFFSET_SHIFT) +#define OFFSETA(x) (((x) - dev->dma_base[BANK_L_CTX]) >> MFC_OFFSET_SHIFT) +#define OFFSETB(x) (((x) - dev->dma_base[BANK_R_CTX]) >> MFC_OFFSET_SHIFT) /* Allocate temporary buffers for decoding */ static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) @@ -41,7 +41,7 @@ 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, BANK1_CTX, &ctx->dsc); + ret = s5p_mfc_alloc_priv_buf(dev, BANK_L_CTX, &ctx->dsc); if (ret) { mfc_err("Failed to allocate temporary buffer\n"); return ret; @@ -172,7 +172,7 @@ 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, BANK1_CTX, &ctx->bank1); + ret = s5p_mfc_alloc_priv_buf(dev, BANK_L_CTX, &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 temporary buffer\n"); return ret; @@ -181,7 +181,7 @@ 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, BANK2_CTX, &ctx->bank2); + ret = s5p_mfc_alloc_priv_buf(dev, BANK_R_CTX, &ctx->bank2); if (ret) { mfc_err("Failed to allocate Bank2 temporary buffer\n"); s5p_mfc_release_priv_buf(ctx->dev, &ctx->bank1); @@ -212,7 +212,7 @@ 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, BANK1_CTX, &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev, BANK_L_CTX, &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -225,7 +225,7 @@ 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, BANK1_CTX, &ctx->shm); + ret = s5p_mfc_alloc_priv_buf(dev, BANK_L_CTX, &ctx->shm); if (ret) { mfc_err("Failed to allocate shared memory buffer\n"); s5p_mfc_release_priv_buf(dev, &ctx->ctx); @@ -233,7 +233,7 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) } /* shared memory offset only keeps the offset from base (port a) */ - ctx->shm.ofs = ctx->shm.dma - dev->dma_base[BANK1_CTX]; + ctx->shm.ofs = ctx->shm.dma - dev->dma_base[BANK_L_CTX]; BUG_ON(ctx->shm.ofs & ((1 << MFC_BANK1_ALIGN_ORDER) - 1)); memset(ctx->shm.virt, 0, buf_size->shm); @@ -532,9 +532,9 @@ static void s5p_mfc_get_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx, { struct s5p_mfc_dev *dev = ctx->dev; - *y_addr = dev->dma_base[BANK2_CTX] + + *y_addr = dev->dma_base[BANK_R_CTX] + (mfc_read(dev, S5P_FIMV_ENCODED_Y_ADDR) << MFC_OFFSET_SHIFT); - *c_addr = dev->dma_base[BANK2_CTX] + + *c_addr = dev->dma_base[BANK_R_CTX] + (mfc_read(dev, S5P_FIMV_ENCODED_C_ADDR) << MFC_OFFSET_SHIFT); } @@ -1212,8 +1212,8 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) } if (list_empty(&ctx->src_queue)) { /* send null frame */ - s5p_mfc_set_enc_frame_buffer_v5(ctx, dev->dma_base[BANK2_CTX], - dev->dma_base[BANK2_CTX]); + s5p_mfc_set_enc_frame_buffer_v5(ctx, dev->dma_base[BANK_R_CTX], + dev->dma_base[BANK_R_CTX]); src_mb = NULL; } else { src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, @@ -1222,8 +1222,8 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) if (src_mb->b->vb2_buf.planes[0].bytesused == 0) { /* send null frame */ s5p_mfc_set_enc_frame_buffer_v5(ctx, - dev->dma_base[BANK2_CTX], - dev->dma_base[BANK2_CTX]); + dev->dma_base[BANK_R_CTX], + dev->dma_base[BANK_R_CTX]); ctx->state = MFCINST_FINISHING; } else { src_y_addr = vb2_dma_contig_plane_dma_addr( 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 50cc9351d1af..70071a12db16 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c @@ -239,7 +239,7 @@ 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, BANK1_CTX, &ctx->bank1); + ret = s5p_mfc_alloc_priv_buf(dev, BANK_L_CTX, &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 memory\n"); return ret; @@ -291,7 +291,7 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) break; } - ret = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev, BANK_L_CTX, &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -320,7 +320,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, BANK1_CTX, &dev->ctx_buf); + ret = s5p_mfc_alloc_priv_buf(dev, BANK_L_CTX, &dev->ctx_buf); if (ret) { mfc_err("Failed to allocate device context buffer\n"); return ret;