From nobody Sun Sep 22 13:25:02 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19140C433F5 for ; Thu, 16 Dec 2021 09:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235661AbhLPJqK (ORCPT ); Thu, 16 Dec 2021 04:46:10 -0500 Received: from mailgw01.mediatek.com ([60.244.123.138]:42666 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S235589AbhLPJqC (ORCPT ); Thu, 16 Dec 2021 04:46:02 -0500 X-UUID: dfe0f3bb7dd0467783208b365ee372d8-20211216 X-UUID: dfe0f3bb7dd0467783208b365ee372d8-20211216 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1149101326; Thu, 16 Dec 2021 17:45:56 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Thu, 16 Dec 2021 17:45:56 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 16 Dec 2021 17:45:54 +0800 From: Yunfei Dong To: Yunfei Dong , Alexandre Courbot , Hans Verkuil , "Tzung-Bi Shih" , Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Tomasz Figa CC: Hsin-Yi Wang , Fritz Koenig , Dafna Hirschfeld , Benjamin Gaignard , Daniel Vetter , dri-devel , Irui Wang , AngeloGioacchino Del Regno , "Steve Cho" , , , , , , , Subject: [PATCH v16, 02/19] media: mtk-vcodec: Align vcodec wake up interrupt interface Date: Thu, 16 Dec 2021 17:45:35 +0800 Message-ID: <20211216094552.19104-3-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211216094552.19104-1-yunfei.dong@mediatek.com> References: <20211216094552.19104-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Vdec and venc can use the same function to wake up interrupt event. Signed-off-by: Yunfei Dong Reviewed-by: Tzung-Bi Shih Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Steve Cho --- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 9 +-------- drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 8 ++++++++ drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 8 -------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drive= rs/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c index e1a82e233971..e5f6e400a587 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c @@ -28,13 +28,6 @@ #define VDEC_IRQ_CLR 0x10 #define VDEC_IRQ_CFG_REG 0xa4 =20 -/* Wake up context wait_queue */ -static void wake_up_ctx(struct mtk_vcodec_ctx *ctx) -{ - ctx->int_cond =3D 1; - wake_up_interruptible(&ctx->queue); -} - static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv) { struct mtk_vcodec_dev *dev =3D priv; @@ -66,7 +59,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, vo= id *priv) writel((readl(vdec_misc_addr) & ~VDEC_IRQ_CLR), dev->reg_base[VDEC_MISC] + VDEC_IRQ_CFG_REG); =20 - wake_up_ctx(ctx); + wake_up_ctx(ctx, MTK_INST_IRQ_RECEIVED); =20 mtk_v4l2_debug(3, "mtk_vcodec_dec_irq_handler :wake up ctx %d, dec_done_status=3D%x", diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/m= edia/platform/mtk-vcodec/mtk_vcodec_drv.h index 581522177308..1d2370608d0d 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h @@ -473,4 +473,12 @@ static inline struct mtk_vcodec_ctx *ctrl_to_ctx(struc= t v4l2_ctrl *ctrl) return container_of(ctrl->handler, struct mtk_vcodec_ctx, ctrl_hdl); } =20 +/* Wake up context wait_queue */ +static inline void wake_up_ctx(struct mtk_vcodec_ctx *ctx, unsigned int re= ason) +{ + ctx->int_cond =3D 1; + ctx->int_type =3D reason; + wake_up_interruptible(&ctx->queue); +} + #endif /* _MTK_VCODEC_DRV_H_ */ diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drive= rs/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index aeaecb8d416e..027546108f44 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -62,14 +62,6 @@ static const struct mtk_video_fmt mtk_video_formats_capt= ure_vp8[] =3D { }, }; =20 -/* Wake up context wait_queue */ -static void wake_up_ctx(struct mtk_vcodec_ctx *ctx, unsigned int reason) -{ - ctx->int_cond =3D 1; - ctx->int_type =3D reason; - wake_up_interruptible(&ctx->queue); -} - static void clean_irq_status(unsigned int irq_status, void __iomem *addr) { if (irq_status & MTK_VENC_IRQ_STATUS_PAUSE) --=20 2.25.1