forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/media/platform/mtk-vcodec/venc_drv_if.c
....@@ -1,18 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (c) 2016 MediaTek Inc.
34 * Author: Daniel Hsiao <daniel.hsiao@mediatek.com>
45 * Jungchang Tsao <jungchang.tsao@mediatek.com>
56 * Tiffany Lin <tiffany.lin@mediatek.com>
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
167 */
178
189 #include <linux/interrupt.h>
....@@ -24,10 +15,6 @@
2415
2516 #include "mtk_vcodec_enc.h"
2617 #include "mtk_vcodec_enc_pm.h"
27
-#include "mtk_vpu.h"
28
-
29
-const struct venc_common_if *get_h264_enc_comm_if(void);
30
-const struct venc_common_if *get_vp8_enc_comm_if(void);
3118
3219 int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
3320 {
....@@ -35,10 +22,10 @@
3522
3623 switch (fourcc) {
3724 case V4L2_PIX_FMT_VP8:
38
- ctx->enc_if = get_vp8_enc_comm_if();
25
+ ctx->enc_if = &venc_vp8_if;
3926 break;
4027 case V4L2_PIX_FMT_H264:
41
- ctx->enc_if = get_h264_enc_comm_if();
28
+ ctx->enc_if = &venc_h264_if;
4229 break;
4330 default:
4431 return -EINVAL;
....@@ -46,7 +33,7 @@
4633
4734 mtk_venc_lock(ctx);
4835 mtk_vcodec_enc_clock_on(&ctx->dev->pm);
49
- ret = ctx->enc_if->init(ctx, (unsigned long *)&ctx->drv_handle);
36
+ ret = ctx->enc_if->init(ctx);
5037 mtk_vcodec_enc_clock_off(&ctx->dev->pm);
5138 mtk_venc_unlock(ctx);
5239
....@@ -98,7 +85,7 @@
9885 {
9986 int ret = 0;
10087
101
- if (ctx->drv_handle == 0)
88
+ if (!ctx->drv_handle)
10289 return 0;
10390
10491 mtk_venc_lock(ctx);
....@@ -107,7 +94,7 @@
10794 mtk_vcodec_enc_clock_off(&ctx->dev->pm);
10895 mtk_venc_unlock(ctx);
10996
110
- ctx->drv_handle = 0;
97
+ ctx->drv_handle = NULL;
11198
11299 return ret;
113100 }