forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/media/platform/mtk-vcodec/vdec_drv_if.c
....@@ -1,16 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (c) 2016 MediaTek Inc.
34 * Author: PC Chen <pc.chen@mediatek.com>
45 * Tiffany Lin <tiffany.lin@mediatek.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
146 */
157
168 #include <linux/interrupt.h>
....@@ -21,11 +13,6 @@
2113 #include "mtk_vcodec_dec.h"
2214 #include "vdec_drv_base.h"
2315 #include "mtk_vcodec_dec_pm.h"
24
-#include "mtk_vpu.h"
25
-
26
-const struct vdec_common_if *get_h264_dec_comm_if(void);
27
-const struct vdec_common_if *get_vp8_dec_comm_if(void);
28
-const struct vdec_common_if *get_vp9_dec_comm_if(void);
2916
3017 int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
3118 {
....@@ -33,13 +20,13 @@
3320
3421 switch (fourcc) {
3522 case V4L2_PIX_FMT_H264:
36
- ctx->dec_if = get_h264_dec_comm_if();
23
+ ctx->dec_if = &vdec_h264_if;
3724 break;
3825 case V4L2_PIX_FMT_VP8:
39
- ctx->dec_if = get_vp8_dec_comm_if();
26
+ ctx->dec_if = &vdec_vp8_if;
4027 break;
4128 case V4L2_PIX_FMT_VP9:
42
- ctx->dec_if = get_vp9_dec_comm_if();
29
+ ctx->dec_if = &vdec_vp9_if;
4330 break;
4431 default:
4532 return -EINVAL;
....@@ -47,7 +34,7 @@
4734
4835 mtk_vdec_lock(ctx);
4936 mtk_vcodec_dec_clock_on(&ctx->dev->pm);
50
- ret = ctx->dec_if->init(ctx, &ctx->drv_handle);
37
+ ret = ctx->dec_if->init(ctx);
5138 mtk_vcodec_dec_clock_off(&ctx->dev->pm);
5239 mtk_vdec_unlock(ctx);
5340
....@@ -74,7 +61,7 @@
7461 }
7562 }
7663
77
- if (ctx->drv_handle == 0)
64
+ if (!ctx->drv_handle)
7865 return -EIO;
7966
8067 mtk_vdec_lock(ctx);
....@@ -97,7 +84,7 @@
9784 {
9885 int ret = 0;
9986
100
- if (ctx->drv_handle == 0)
87
+ if (!ctx->drv_handle)
10188 return -EIO;
10289
10390 mtk_vdec_lock(ctx);
....@@ -109,7 +96,7 @@
10996
11097 void vdec_if_deinit(struct mtk_vcodec_ctx *ctx)
11198 {
112
- if (ctx->drv_handle == 0)
99
+ if (!ctx->drv_handle)
113100 return;
114101
115102 mtk_vdec_lock(ctx);
....@@ -118,5 +105,5 @@
118105 mtk_vcodec_dec_clock_off(&ctx->dev->pm);
119106 mtk_vdec_unlock(ctx);
120107
121
- ctx->drv_handle = 0;
108
+ ctx->drv_handle = NULL;
122109 }