Files
android_kernel_samsung_sm86…/drivers/cam_icp/fw_inc/hfi_intf.h
Karthik Anantha Ram 8f5c061dc5 msm: camera: icp: Add support for synx signaling
Add support to map global sync and hw mutex memory for ICP.
Share the region information with FW over GP registers.

CRs-Fixed: 3351015
Change-Id: Ie7a6af40ffd922ae89d64205787e3c656a007c49
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
2022-12-16 18:07:09 -08:00

202 خطوط
5.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _HFI_INTF_H_
#define _HFI_INTF_H_
#include <linux/types.h>
#define HFI_CMD_Q_MINI_DUMP_SIZE_IN_BYTES 4096
#define HFI_MSG_Q_MINI_DUMP_SIZE_IN_BYTES 4096
/**
* struct hfi_mem
* @len: length of memory
* @kva: kernel virtual address
* @iova: IO virtual address
* @reserved: reserved field
*/
struct hfi_mem {
uint64_t len;
uintptr_t kva;
uint32_t iova;
uint32_t reserved;
};
/**
* struct hfi_mem_info
* @qtbl: qtable hfi memory
* @cmd_q: command queue hfi memory for host to firmware communication
* @msg_q: message queue hfi memory for firmware to host communication
* @dbg_q: debug queue hfi memory for firmware debug information
* @sfr_buf: buffer for subsystem failure reason[SFR]
* @sec_heap: secondary heap hfi memory for firmware
* @qdss: qdss mapped memory for fw
* @io_mem: io memory info
* @io_mem2: 2nd io memory info
* @fw_uncached: FW uncached region info
* @global_sync: Global sync mem for IPC
* @hwmutex: HWMutex memory
*/
struct hfi_mem_info {
struct hfi_mem qtbl;
struct hfi_mem cmd_q;
struct hfi_mem msg_q;
struct hfi_mem dbg_q;
struct hfi_mem sfr_buf;
struct hfi_mem sec_heap;
struct hfi_mem shmem;
struct hfi_mem qdss;
struct hfi_mem io_mem;
struct hfi_mem io_mem2;
struct hfi_mem fw_uncached;
struct hfi_mem global_sync;
struct hfi_mem hwmutex;
};
/**
* struct hfi_ops
* @irq_raise: called to raise H2ICP interrupt
* @irq_enable: called to enable interrupts from ICP
* @iface_addr: called to get interface registers base address
*/
struct hfi_ops {
void (*irq_raise)(void *data);
void (*irq_enable)(void *data);
void __iomem *(*iface_addr)(void *data);
};
/**
* struct hfi_mini_dump_info
* @cmd_q: cmd queue
* @msg_q: msg queue
* @msg_q_state: msg queue state
* @cmd_q_state: cmd queue state
*/
struct hfi_mini_dump_info {
uint32_t cmd_q[HFI_CMD_Q_MINI_DUMP_SIZE_IN_BYTES];
uint32_t msg_q[HFI_MSG_Q_MINI_DUMP_SIZE_IN_BYTES];
bool msg_q_state;
bool cmd_q_state;
};
/**
* hfi_write_cmd() - function for hfi write
* @cmd_ptr: pointer to command data for hfi write
*
* Returns success(zero)/failure(non zero)
*/
int hfi_write_cmd(void *cmd_ptr);
/**
* hfi_read_message() - function for hfi read
* @pmsg: buffer to place read message for hfi queue
* @q_id: queue id
* @words_read: total number of words read from the queue
* returned as output to the caller
*
* Returns success(zero)/failure(non zero)
*/
int hfi_read_message(uint32_t *pmsg, uint8_t q_id, uint32_t *words_read);
/**
* hfi_init() - function initialize hfi after firmware download
* @hfi_mem: hfi memory info
* @hfi_ops: processor-specific hfi ops
* @priv: device private data
* @event_driven_mode: event mode
*
* Returns success(zero)/failure(non zero)
*/
int cam_hfi_init(struct hfi_mem_info *hfi_mem, const struct hfi_ops *hfi_ops,
void *priv, uint8_t event_driven_mode);
/**
* hfi_get_hw_caps() - hardware capabilities from firmware
* @query_caps: holds query information from hfi
*
* Returns success(zero)/failure(non zero)
*/
int hfi_get_hw_caps(void *query_caps);
/**
* hfi_send_system_cmd() - send hfi system command to firmware
* @type: type of system command
* @data: command data
* @size: size of command data
*/
void hfi_send_system_cmd(uint32_t type, uint64_t data, uint32_t size);
/**
* cam_hfi_deinit() - cleanup HFI
*/
void cam_hfi_deinit(void);
/**
* hfi_set_debug_level() - set debug level
* @icp_dbg_type: 1 for debug_q & 2 for qdss
* @lvl: FW debug message level
*/
int hfi_set_debug_level(u64 icp_dbg_type, uint32_t lvl);
/**
* hfi_set_fw_dump_levels() - set firmware hang dump/ramdump levels
* @hang_dump_lvl : level of firmware hang dump
* @ram_dump_lvl : level of firmware ram dump
*/
int hfi_set_fw_dump_levels(uint32_t hang_dump_lvl, uint32_t ram_dump_lvl);
/**
* hfi_send_freq_info() - set firmware dump level
* @freq: icp freq
*/
int hfi_send_freq_info(int32_t freq);
/**
* hfi_enable_dev_pc() - Enable interframe pc
* Host sends a command to firmware to enable interframe
* power collapse for ICP's controlled hardware.
*
* @enable: flag to enable/disable
* @core_info: Core information to firmware
*/
int hfi_enable_dev_pc(bool enable, uint32_t core_info);
/**
* hfi_cmd_ubwc_config_ext() - UBWC configuration to firmware
* @ubwc_ipe_cfg: UBWC ipe fetch/write configuration params
* @ubwc_bps_cfg: UBWC bps fetch/write configuration params
*/
int hfi_cmd_ubwc_config_ext(uint32_t *ubwc_ipe_cfg,
uint32_t *ubwc_bps_cfg);
/**
* hfi_cmd_ubwc_config() - UBWC configuration to firmware
* for older targets
* @ubwc_cfg: UBWC configuration parameters
*/
int hfi_cmd_ubwc_config(uint32_t *ubwc_cfg);
/**
* cam_hfi_resume() - function to resume
* @hfi_mem: hfi memory info
*
* Returns success(zero)/failure(non zero)
*/
int cam_hfi_resume(struct hfi_mem_info *hfi_mem);
/**
* cam_hfi_queue_dump() - utility function to dump hfi queues
* @dump_queue_data: if set dumps queue contents
*
*/
void cam_hfi_queue_dump(bool dump_queue_data);
/**
* cam_hfi_mini_dump() - utility function for mini dump
*/
void cam_hfi_mini_dump(struct hfi_mini_dump_info *dst);
#endif /* _HFI_INTF_H_ */