luckfox-pico-sdk/sysdrv/source/kernel/include/soc/rockchip/rockchip_rockit.h
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

192 lines
4.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2021 Rockchip Electronics Co., Ltd
*/
#ifndef __SOC_ROCKCHIP_ROCKIT_H
#define __SOC_ROCKCHIP_ROCKIT_H
#include <linux/dma-buf.h>
#include <linux/rk-isp2-config.h>
#define ROCKIT_BUF_NUM_MAX 20
#define ROCKIT_ISP_NUM_MAX 3
#define ROCKIT_STREAM_NUM_MAX 12
#define ROCKIT_VICAP_NUM_MAX 6
enum {
RKISP_NORMAL_ONLINE,
RKISP_NORMAL_OFFLINE,
RKISP_FAST_ONLINE,
RKISP_FAST_OFFLINE,
};
enum function_cmd {
ROCKIT_BUF_QUE,
ROCKIT_MPIBUF_DONE
};
struct rkisp_stream_cfg {
struct rkisp_rockit_buffer *rkisp_buff[ROCKIT_BUF_NUM_MAX];
int buff_id[ROCKIT_BUF_NUM_MAX];
void *node;
int fps_cnt;
int dst_fps;
int cur_fps;
u64 old_time;
bool is_discard;
struct mutex freebuf_lock;
};
struct ISP_VIDEO_FRAMES {
u32 pMbBlk;
u32 u32Width;
u32 u32Height;
u32 u32VirWidth;
u32 u32VirHeight;
u32 enField;
u32 enPixelFormat;
u32 enVideoFormat;
u32 enCompressMode;
u32 enDynamicRange;
u32 enColorGamut;
u32 u32TimeRef;
u64 u64PTS;
u64 u64PrivateData;
u32 u32FrameFlag; /* FRAME_FLAG_E, can be OR operation. */
};
struct rkisp_dev_cfg {
char *isp_name;
void *isp_dev;
struct rkisp_stream_cfg rkisp_stream_cfg[ROCKIT_STREAM_NUM_MAX];
};
struct rockit_cfg {
bool is_alloc;
bool is_empty;
bool is_qbuf;
bool is_color;
char *current_name;
dma_addr_t dma_addr;
int *buff_id;
int mpi_id;
int isp_num;
u32 nick_id;
u32 event;
u32 y_offset;
u32 u_offset;
u32 v_offset;
u32 vir_width;
void *node;
void *mpibuf;
void *vvi_dev[ROCKIT_ISP_NUM_MAX];
struct dma_buf *buf;
struct ISP_VIDEO_FRAMES frame;
struct rkisp_dev_cfg rkisp_dev_cfg[ROCKIT_ISP_NUM_MAX];
int (*rkisp_rockit_mpibuf_done)(struct rockit_cfg *rockit_isp_cfg);
};
struct rkcif_stream_cfg {
struct rkcif_rockit_buffer *rkcif_buff[ROCKIT_BUF_NUM_MAX];
int buff_id[ROCKIT_BUF_NUM_MAX];
void *node;
int fps_cnt;
int dst_fps;
int cur_fps;
u64 old_time;
bool is_discard;
};
struct rkcif_dev_cfg {
const char *cif_name;
void *cif_dev;
struct rkcif_stream_cfg rkcif_stream_cfg[ROCKIT_STREAM_NUM_MAX];
};
struct rockit_rkcif_cfg {
bool is_alloc;
bool is_empty;
bool is_qbuf;
const char *cur_name;
int *buff_id;
int mpi_id;
u32 nick_id;
u32 event;
int cif_num;
void *node;
void *mpibuf;
void *vvi_dev[ROCKIT_VICAP_NUM_MAX];
struct dma_buf *buf;
struct ISP_VIDEO_FRAMES frame;
struct rkcif_dev_cfg rkcif_dev_cfg[ROCKIT_VICAP_NUM_MAX];
int (*rkcif_rockit_mpibuf_done)(struct rockit_rkcif_cfg *rockit_cif_cfg);
};
#if IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_ISP_VERSION_V32)
void *rkisp_rockit_function_register(void *function, int cmd);
int rkisp_rockit_get_ispdev(char **name);
int rkisp_rockit_get_isp_mode(const char *name);
int rkisp_rockit_buf_queue(struct rockit_cfg *input_rockit_cfg);
int rkisp_rockit_pause_stream(struct rockit_cfg *input_rockit_cfg);
int rkisp_rockit_resume_stream(struct rockit_cfg *input_rockit_cfg);
int rkisp_rockit_config_stream(struct rockit_cfg *input_rockit_cfg,
int width, int height, int wrap_line);
int rkisp_rockit_get_tb_stream_info(struct rockit_cfg *input_rockit_cfg,
struct rkisp_tb_stream_info *info);
int rkisp_rockit_free_tb_stream_buf(struct rockit_cfg *input_rockit_cfg);
int rkisp_rockit_free_stream_buf(struct rockit_cfg *input_rockit_cfg);
void *rkcif_rockit_function_register(void *function, int cmd);
int rkcif_rockit_get_cifdev(char **name);
int rkcif_rockit_buf_queue(struct rockit_rkcif_cfg *input_rockit_cfg);
int rkcif_rockit_config_stream(struct rockit_rkcif_cfg *input_rockit_cfg,
int width, int height, int v4l2_fmt);
int rkcif_rockit_resume_stream(struct rockit_rkcif_cfg *input_rockit_cfg);
int rkcif_rockit_pause_stream(struct rockit_rkcif_cfg *input_rockit_cfg);
#else
static inline void *rkisp_rockit_function_register(void *function, int cmd) { return NULL; }
static inline int rkisp_rockit_get_ispdev(char **name) { return -EINVAL; }
static inline int rkisp_rockit_get_isp_mode(const char *name) { return -EINVAL; }
static inline int rkisp_rockit_buf_queue(struct rockit_cfg *input_rockit_cfg)
{
return -EINVAL;
}
static inline int rkisp_rockit_pause_stream(struct rockit_cfg *input_rockit_cfg)
{
return -EINVAL;
}
static inline int rkisp_rockit_resume_stream(struct rockit_cfg *input_rockit_cfg)
{
return -EINVAL;
}
static inline int rkisp_rockit_config_stream(struct rockit_cfg *input_rockit_cfg,
int width, int height, int wrap_line)
{
return -EINVAL;
}
static inline int rkisp_rockit_get_tb_stream_info(struct rockit_cfg *input_rockit_cfg,
struct rkisp_tb_stream_info *info)
{
return -EINVAL;
}
static inline int rkisp_rockit_free_tb_stream_buf(struct rockit_cfg *input_rockit_cfg)
{
return -EINVAL;
}
static inline int rkisp_rockit_free_stream_buf(struct rockit_cfg *input_rockit_cfg)
{
return -EINVAL;
}
#endif
#endif