Lines Matching +full:imx8qm +full:- +full:vpu

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright 2020-2021 NXP
15 #include "vpu.h"
25 if (!ops || !ops->check_memory_region) in vpu_iface_check_memory_region()
28 return ops->check_memory_region(core->fw.phys, addr, size); in vpu_iface_check_memory_region()
37 size = desc->end - desc->start; in vpu_rpc_check_buffer_space()
39 ptr1 = desc->wptr; in vpu_rpc_check_buffer_space()
40 ptr2 = desc->rptr; in vpu_rpc_check_buffer_space()
42 ptr1 = desc->rptr; in vpu_rpc_check_buffer_space()
43 ptr2 = desc->wptr; in vpu_rpc_check_buffer_space()
53 return (ptr2 + size - ptr1) % size; in vpu_rpc_check_buffer_space()
64 if (cmd->hdr.num > 0xff || cmd->hdr.num >= ARRAY_SIZE(cmd->data)) in vpu_rpc_send_cmd_buf()
65 return -EINVAL; in vpu_rpc_send_cmd_buf()
66 desc = shared->cmd_desc; in vpu_rpc_send_cmd_buf()
68 if (space < (((cmd->hdr.num + 1) << 2) + 16)) in vpu_rpc_send_cmd_buf()
69 return -EINVAL; in vpu_rpc_send_cmd_buf()
70 wptr = desc->wptr; in vpu_rpc_send_cmd_buf()
71 data = (u32 *)(shared->cmd_mem_vir + desc->wptr - desc->start); in vpu_rpc_send_cmd_buf()
73 *data |= ((cmd->hdr.index & 0xff) << 24); in vpu_rpc_send_cmd_buf()
74 *data |= ((cmd->hdr.num & 0xff) << 16); in vpu_rpc_send_cmd_buf()
75 *data |= (cmd->hdr.id & 0x3fff); in vpu_rpc_send_cmd_buf()
78 if (wptr >= desc->end) { in vpu_rpc_send_cmd_buf()
79 wptr = desc->start; in vpu_rpc_send_cmd_buf()
80 data = shared->cmd_mem_vir; in vpu_rpc_send_cmd_buf()
83 for (i = 0; i < cmd->hdr.num; i++) { in vpu_rpc_send_cmd_buf()
84 *data = cmd->data[i]; in vpu_rpc_send_cmd_buf()
87 if (wptr >= desc->end) { in vpu_rpc_send_cmd_buf()
88 wptr = desc->start; in vpu_rpc_send_cmd_buf()
89 data = shared->cmd_mem_vir; in vpu_rpc_send_cmd_buf()
95 desc->wptr = wptr; in vpu_rpc_send_cmd_buf()
107 desc = shared->msg_desc; in vpu_rpc_check_msg()
112 msgword = *(u32 *)(shared->msg_mem_vir + desc->rptr - desc->start); in vpu_rpc_check_msg()
130 return -EINVAL; in vpu_rpc_receive_msg_buf()
132 desc = shared->msg_desc; in vpu_rpc_receive_msg_buf()
133 data = (u32 *)(shared->msg_mem_vir + desc->rptr - desc->start); in vpu_rpc_receive_msg_buf()
134 rptr = desc->rptr; in vpu_rpc_receive_msg_buf()
138 if (rptr >= desc->end) { in vpu_rpc_receive_msg_buf()
139 rptr = desc->start; in vpu_rpc_receive_msg_buf()
140 data = shared->msg_mem_vir; in vpu_rpc_receive_msg_buf()
143 msg->hdr.index = (msgword >> 24) & 0xff; in vpu_rpc_receive_msg_buf()
144 msg->hdr.num = (msgword >> 16) & 0xff; in vpu_rpc_receive_msg_buf()
145 msg->hdr.id = msgword & 0x3fff; in vpu_rpc_receive_msg_buf()
147 if (msg->hdr.num > ARRAY_SIZE(msg->data)) in vpu_rpc_receive_msg_buf()
148 return -EINVAL; in vpu_rpc_receive_msg_buf()
150 for (i = 0; i < msg->hdr.num; i++) { in vpu_rpc_receive_msg_buf()
151 msg->data[i] = *data; in vpu_rpc_receive_msg_buf()
154 if (rptr >= desc->end) { in vpu_rpc_receive_msg_buf()
155 rptr = desc->start; in vpu_rpc_receive_msg_buf()
156 data = shared->msg_mem_vir; in vpu_rpc_receive_msg_buf()
162 desc->rptr = rptr; in vpu_rpc_receive_msg_buf()
225 static struct vpu_iface_ops *vpu_get_iface(struct vpu_dev *vpu, enum vpu_core_type type) in vpu_get_iface() argument
230 switch (vpu->res->plat_type) { in vpu_get_iface()
232 case IMX8QM: in vpu_get_iface()
248 return vpu_get_iface(core->vpu, core->type); in vpu_core_get_iface()
253 if (inst->core) in vpu_inst_get_iface()
254 return vpu_core_get_iface(inst->core); in vpu_inst_get_iface()
256 return vpu_get_iface(inst->vpu, inst->type); in vpu_inst_get_iface()