hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
....@@ -1,16 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (c) 2016 MediaTek Inc.
34 * Author: Jungchang Tsao <jungchang.tsao@mediatek.com>
45 * PC Chen <pc.chen@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/slab.h>
....@@ -120,7 +112,7 @@
120112 /**
121113 * struct vdec_vp8_vpu_inst - VPU instance for VP8 decode
122114 * @wq_hd : Wait queue to wait VPU message ack
123
- * @signaled : 1 - Host has received ack message from VPU, 0 - not recevie
115
+ * @signaled : 1 - Host has received ack message from VPU, 0 - not receive
124116 * @failure : VPU execution result status 0 - success, others - fail
125117 * @inst_addr : VPU decoder instance address
126118 */
....@@ -294,8 +286,8 @@
294286
295287 mtk_vcodec_debug(inst, "pic(%d, %d), buf(%d, %d)",
296288 pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h);
297
- mtk_vcodec_debug(inst, "Y(%d, %d), C(%d, %d)", pic->y_bs_sz,
298
- pic->y_len_sz, pic->c_bs_sz, pic->c_len_sz);
289
+ mtk_vcodec_debug(inst, "fb size: Y(%d), C(%d)",
290
+ pic->fb_sz[0], pic->fb_sz[1]);
299291 }
300292
301293 static void vp8_dec_finish(struct vdec_vp8_inst *inst)
....@@ -396,7 +388,7 @@
396388 inst->vsi->dec.working_buf_dma = 0;
397389 }
398390
399
-static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)
391
+static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx)
400392 {
401393 struct vdec_vp8_inst *inst;
402394 int err;
....@@ -408,9 +400,7 @@
408400 inst->ctx = ctx;
409401
410402 inst->vpu.id = IPI_VDEC_VP8;
411
- inst->vpu.dev = ctx->dev->vpu_plat_dev;
412403 inst->vpu.ctx = ctx;
413
- inst->vpu.handler = vpu_dec_ipi_handler;
414404
415405 err = vpu_dec_init(&inst->vpu);
416406 if (err) {
....@@ -427,7 +417,7 @@
427417 get_hw_reg_base(inst);
428418 mtk_vcodec_debug(inst, "VP8 Instance >> %p", inst);
429419
430
- *h_vdec = (unsigned long)inst;
420
+ ctx->drv_handle = inst;
431421 return 0;
432422
433423 error_deinit:
....@@ -437,7 +427,7 @@
437427 return err;
438428 }
439429
440
-static int vdec_vp8_decode(unsigned long h_vdec, struct mtk_vcodec_mem *bs,
430
+static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
441431 struct vdec_fb *fb, bool *res_chg)
442432 {
443433 struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
....@@ -573,8 +563,8 @@
573563 cr->left, cr->top, cr->width, cr->height);
574564 }
575565
576
-static int vdec_vp8_get_param(unsigned long h_vdec,
577
- enum vdec_get_param_type type, void *out)
566
+static int vdec_vp8_get_param(void *h_vdec, enum vdec_get_param_type type,
567
+ void *out)
578568 {
579569 struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
580570
....@@ -607,7 +597,7 @@
607597 return 0;
608598 }
609599
610
-static void vdec_vp8_deinit(unsigned long h_vdec)
600
+static void vdec_vp8_deinit(void *h_vdec)
611601 {
612602 struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
613603
....@@ -618,16 +608,9 @@
618608 kfree(inst);
619609 }
620610
621
-static struct vdec_common_if vdec_vp8_if = {
611
+const struct vdec_common_if vdec_vp8_if = {
622612 .init = vdec_vp8_init,
623613 .decode = vdec_vp8_decode,
624614 .get_param = vdec_vp8_get_param,
625615 .deinit = vdec_vp8_deinit,
626616 };
627
-
628
-struct vdec_common_if *get_vp8_dec_comm_if(void);
629
-
630
-struct vdec_common_if *get_vp8_dec_comm_if(void)
631
-{
632
- return &vdec_vp8_if;
633
-}