hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
....@@ -1,23 +1,16 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (c) 2016 MediaTek Inc.
34 * Author: PC Chen <pc.chen@mediatek.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 as
7
- * published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
135 */
146
157 #include "mtk_vcodec_drv.h"
168 #include "mtk_vcodec_util.h"
179 #include "vdec_ipi_msg.h"
1810 #include "vdec_vpu_if.h"
11
+#include "mtk_vcodec_fw.h"
1912
20
-static void handle_init_ack_msg(struct vdec_vpu_ipi_init_ack *msg)
13
+static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg)
2114 {
2215 struct vdec_vpu_inst *vpu = (struct vdec_vpu_inst *)
2316 (unsigned long)msg->ap_inst_addr;
....@@ -26,19 +19,26 @@
2619
2720 /* mapping VPU address to kernel virtual address */
2821 /* the content in vsi is initialized to 0 in VPU */
29
- vpu->vsi = vpu_mapping_dm_addr(vpu->dev, msg->vpu_inst_addr);
22
+ vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev->fw_handler,
23
+ msg->vpu_inst_addr);
3024 vpu->inst_addr = msg->vpu_inst_addr;
3125
3226 mtk_vcodec_debug(vpu, "- vpu_inst_addr = 0x%x", vpu->inst_addr);
3327 }
3428
3529 /*
30
+ * vpu_dec_ipi_handler - Handler for VPU ipi message.
31
+ *
32
+ * @data: ipi message
33
+ * @len : length of ipi message
34
+ * @priv: callback private data which is passed by decoder when register.
35
+ *
3636 * This function runs in interrupt context and it means there's an IPI MSG
3737 * from VPU.
3838 */
39
-void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv)
39
+static void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv)
4040 {
41
- struct vdec_vpu_ipi_ack *msg = data;
41
+ const struct vdec_vpu_ipi_ack *msg = data;
4242 struct vdec_vpu_inst *vpu = (struct vdec_vpu_inst *)
4343 (unsigned long)msg->ap_inst_addr;
4444
....@@ -76,7 +76,8 @@
7676 vpu->failure = 0;
7777 vpu->signaled = 0;
7878
79
- err = vpu_ipi_send(vpu->dev, vpu->id, msg, len);
79
+ err = mtk_vcodec_fw_ipi_send(vpu->ctx->dev->fw_handler, vpu->id, msg,
80
+ len, 2000);
8081 if (err) {
8182 mtk_vcodec_err(vpu, "send fail vpu_id=%d msg_id=%X status=%d",
8283 vpu->id, *(uint32_t *)msg, err);
....@@ -110,8 +111,10 @@
110111 mtk_vcodec_debug_enter(vpu);
111112
112113 init_waitqueue_head(&vpu->wq);
114
+ vpu->handler = vpu_dec_ipi_handler;
113115
114
- err = vpu_ipi_register(vpu->dev, vpu->id, vpu->handler, "vdec", NULL);
116
+ err = mtk_vcodec_fw_ipi_register(vpu->ctx->dev->fw_handler, vpu->id,
117
+ vpu->handler, "vdec", NULL);
115118 if (err != 0) {
116119 mtk_vcodec_err(vpu, "vpu_ipi_register fail status=%d", err);
117120 return err;