#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include "core.h"
#include "hfi_cmds.h"
#include "hfi_msgs.h"
#include "hfi_venus.h"
#include "hfi_venus_io.h"
#include "firmware.h"
#define HFI_MASK_QHDR_TX_TYPE …
#define HFI_MASK_QHDR_RX_TYPE …
#define HFI_MASK_QHDR_PRI_TYPE …
#define HFI_MASK_QHDR_ID_TYPE …
#define HFI_HOST_TO_CTRL_CMD_Q …
#define HFI_CTRL_TO_HOST_MSG_Q …
#define HFI_CTRL_TO_HOST_DBG_Q …
#define HFI_MASK_QHDR_STATUS …
#define IFACEQ_NUM …
#define IFACEQ_CMD_IDX …
#define IFACEQ_MSG_IDX …
#define IFACEQ_DBG_IDX …
#define IFACEQ_MAX_BUF_COUNT …
#define IFACEQ_MAX_PARALLEL_CLNTS …
#define IFACEQ_DFLT_QHDR …
#define POLL_INTERVAL_US …
#define IFACEQ_MAX_PKT_SIZE …
#define IFACEQ_MED_PKT_SIZE …
#define IFACEQ_MIN_PKT_SIZE …
#define IFACEQ_VAR_SMALL_PKT_SIZE …
#define IFACEQ_VAR_LARGE_PKT_SIZE …
#define IFACEQ_VAR_HUGE_PKT_SIZE …
struct hfi_queue_table_header { … };
struct hfi_queue_header { … };
#define IFACEQ_TABLE_SIZE …
#define IFACEQ_QUEUE_SIZE …
#define IFACEQ_GET_QHDR_START_ADDR(ptr, i) …
#define QDSS_SIZE …
#define SFR_SIZE …
#define QUEUE_SIZE …
#define ALIGNED_QDSS_SIZE …
#define ALIGNED_SFR_SIZE …
#define ALIGNED_QUEUE_SIZE …
#define SHARED_QSIZE …
struct mem_desc { … };
struct iface_queue { … };
enum venus_state { … };
struct venus_hfi_device { … };
static bool venus_pkt_debug;
int venus_fw_debug = …;
static bool venus_fw_low_power_mode = …;
static int venus_hw_rsp_timeout = …;
static bool venus_fw_coverage;
static void venus_set_state(struct venus_hfi_device *hdev,
enum venus_state state)
{ … }
static bool venus_is_valid_state(struct venus_hfi_device *hdev)
{ … }
static void venus_dump_packet(struct venus_hfi_device *hdev, const void *packet)
{ … }
static int venus_write_queue(struct venus_hfi_device *hdev,
struct iface_queue *queue,
void *packet, u32 *rx_req)
{ … }
static int venus_read_queue(struct venus_hfi_device *hdev,
struct iface_queue *queue, void *pkt, u32 *tx_req)
{ … }
static int venus_alloc(struct venus_hfi_device *hdev, struct mem_desc *desc,
u32 size)
{ … }
static void venus_free(struct venus_hfi_device *hdev, struct mem_desc *mem)
{ … }
static void venus_set_registers(struct venus_hfi_device *hdev)
{ … }
static void venus_soft_int(struct venus_hfi_device *hdev)
{ … }
static int venus_iface_cmdq_write_nolock(struct venus_hfi_device *hdev,
void *pkt, bool sync)
{ … }
static int venus_iface_cmdq_write(struct venus_hfi_device *hdev, void *pkt, bool sync)
{ … }
static int venus_hfi_core_set_resource(struct venus_core *core, u32 id,
u32 size, u32 addr, void *cookie)
{ … }
static int venus_boot_core(struct venus_hfi_device *hdev)
{ … }
static u32 venus_hwversion(struct venus_hfi_device *hdev)
{ … }
static int venus_run(struct venus_hfi_device *hdev)
{ … }
static int venus_halt_axi(struct venus_hfi_device *hdev)
{ … }
static int venus_power_off(struct venus_hfi_device *hdev)
{ … }
static int venus_power_on(struct venus_hfi_device *hdev)
{ … }
static int venus_iface_msgq_read_nolock(struct venus_hfi_device *hdev,
void *pkt)
{ … }
static int venus_iface_msgq_read(struct venus_hfi_device *hdev, void *pkt)
{ … }
static int venus_iface_dbgq_read_nolock(struct venus_hfi_device *hdev,
void *pkt)
{ … }
static int venus_iface_dbgq_read(struct venus_hfi_device *hdev, void *pkt)
{ … }
static void venus_set_qhdr_defaults(struct hfi_queue_header *qhdr)
{ … }
static void venus_interface_queues_release(struct venus_hfi_device *hdev)
{ … }
static int venus_interface_queues_init(struct venus_hfi_device *hdev)
{ … }
static int venus_sys_set_debug(struct venus_hfi_device *hdev, u32 debug)
{ … }
static int venus_sys_set_coverage(struct venus_hfi_device *hdev, u32 mode)
{ … }
static int venus_sys_set_idle_message(struct venus_hfi_device *hdev,
bool enable)
{ … }
static int venus_sys_set_power_control(struct venus_hfi_device *hdev,
bool enable)
{ … }
static int venus_sys_set_ubwc_config(struct venus_hfi_device *hdev)
{ … }
static int venus_get_queue_size(struct venus_hfi_device *hdev,
unsigned int index)
{ … }
static int venus_sys_set_default_properties(struct venus_hfi_device *hdev)
{ … }
static int venus_session_cmd(struct venus_inst *inst, u32 pkt_type, bool sync)
{ … }
static void venus_flush_debug_queue(struct venus_hfi_device *hdev)
{ … }
static int venus_prepare_power_collapse(struct venus_hfi_device *hdev,
bool wait)
{ … }
static int venus_are_queues_empty(struct venus_hfi_device *hdev)
{ … }
static void venus_sfr_print(struct venus_hfi_device *hdev)
{ … }
static void venus_process_msg_sys_error(struct venus_hfi_device *hdev,
void *packet)
{ … }
static irqreturn_t venus_isr_thread(struct venus_core *core)
{ … }
static irqreturn_t venus_isr(struct venus_core *core)
{ … }
static int venus_core_init(struct venus_core *core)
{ … }
static int venus_core_deinit(struct venus_core *core)
{ … }
static int venus_core_ping(struct venus_core *core, u32 cookie)
{ … }
static int venus_core_trigger_ssr(struct venus_core *core, u32 trigger_type)
{ … }
static int venus_session_init(struct venus_inst *inst, u32 session_type,
u32 codec)
{ … }
static int venus_session_end(struct venus_inst *inst)
{ … }
static int venus_session_abort(struct venus_inst *inst)
{ … }
static int venus_session_flush(struct venus_inst *inst, u32 flush_mode)
{ … }
static int venus_session_start(struct venus_inst *inst)
{ … }
static int venus_session_stop(struct venus_inst *inst)
{ … }
static int venus_session_continue(struct venus_inst *inst)
{ … }
static int venus_session_etb(struct venus_inst *inst,
struct hfi_frame_data *in_frame)
{ … }
static int venus_session_ftb(struct venus_inst *inst,
struct hfi_frame_data *out_frame)
{ … }
static int venus_session_set_buffers(struct venus_inst *inst,
struct hfi_buffer_desc *bd)
{ … }
static int venus_session_unset_buffers(struct venus_inst *inst,
struct hfi_buffer_desc *bd)
{ … }
static int venus_session_load_res(struct venus_inst *inst)
{ … }
static int venus_session_release_res(struct venus_inst *inst)
{ … }
static int venus_session_parse_seq_hdr(struct venus_inst *inst, u32 seq_hdr,
u32 seq_hdr_len)
{ … }
static int venus_session_get_seq_hdr(struct venus_inst *inst, u32 seq_hdr,
u32 seq_hdr_len)
{ … }
static int venus_session_set_property(struct venus_inst *inst, u32 ptype,
void *pdata)
{ … }
static int venus_session_get_property(struct venus_inst *inst, u32 ptype)
{ … }
static int venus_resume(struct venus_core *core)
{ … }
static int venus_suspend_1xx(struct venus_core *core)
{ … }
static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)
{ … }
static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)
{ … }
static int venus_suspend_3xx(struct venus_core *core)
{ … }
static int venus_suspend(struct venus_core *core)
{ … }
static const struct hfi_ops venus_hfi_ops = …;
void venus_hfi_destroy(struct venus_core *core)
{ … }
int venus_hfi_create(struct venus_core *core)
{ … }
void venus_hfi_queues_reinit(struct venus_core *core)
{ … }