4 #include <linux/device.h>
5 #include <linux/miscdevice.h>
6 #include <linux/mutex.h>
8 #if defined(CONFIG_RK_IOMMU)
9 #include <linux/rockchip-iovmm.h>
10 #include <linux/dma-buf.h>
14 #define IEP_REG_LEN 0x100
15 #define IEP_CMD_REG_LEN 0xE
16 #define IEP_ADD_REG_LEN 0xE0
17 #define IEP_RAW_REG_LEN 0xA
18 #define IEP_SYS_REG_LEN 0x6
19 #define IEP_CNF_REG_LEN 0x2
21 #define IEP_CNF_REG_BASE 0x0
22 #define IEP_SYS_REG_BASE 0x2
23 #define IEP_CMD_REG_BASE 0x8
24 #define IEP_ADD_REG_BASE 0x20
25 #define IEP_RAW_REG_BASE 0x16
27 struct iep_parameter_req {
32 struct iep_parameter_deinterlace {
36 struct iep_img src_itemp;
37 struct iep_img src_ftemp;
39 struct iep_img dst_itemp;
40 struct iep_img dst_ftemp;
44 // deinterlace high frequency
48 // deinterlace edge interpolation
55 struct iep_parameter_enhance {
59 float yuv_enh_saturation; //0-1.992
60 float yuv_enh_contrast; //0-1.992
61 s8 yuv_enh_brightness; //-32<brightness<31
62 s8 yuv_enh_hue_angle; //0-30,value is 0 - 30
65 u8 color_bar_y; //0-127
66 u8 color_bar_u; //0-127
67 u8 color_bar_v; //0-127
71 u8 rgb_cg_en; //sw_rgb_con_gam_en
75 u8 rgb_color_enhance_en; //sw_rgb_color_enh_en
76 float rgb_enh_coe; //0-3.96875
79 struct iep_parameter_scale {
83 struct iep_parameter_convert {
85 u8 dither_down_en; //not to be used
90 u8 global_alpha_value;
96 typedef struct iep_session {
97 /* a linked list of data so we can access them for debugging */
98 struct list_head list_session;
99 /* a linked list of register data waiting for process */
100 struct list_head waiting;
101 /* a linked list of register data in ready */
102 struct list_head ready;
103 /* a linked list of register data in processing */
104 struct list_head running;
105 /* all coommand this thread done */
107 wait_queue_head_t wait;
109 atomic_t task_running;
113 typedef struct iep_service_info {
115 struct timer_list timer; /* timer for power off */
116 struct list_head waiting; /* link to link_reg in struct iep_reg */
118 struct list_head ready; /* link to link_reg in struct iep_reg */
119 struct list_head running; /* link to link_reg in struct iep_reg */
120 struct list_head done; /* link to link_reg in struct iep_reg */
121 struct list_head session; /* link to list_session in struct vpu_session */
122 atomic_t total_running;
127 struct mutex mutex; // mutex
129 struct iep_iommu_info *iommu_info;
131 struct device *iommu_dev;
136 iep_session *session;
137 struct list_head session_link; /* link to rga service session */
138 struct list_head status_link; /* link to register set list */
149 struct list_head mem_region_list;
152 struct iep_mem_region {
153 struct list_head srv_lnk;
154 struct list_head reg_lnk;
155 struct list_head session_lnk;
156 unsigned long iova; /* virtual address for iommu */