media: mtk-vcodec: Align vcodec wake up interrupt interface
authorYunfei Dong <yunfei.dong@mediatek.com>
Thu, 13 Jan 2022 04:10:38 +0000 (05:10 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 23 Jan 2022 20:18:44 +0000 (21:18 +0100)
Vdec and venc can use the same function to wake up interrupt event.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Steve Cho <stevecho@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c

index 6980549e56e88a026fb6460c9da34d54a66ad3b6..30257e4f989b2f342c8b58733fe4a1d94b49efc3 100644 (file)
 #define VDEC_IRQ_CLR   0x10
 #define VDEC_IRQ_CFG_REG       0xa4
 
-/* Wake up context wait_queue */
-static void wake_up_ctx(struct mtk_vcodec_ctx *ctx)
-{
-       ctx->int_cond = 1;
-       wake_up_interruptible(&ctx->queue);
-}
-
 static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv)
 {
        struct mtk_vcodec_dev *dev = priv;
@@ -66,7 +59,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv)
        writel((readl(vdec_misc_addr) & ~VDEC_IRQ_CLR),
                dev->reg_base[VDEC_MISC] + VDEC_IRQ_CFG_REG);
 
-       wake_up_ctx(ctx);
+       wake_up_ctx(ctx, MTK_INST_IRQ_RECEIVED);
 
        mtk_v4l2_debug(3,
                        "mtk_vcodec_dec_irq_handler :wake up ctx %d, dec_done_status=%x",
index 58152217730865f09861cd6ba8eb794484a74e11..1d2370608d0d27f5383d81e887ed279249557476 100644 (file)
@@ -473,4 +473,12 @@ static inline struct mtk_vcodec_ctx *ctrl_to_ctx(struct v4l2_ctrl *ctrl)
        return container_of(ctrl->handler, struct mtk_vcodec_ctx, ctrl_hdl);
 }
 
+/* Wake up context wait_queue */
+static inline void wake_up_ctx(struct mtk_vcodec_ctx *ctx, unsigned int reason)
+{
+       ctx->int_cond = 1;
+       ctx->int_type = reason;
+       wake_up_interruptible(&ctx->queue);
+}
+
 #endif /* _MTK_VCODEC_DRV_H_ */
index aeaecb8d416e30b2b7143cc6bb68f372fd8da667..027546108f4409a041014ea91771320c3c2f9d9c 100644 (file)
@@ -62,14 +62,6 @@ static const struct mtk_video_fmt mtk_video_formats_capture_vp8[] =  {
        },
 };
 
-/* Wake up context wait_queue */
-static void wake_up_ctx(struct mtk_vcodec_ctx *ctx, unsigned int reason)
-{
-       ctx->int_cond = 1;
-       ctx->int_type = 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)