From patchwork Mon Jan 17 12:06:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 12715371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E06A2C433EF for ; Mon, 17 Jan 2022 12:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FjO4lRgDWa1N0x1vH1EY98OPlJteV/ReN85Sf7LnF90=; b=N02+Ty2dJd40TR SFodWo0H0Gn76gCa831XKYg+Nb7WxiQr+owKhestYIc5Alk4urZPXriepLFBJKYvsIwAA1v0ycNGw B+rB6d0M1k+EFZBgWODiORj4YOZrU8G5kTsPFckQQadFY/gvyRlp+B5tDFnpgeohiTKUSrfSUc1I2 voT/qVzM9rOhFfUaAZmzVRzmzmXd9aY1bbdFZMl1Djv0693D46Y/RBdIxPwP+IlkPG1Be1virl1Yt 0U/vFwDCRrZT0RjiTaeIa4laRyy60+i/l+07m+nyEBkRKfujgHpGOx3FSilOcwaMnHUs33Q4Udrs7 NJn4+kTaMIuG/UFo94nQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9Qr8-00EoTx-DU; Mon, 17 Jan 2022 12:11:26 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9Qr0-00EoR8-N4; Mon, 17 Jan 2022 12:11:20 +0000 X-UUID: 939ac5945662418786dad685ed9be9a0-20220117 X-UUID: 939ac5945662418786dad685ed9be9a0-20220117 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 524940368; Mon, 17 Jan 2022 05:11:17 -0700 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 17 Jan 2022 04:06:28 -0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 17 Jan 2022 20:06:26 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 17 Jan 2022 20:06:25 +0800 From: Irui Wang To: Hans Verkuil , Tzung-Bi Shih , Alexandre Courbot , "Tiffany Lin" , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Tomasz Figa , Yong Wu , CC: Hsin-Yi Wang , Maoguang Meng , Longfei Wang , Yunfei Dong , Fritz Koenig , Irui Wang , , , , , , , Subject: [PATCH v2, 01/10] media: mtk-vcodec: Use core type to indicate h264 and vp8 enc Date: Mon, 17 Jan 2022 20:06:06 +0800 Message-ID: <20220117120615.21687-2-irui.wang@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117120615.21687-1-irui.wang@mediatek.com> References: <20220117120615.21687-1-irui.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220117_041118_766465_89B409BC X-CRM114-Status: GOOD ( 15.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org use core type variables to indicate h264 and vp8 encoder Signed-off-by: Irui Wang --- .../platform/mtk-vcodec/mtk_vcodec_drv.h | 4 +-- .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 30 ++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h index cd2939b47790..f78463ff4551 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h @@ -419,7 +419,7 @@ struct mtk_vcodec_dec_pdata { * @num_capture_formats: number of entries in capture_formats * @output_formats: array of supported output formats * @num_output_formats: number of entries in output_formats - * @core_id: stand for h264 or vp8 encode index + * @core_type: stand for h264 or vp8 encode */ struct mtk_vcodec_enc_pdata { bool uses_ext; @@ -429,7 +429,7 @@ struct mtk_vcodec_enc_pdata { size_t num_capture_formats; const struct mtk_video_fmt *output_formats; size_t num_output_formats; - int core_id; + int core_type; }; #define MTK_ENC_CTX_IS_EXT(ctx) ((ctx)->dev->venc_pdata->uses_ext) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index 3ac6969c54c0..1f950310a3fb 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -95,11 +95,13 @@ static irqreturn_t mtk_vcodec_enc_irq_handler(int irq, void *priv) ctx = dev->curr_ctx; spin_unlock_irqrestore(&dev->irqlock, flags); - mtk_v4l2_debug(1, "id=%d coreid:%d", ctx->id, dev->venc_pdata->core_id); - addr = dev->reg_base[dev->venc_pdata->core_id] + + mtk_v4l2_debug(1, "id: %d core type: %d", + ctx->id, dev->venc_pdata->core_type); + + addr = dev->reg_base[dev->venc_pdata->core_type] + MTK_VENC_IRQ_ACK_OFFSET; - ctx->irq_status = readl(dev->reg_base[dev->venc_pdata->core_id] + + ctx->irq_status = readl(dev->reg_base[dev->venc_pdata->core_type] + (MTK_VENC_IRQ_STATUS_OFFSET)); clean_irq_status(ctx->irq_status, addr); @@ -266,10 +268,10 @@ static int mtk_vcodec_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); - dev->reg_base[dev->venc_pdata->core_id] = + dev->reg_base[dev->venc_pdata->core_type] = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(dev->reg_base[dev->venc_pdata->core_id])) { - ret = PTR_ERR(dev->reg_base[dev->venc_pdata->core_id]); + if (IS_ERR(dev->reg_base[dev->venc_pdata->core_type])) { + ret = PTR_ERR(dev->reg_base[dev->venc_pdata->core_type]); goto err_res; } @@ -287,8 +289,8 @@ static int mtk_vcodec_probe(struct platform_device *pdev) 0, pdev->name, dev); if (ret) { dev_err(&pdev->dev, - "Failed to install dev->enc_irq %d (%d) core_id (%d)", - dev->enc_irq, ret, dev->venc_pdata->core_id); + "Failed to install dev->enc_irq %d (%d) core_type (%d)", + dev->enc_irq, ret, dev->venc_pdata->core_type); ret = -EINVAL; goto err_res; } @@ -357,7 +359,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) } mtk_v4l2_debug(0, "encoder %d registered as /dev/video%d", - dev->venc_pdata->core_id, vfd_enc->num); + dev->venc_pdata->core_type, vfd_enc->num); return 0; @@ -384,7 +386,7 @@ static const struct mtk_vcodec_enc_pdata mt8173_avc_pdata = { .num_output_formats = ARRAY_SIZE(mtk_video_formats_output), .min_bitrate = 64, .max_bitrate = 60000000, - .core_id = VENC_SYS, + .core_type = VENC_SYS, }; static const struct mtk_vcodec_enc_pdata mt8173_vp8_pdata = { @@ -394,7 +396,7 @@ static const struct mtk_vcodec_enc_pdata mt8173_vp8_pdata = { .num_output_formats = ARRAY_SIZE(mtk_video_formats_output), .min_bitrate = 64, .max_bitrate = 9000000, - .core_id = VENC_LT_SYS, + .core_type = VENC_LT_SYS, }; static const struct mtk_vcodec_enc_pdata mt8183_pdata = { @@ -405,7 +407,7 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = { .num_output_formats = ARRAY_SIZE(mtk_video_formats_output), .min_bitrate = 64, .max_bitrate = 40000000, - .core_id = VENC_SYS, + .core_type = VENC_SYS, }; static const struct mtk_vcodec_enc_pdata mt8192_pdata = { @@ -416,7 +418,7 @@ static const struct mtk_vcodec_enc_pdata mt8192_pdata = { .num_output_formats = ARRAY_SIZE(mtk_video_formats_output), .min_bitrate = 64, .max_bitrate = 100000000, - .core_id = VENC_SYS, + .core_type = VENC_SYS, }; static const struct mtk_vcodec_enc_pdata mt8195_pdata = { @@ -427,7 +429,7 @@ static const struct mtk_vcodec_enc_pdata mt8195_pdata = { .num_output_formats = ARRAY_SIZE(mtk_video_formats_output), .min_bitrate = 64, .max_bitrate = 100000000, - .core_id = VENC_SYS, + .core_type = VENC_SYS, }; static const struct of_device_id mtk_vcodec_enc_match[] = {