#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/firmware.h>
#include <linux/interrupt.h>
#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/of_reserved_mem.h>
#include <linux/platform_device.h>
#include <linux/sched.h>
#include <linux/sizes.h>
#include <linux/dma-mapping.h>
#include "mtk_vpu.h"
#define INIT_TIMEOUT_MS …
#define IPI_TIMEOUT_MS …
#define VPU_IDLE_TIMEOUT_MS …
#define VPU_FW_VER_LEN …
#define VPU_PTCM_SIZE …
#define VPU_DTCM_SIZE …
#define VPU_DTCM_OFFSET …
#define VPU_EXT_P_SIZE …
#define VPU_EXT_D_SIZE …
#define VPU_P_FW_SIZE …
#define VPU_D_FW_SIZE …
#define SHARE_BUF_SIZE …
#define VPU_P_FW …
#define VPU_D_FW …
#define VPU_P_FW_NEW …
#define VPU_D_FW_NEW …
#define VPU_RESET …
#define VPU_TCM_CFG …
#define VPU_PMEM_EXT0_ADDR …
#define VPU_PMEM_EXT1_ADDR …
#define VPU_TO_HOST …
#define VPU_DMEM_EXT0_ADDR …
#define VPU_DMEM_EXT1_ADDR …
#define HOST_TO_VPU …
#define VPU_IDLE_REG …
#define VPU_INT_STATUS …
#define VPU_PC_REG …
#define VPU_SP_REG …
#define VPU_RA_REG …
#define VPU_WDT_REG …
#define VPU_IPC_INT …
#define VPU_IDLE_STATE …
enum vpu_fw_type { … };
struct vpu_mem { … };
struct vpu_regs { … };
struct vpu_wdt_handler { … };
struct vpu_wdt { … };
struct vpu_run { … };
struct vpu_ipi_desc { … };
struct share_obj { … };
struct mtk_vpu { … };
static inline void vpu_cfg_writel(struct mtk_vpu *vpu, u32 val, u32 offset)
{ … }
static inline u32 vpu_cfg_readl(struct mtk_vpu *vpu, u32 offset)
{ … }
static inline bool vpu_running(struct mtk_vpu *vpu)
{ … }
static void vpu_clock_disable(struct mtk_vpu *vpu)
{ … }
static int vpu_clock_enable(struct mtk_vpu *vpu)
{ … }
static void vpu_dump_status(struct mtk_vpu *vpu)
{ … }
int vpu_ipi_register(struct platform_device *pdev,
enum ipi_id id, ipi_handler_t handler,
const char *name, void *priv)
{ … }
EXPORT_SYMBOL_GPL(…);
int vpu_ipi_send(struct platform_device *pdev,
enum ipi_id id, void *buf,
unsigned int len)
{ … }
EXPORT_SYMBOL_GPL(…);
static void vpu_wdt_reset_func(struct work_struct *ws)
{ … }
int vpu_wdt_reg_handler(struct platform_device *pdev,
void wdt_reset(void *),
void *priv, enum rst_id id)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int vpu_get_vdec_hw_capa(struct platform_device *pdev)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int vpu_get_venc_hw_capa(struct platform_device *pdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void *vpu_mapping_dm_addr(struct platform_device *pdev,
u32 dtcm_dmem_addr)
{ … }
EXPORT_SYMBOL_GPL(…);
struct platform_device *vpu_get_plat_device(struct platform_device *pdev)
{ … }
EXPORT_SYMBOL_GPL(…);
static int load_requested_vpu(struct mtk_vpu *vpu,
u8 fw_type)
{ … }
int vpu_load_firmware(struct platform_device *pdev)
{ … }
EXPORT_SYMBOL_GPL(…);
static void vpu_init_ipi_handler(void *data, unsigned int len, void *priv)
{ … }
#ifdef CONFIG_DEBUG_FS
static ssize_t vpu_debug_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{ … }
static const struct file_operations vpu_debug_fops = …;
#endif
static void vpu_free_ext_mem(struct mtk_vpu *vpu, u8 fw_type)
{ … }
static int vpu_alloc_ext_mem(struct mtk_vpu *vpu, u32 fw_type)
{ … }
static void vpu_ipi_handler(struct mtk_vpu *vpu)
{ … }
static int vpu_ipi_init(struct mtk_vpu *vpu)
{ … }
static irqreturn_t vpu_irq_handler(int irq, void *priv)
{ … }
#ifdef CONFIG_DEBUG_FS
static struct dentry *vpu_debugfs;
#endif
static int mtk_vpu_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id mtk_vpu_match[] = …;
MODULE_DEVICE_TABLE(of, mtk_vpu_match);
static void mtk_vpu_remove(struct platform_device *pdev)
{ … }
static int mtk_vpu_suspend(struct device *dev)
{ … }
static int mtk_vpu_resume(struct device *dev)
{ … }
static const struct dev_pm_ops mtk_vpu_pm = …;
static struct platform_driver mtk_vpu_driver = …;
module_platform_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;