Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2021 Rockchip Electronics Co., Ltd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #ifndef __SOC_ROCKCHIP_ROCKIT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #define __SOC_ROCKCHIP_ROCKIT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/dma-buf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/rkisp2-config.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define ROCKIT_BUF_NUM_MAX	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define ROCKIT_ISP_NUM_MAX	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define ROCKIT_STREAM_NUM_MAX	12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) enum function_cmd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	ROCKIT_BUF_QUE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	ROCKIT_MPIBUF_DONE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) struct rkisp_stream_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	struct rkisp_rockit_buffer *rkisp_buff[ROCKIT_BUF_NUM_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	int buff_id[ROCKIT_BUF_NUM_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	void *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	int fps_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	int dst_fps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	int cur_fps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	u64 old_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	bool is_discard;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) struct ISP_VIDEO_FRAMES {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	u32	pMbBlk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	u32	u32Width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	u32	u32Height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	u32	u32VirWidth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	u32	u32VirHeight;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	u32	enField;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	u32	enPixelFormat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	u32	enVideoFormat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	u32	enCompressMode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	u32	enDynamicRange;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	u32	enColorGamut;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	u32	u32TimeRef;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	u64	u64PTS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	u64	u64PrivateData;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	u32	u32FrameFlag;     /* FRAME_FLAG_E, can be OR operation. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) struct rkisp_dev_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	char *isp_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	void *isp_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	struct rkisp_stream_cfg rkisp_stream_cfg[ROCKIT_STREAM_NUM_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) struct rockit_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	bool is_alloc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	bool is_empty;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	bool is_qbuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	bool is_color;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	char *current_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	dma_addr_t dma_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	int *buff_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	int mpi_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	int isp_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	u32 nick_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	u32 event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	void *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	void *mpibuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	void *vvi_dev[ROCKIT_ISP_NUM_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	struct dma_buf *buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	struct ISP_VIDEO_FRAMES frame;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	struct rkisp_dev_cfg rkisp_dev_cfg[ROCKIT_ISP_NUM_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	int (*rkisp_rockit_mpibuf_done)(struct rockit_cfg *rockit_isp_cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #if IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_ISP_VERSION_V32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) void *rkisp_rockit_function_register(void *function, int cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) int rkisp_rockit_get_ispdev(char **name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) int rkisp_rockit_buf_queue(struct rockit_cfg *input_rockit_cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) int rkisp_rockit_pause_stream(struct rockit_cfg *input_rockit_cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) int rkisp_rockit_resume_stream(struct rockit_cfg *input_rockit_cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) int rkisp_rockit_config_stream(struct rockit_cfg *input_rockit_cfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 				int width, int height, int wrap_line);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) int rkisp_rockit_get_tb_stream_info(struct rockit_cfg *input_rockit_cfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 				    struct rkisp_tb_stream_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) int rkisp_rockit_free_tb_stream_buf(struct rockit_cfg *input_rockit_cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static inline void *rkisp_rockit_function_register(void *function, int cmd) { return NULL; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) static inline int rkisp_rockit_get_ispdev(char **name) { return -EINVAL; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) static inline int rkisp_rockit_buf_queue(struct rockit_cfg *input_rockit_cfg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static inline int rkisp_rockit_pause_stream(struct rockit_cfg *input_rockit_cfg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) static inline int rkisp_rockit_resume_stream(struct rockit_cfg *input_rockit_cfg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static inline int rkisp_rockit_config_stream(struct rockit_cfg *input_rockit_cfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 					     int width, int height, int wrap_line)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static inline int rkisp_rockit_get_tb_stream_info(struct rockit_cfg *input_rockit_cfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 						  struct rkisp_tb_stream_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static inline int rkisp_rockit_free_tb_stream_buf(struct rockit_cfg *input_rockit_cfg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #endif