1 /* 2 * Support for Clovertrail PNW Camera Imaging ISP subsystem. 3 * 4 * Copyright (c) 2013 Intel Corporation. All Rights Reserved. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 8 * 2 as published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * 16 */ 17 18 #ifndef __ATOMISP_COMPAT_CSS20_H__ 19 #define __ATOMISP_COMPAT_CSS20_H__ 20 21 #include <media/v4l2-mediabus.h> 22 23 #include "ia_css.h" 24 #include "ia_css_types.h" 25 #include "ia_css_acc_types.h" 26 #include "sh_css_legacy.h" 27 28 #define ATOMISP_CSS2_PIPE_MAX 2 29 #define ATOMISP_CSS2_NUM_OFFLINE_INIT_CONTINUOUS_FRAMES 3 30 #define ATOMISP_CSS2_NUM_OFFLINE_INIT_CONTINUOUS_FRAMES_LOCK_EN 4 31 #define ATOMISP_CSS2_NUM_DVS_FRAME_DELAY 2 32 33 #define CSS_MIPI_FRAME_BUFFER_SIZE_1 0x60000 34 #define CSS_MIPI_FRAME_BUFFER_SIZE_2 0x80000 35 36 struct atomisp_device; 37 struct atomisp_sub_device; 38 39 #define MAX_STREAMS_PER_CHANNEL 2 40 41 /* 42 * These are used to indicate the css stream state, corresponding 43 * stream handling can be done via judging the different state. 44 */ 45 enum atomisp_css_stream_state { 46 CSS_STREAM_UNINIT, 47 CSS_STREAM_CREATED, 48 CSS_STREAM_STARTED, 49 CSS_STREAM_STOPPED, 50 }; 51 52 /* 53 * Sensor of external ISP can send multiple steams with different mipi data 54 * type in the same virtual channel. This information needs to come from the 55 * sensor or external ISP 56 */ 57 struct atomisp_css_isys_config_info { 58 unsigned int input_format; 59 unsigned int width; 60 unsigned int height; 61 }; 62 63 struct atomisp_stream_env { 64 struct ia_css_stream *stream; 65 struct ia_css_stream_config stream_config; 66 struct ia_css_stream_info stream_info; 67 struct ia_css_pipe *pipes[IA_CSS_PIPE_ID_NUM]; 68 struct ia_css_pipe *multi_pipes[IA_CSS_PIPE_ID_NUM]; 69 struct ia_css_pipe_config pipe_configs[IA_CSS_PIPE_ID_NUM]; 70 struct ia_css_pipe_extra_config pipe_extra_configs[IA_CSS_PIPE_ID_NUM]; 71 bool update_pipe[IA_CSS_PIPE_ID_NUM]; 72 enum atomisp_css_stream_state stream_state; 73 struct ia_css_stream *acc_stream; 74 enum atomisp_css_stream_state acc_stream_state; 75 struct ia_css_stream_config acc_stream_config; 76 unsigned int ch_id; /* virtual channel ID */ 77 unsigned int isys_configs; 78 struct atomisp_css_isys_config_info isys_info[MAX_STREAMS_PER_CHANNEL]; 79 }; 80 81 struct atomisp_css_env { 82 struct ia_css_env isp_css_env; 83 struct ia_css_fw isp_css_fw; 84 }; 85 86 struct atomisp_s3a_buf { 87 struct ia_css_isp_3a_statistics *s3a_data; 88 struct ia_css_isp_3a_statistics_map *s3a_map; 89 struct list_head list; 90 }; 91 92 struct atomisp_dis_buf { 93 struct ia_css_isp_dvs_statistics *dis_data; 94 struct ia_css_isp_dvs_statistics_map *dvs_map; 95 struct list_head list; 96 }; 97 98 struct atomisp_css_buffer { 99 struct ia_css_buffer css_buffer; 100 }; 101 102 struct atomisp_css_event { 103 enum ia_css_pipe_id pipe; 104 struct ia_css_event event; 105 }; 106 107 void atomisp_css_set_macc_config(struct atomisp_sub_device *asd, 108 struct ia_css_macc_config *macc_config); 109 110 void atomisp_css_set_ecd_config(struct atomisp_sub_device *asd, 111 struct ia_css_ecd_config *ecd_config); 112 113 void atomisp_css_set_ynr_config(struct atomisp_sub_device *asd, 114 struct ia_css_ynr_config *ynr_config); 115 116 void atomisp_css_set_fc_config(struct atomisp_sub_device *asd, 117 struct ia_css_fc_config *fc_config); 118 119 void atomisp_css_set_aa_config(struct atomisp_sub_device *asd, 120 struct ia_css_aa_config *aa_config); 121 122 void atomisp_css_set_baa_config(struct atomisp_sub_device *asd, 123 struct ia_css_aa_config *baa_config); 124 125 void atomisp_css_set_anr_config(struct atomisp_sub_device *asd, 126 struct ia_css_anr_config *anr_config); 127 128 void atomisp_css_set_xnr_config(struct atomisp_sub_device *asd, 129 struct ia_css_xnr_config *xnr_config); 130 131 void atomisp_css_set_cnr_config(struct atomisp_sub_device *asd, 132 struct ia_css_cnr_config *cnr_config); 133 134 void atomisp_css_set_ctc_config(struct atomisp_sub_device *asd, 135 struct ia_css_ctc_config *ctc_config); 136 137 void atomisp_css_set_yuv2rgb_cc_config(struct atomisp_sub_device *asd, 138 struct ia_css_cc_config *yuv2rgb_cc_config); 139 140 void atomisp_css_set_rgb2yuv_cc_config(struct atomisp_sub_device *asd, 141 struct ia_css_cc_config *rgb2yuv_cc_config); 142 143 void atomisp_css_set_xnr_table(struct atomisp_sub_device *asd, 144 struct ia_css_xnr_table *xnr_table); 145 146 void atomisp_css_set_r_gamma_table(struct atomisp_sub_device *asd, 147 struct ia_css_rgb_gamma_table *r_gamma_table); 148 149 void atomisp_css_set_g_gamma_table(struct atomisp_sub_device *asd, 150 struct ia_css_rgb_gamma_table *g_gamma_table); 151 152 void atomisp_css_set_b_gamma_table(struct atomisp_sub_device *asd, 153 struct ia_css_rgb_gamma_table *b_gamma_table); 154 155 void atomisp_css_set_anr_thres(struct atomisp_sub_device *asd, 156 struct ia_css_anr_thres *anr_thres); 157 158 int atomisp_css_load_firmware(struct atomisp_device *isp); 159 160 void atomisp_css_set_dvs_6axis(struct atomisp_sub_device *asd, 161 struct ia_css_dvs_6axis_config *dvs_6axis); 162 163 int atomisp_css_debug_dump_isp_binary(void); 164 165 int atomisp_css_dump_sp_raw_copy_linecount(bool reduced); 166 167 int atomisp_css_dump_blob_infor(void); 168 169 void atomisp_css_set_isp_config_id(struct atomisp_sub_device *asd, 170 uint32_t isp_config_id); 171 172 void atomisp_css_set_isp_config_applied_frame(struct atomisp_sub_device *asd, 173 struct ia_css_frame *output_frame); 174 175 int atomisp_get_css_dbgfunc(void); 176 177 int atomisp_set_css_dbgfunc(struct atomisp_device *isp, int opt); 178 struct ia_css_dvs_grid_info *atomisp_css_get_dvs_grid_info( 179 struct ia_css_grid_info *grid_info); 180 #endif 181