.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2016 MediaTek Inc. |
---|
3 | 4 | * Author: PC Chen <pc.chen@mediatek.com> |
---|
4 | 5 | * 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. |
---|
14 | 6 | */ |
---|
15 | 7 | |
---|
16 | 8 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
21 | 13 | #include "mtk_vcodec_dec.h" |
---|
22 | 14 | #include "vdec_drv_base.h" |
---|
23 | 15 | #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); |
---|
29 | 16 | |
---|
30 | 17 | int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc) |
---|
31 | 18 | { |
---|
.. | .. |
---|
33 | 20 | |
---|
34 | 21 | switch (fourcc) { |
---|
35 | 22 | case V4L2_PIX_FMT_H264: |
---|
36 | | - ctx->dec_if = get_h264_dec_comm_if(); |
---|
| 23 | + ctx->dec_if = &vdec_h264_if; |
---|
37 | 24 | break; |
---|
38 | 25 | case V4L2_PIX_FMT_VP8: |
---|
39 | | - ctx->dec_if = get_vp8_dec_comm_if(); |
---|
| 26 | + ctx->dec_if = &vdec_vp8_if; |
---|
40 | 27 | break; |
---|
41 | 28 | case V4L2_PIX_FMT_VP9: |
---|
42 | | - ctx->dec_if = get_vp9_dec_comm_if(); |
---|
| 29 | + ctx->dec_if = &vdec_vp9_if; |
---|
43 | 30 | break; |
---|
44 | 31 | default: |
---|
45 | 32 | return -EINVAL; |
---|
.. | .. |
---|
47 | 34 | |
---|
48 | 35 | mtk_vdec_lock(ctx); |
---|
49 | 36 | 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); |
---|
51 | 38 | mtk_vcodec_dec_clock_off(&ctx->dev->pm); |
---|
52 | 39 | mtk_vdec_unlock(ctx); |
---|
53 | 40 | |
---|
.. | .. |
---|
74 | 61 | } |
---|
75 | 62 | } |
---|
76 | 63 | |
---|
77 | | - if (ctx->drv_handle == 0) |
---|
| 64 | + if (!ctx->drv_handle) |
---|
78 | 65 | return -EIO; |
---|
79 | 66 | |
---|
80 | 67 | mtk_vdec_lock(ctx); |
---|
.. | .. |
---|
97 | 84 | { |
---|
98 | 85 | int ret = 0; |
---|
99 | 86 | |
---|
100 | | - if (ctx->drv_handle == 0) |
---|
| 87 | + if (!ctx->drv_handle) |
---|
101 | 88 | return -EIO; |
---|
102 | 89 | |
---|
103 | 90 | mtk_vdec_lock(ctx); |
---|
.. | .. |
---|
109 | 96 | |
---|
110 | 97 | void vdec_if_deinit(struct mtk_vcodec_ctx *ctx) |
---|
111 | 98 | { |
---|
112 | | - if (ctx->drv_handle == 0) |
---|
| 99 | + if (!ctx->drv_handle) |
---|
113 | 100 | return; |
---|
114 | 101 | |
---|
115 | 102 | mtk_vdec_lock(ctx); |
---|
.. | .. |
---|
118 | 105 | mtk_vcodec_dec_clock_off(&ctx->dev->pm); |
---|
119 | 106 | mtk_vdec_unlock(ctx); |
---|
120 | 107 | |
---|
121 | | - ctx->drv_handle = 0; |
---|
| 108 | + ctx->drv_handle = NULL; |
---|
122 | 109 | } |
---|