.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2016 MediaTek Inc. |
---|
3 | 4 | * Author: Daniel Hsiao <daniel.hsiao@mediatek.com> |
---|
4 | 5 | * Jungchang Tsao <jungchang.tsao@mediatek.com> |
---|
5 | 6 | * 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. |
---|
16 | 7 | */ |
---|
17 | 8 | |
---|
18 | 9 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
24 | 15 | |
---|
25 | 16 | #include "mtk_vcodec_enc.h" |
---|
26 | 17 | #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); |
---|
31 | 18 | |
---|
32 | 19 | int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc) |
---|
33 | 20 | { |
---|
.. | .. |
---|
35 | 22 | |
---|
36 | 23 | switch (fourcc) { |
---|
37 | 24 | case V4L2_PIX_FMT_VP8: |
---|
38 | | - ctx->enc_if = get_vp8_enc_comm_if(); |
---|
| 25 | + ctx->enc_if = &venc_vp8_if; |
---|
39 | 26 | break; |
---|
40 | 27 | case V4L2_PIX_FMT_H264: |
---|
41 | | - ctx->enc_if = get_h264_enc_comm_if(); |
---|
| 28 | + ctx->enc_if = &venc_h264_if; |
---|
42 | 29 | break; |
---|
43 | 30 | default: |
---|
44 | 31 | return -EINVAL; |
---|
.. | .. |
---|
46 | 33 | |
---|
47 | 34 | mtk_venc_lock(ctx); |
---|
48 | 35 | 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); |
---|
50 | 37 | mtk_vcodec_enc_clock_off(&ctx->dev->pm); |
---|
51 | 38 | mtk_venc_unlock(ctx); |
---|
52 | 39 | |
---|
.. | .. |
---|
98 | 85 | { |
---|
99 | 86 | int ret = 0; |
---|
100 | 87 | |
---|
101 | | - if (ctx->drv_handle == 0) |
---|
| 88 | + if (!ctx->drv_handle) |
---|
102 | 89 | return 0; |
---|
103 | 90 | |
---|
104 | 91 | mtk_venc_lock(ctx); |
---|
.. | .. |
---|
107 | 94 | mtk_vcodec_enc_clock_off(&ctx->dev->pm); |
---|
108 | 95 | mtk_venc_unlock(ctx); |
---|
109 | 96 | |
---|
110 | | - ctx->drv_handle = 0; |
---|
| 97 | + ctx->drv_handle = NULL; |
---|
111 | 98 | |
---|
112 | 99 | return ret; |
---|
113 | 100 | } |
---|