| @@ -164,6 +164,11 @@ · 163 unmodified lines |
| 164 | #define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS 17 | 164 | #define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS 17 |
| 165 | #define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS 6 | 165 | #define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS 6 |
| 166 | | 166 | |
| | 167 | /* |
| | 168 | * Compand |
| | 169 | */ |
| | 170 | #define RKISP1_CIF_ISP_COMPAND_NUM_POINTS 64 |
| | 171 | |
| 167 | /* | 172 | /* |
| 168 | * Measurement types | 173 | * Measurement types |
| 169 | */ | 174 | */ |
| @@ -851,6 +856,39 @@ struct rkisp1_params_cfg { · 681 unmodified lines |
| 851 | struct rkisp1_cif_isp_isp_other_cfg others; | 856 | struct rkisp1_cif_isp_isp_other_cfg others; |
| 852 | }; | 857 | }; |
| 853 | | 858 | |
| | 859 | /** |
| | 860 | * struct rkisp1_cif_isp_compand_bls_config - Rockchip ISP1 Companding parameters (BLS) |
| | 861 | * @r: Fixed subtraction value for Bayer pattern R |
| | 862 | * @gr: Fixed subtraction value for Bayer pattern Gr |
| | 863 | * @gb: Fixed subtraction value for Bayer pattern Gb |
| | 864 | * @b: Fixed subtraction value for Bayer pattern B |
| | 865 | * |
| | 866 | * The values will be subtracted from the sensor values. Note that unlike the |
| | 867 | * dedicated BLS block, the BLS values in the compander are 20-bit unsigned. |
| | 868 | */ |
| | 869 | struct rkisp1_cif_isp_compand_bls_config { |
| | 870 | __u32 r; |
| | 871 | __u32 gr; |
| | 872 | __u32 gb; |
| | 873 | __u32 b; |
| | 874 | }; |
| | 875 | |
| | 876 | /** |
| | 877 | * struct rkisp1_cif_isp_compand_curve_config - Rockchip ISP1 Companding |
| | 878 | * parameters (expand and compression curves) |
| | 879 | * @px: Compand curve x-values. Each value stores the distance from the |
| | 880 | * previous x-value, expressed as log2 of the distance on 5 bits. |
| | 881 | * @x: Compand curve x-values. The functionality of these parameters are |
| | 882 | * unknown due to do a lack of hardware documentation, but these are left |
| | 883 | * here for future compatibility purposes. |
| | 884 | * @y: Compand curve y-values |
| | 885 | */ |
| | 886 | struct rkisp1_cif_isp_compand_curve_config { |
| | 887 | __u8 px[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; |
| | 888 | __u32 x[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; |
| | 889 | __u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; |
| | 890 | }; |
| | 891 | |
| 854 | /*---------- PART2: Measurement Statistics ------------*/ | 892 | /*---------- PART2: Measurement Statistics ------------*/ |
| 855 | | 893 | |
| 856 | /** | 894 | /** |
| @@ -996,4 +1034,544 @@ struct rkisp1_stat_buffer { · 139 unmodified lines |
| 996 | struct rkisp1_cif_isp_stat params; | 1034 | struct rkisp1_cif_isp_stat params; |
| 997 | }; | 1035 | }; |
| 998 | | 1036 | |
| | 1037 | /*---------- PART3: Extensible Configuration Parameters ------------*/ |
| | 1038 | |
| | 1039 | /** |
| | 1040 | * enum rkisp1_ext_params_block_type - RkISP1 extensible params block type |
| | 1041 | * |
| | 1042 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS: Black level subtraction |
| | 1043 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC: Defect pixel cluster correction |
| | 1044 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG: Sensor de-gamma |
| | 1045 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN: Auto white balance gains |
| | 1046 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT: ISP filtering |
| | 1047 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM: Bayer de-mosaic |
| | 1048 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK: Cross-talk correction |
| | 1049 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC: Gamma out correction |
| | 1050 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF: De-noise pre-filter |
| | 1051 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH: De-noise pre-filter strength |
| | 1052 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC: Color processing |
| | 1053 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_IE: Image effects |
| | 1054 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC: Lens shading correction |
| | 1055 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS: Auto white balance statistics |
| | 1056 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS: Histogram statistics |
| | 1057 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS: Auto exposure statistics |
| | 1058 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS: Auto-focus statistics |
| | 1059 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block |
| | 1060 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve |
| | 1061 | * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve |
| | 1062 | */ |
| | 1063 | enum rkisp1_ext_params_block_type { |
| | 1064 | RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS, |
| | 1065 | RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC, |
| | 1066 | RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG, |
| | 1067 | RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN, |
| | 1068 | RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT, |
| | 1069 | RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM, |
| | 1070 | RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK, |
| | 1071 | RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC, |
| | 1072 | RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF, |
| | 1073 | RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH, |
| | 1074 | RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC, |
| | 1075 | RKISP1_EXT_PARAMS_BLOCK_TYPE_IE, |
| | 1076 | RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC, |
| | 1077 | RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS, |
| | 1078 | RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS, |
| | 1079 | RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS, |
| | 1080 | RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS, |
| | 1081 | RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS, |
| | 1082 | RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND, |
| | 1083 | RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS, |
| | 1084 | }; |
| | 1085 | |
| | 1086 | #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE (1U << 0) |
| | 1087 | #define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE (1U << 1) |
| | 1088 | |
| | 1089 | /** |
| | 1090 | * struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block |
| | 1091 | * header |
| | 1092 | * |
| | 1093 | * This structure represents the common part of all the ISP configuration |
| | 1094 | * blocks. Each parameters block shall embed an instance of this structure type |
| | 1095 | * as its first member, followed by the block-specific configuration data. The |
| | 1096 | * driver inspects this common header to discern the block type and its size and |
| | 1097 | * properly handle the block content by casting it to the correct block-specific |
| | 1098 | * type. |
| | 1099 | * |
| | 1100 | * The @type field is one of the values enumerated by |
| | 1101 | * :c:type:`rkisp1_ext_params_block_type` and specifies how the data should be |
| | 1102 | * interpreted by the driver. The @size field specifies the size of the |
| | 1103 | * parameters block and is used by the driver for validation purposes. |
| | 1104 | * |
| | 1105 | * The @flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*. |
| | 1106 | * |
| | 1107 | * When userspace wants to configure and enable an ISP block it shall fully |
| | 1108 | * populate the block configuration and set the |
| | 1109 | * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE bit in the @flags field. |
| | 1110 | * |
| | 1111 | * When userspace simply wants to disable an ISP block the |
| | 1112 | * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bit should be set in @flags field. The |
| | 1113 | * driver ignores the rest of the block configuration structure in this case. |
| | 1114 | * |
| | 1115 | * If a new configuration of an ISP block has to be applied userspace shall |
| | 1116 | * fully populate the ISP block configuration and omit setting the |
| | 1117 | * RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits |
| | 1118 | * in the @flags field. |
| | 1119 | * |
| | 1120 | * Setting both the RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and |
| | 1121 | * RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits in the @flags field is not allowed |
| | 1122 | * and not accepted by the driver. |
| | 1123 | * |
| | 1124 | * Userspace is responsible for correctly populating the parameters block header |
| | 1125 | * fields (@type, @flags and @size) and the block-specific parameters. |
| | 1126 | * |
| | 1127 | * For example: |
| | 1128 | * |
| | 1129 | * .. code-block:: c |
| | 1130 | * |
| | 1131 | * void populate_bls(struct rkisp1_ext_params_block_header *block) { |
| | 1132 | * struct rkisp1_ext_params_bls_config *bls = |
| | 1133 | * (struct rkisp1_ext_params_bls_config *)block; |
| | 1134 | * |
| | 1135 | * bls->header.type = RKISP1_EXT_PARAMS_BLOCK_ID_BLS; |
| | 1136 | * bls->header.flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; |
| | 1137 | * bls->header.size = sizeof(*bls); |
| | 1138 | * |
| | 1139 | * bls->config.enable_auto = 0; |
| | 1140 | * bls->config.fixed_val.r = blackLevelRed_; |
| | 1141 | * bls->config.fixed_val.gr = blackLevelGreenR_; |
| | 1142 | * bls->config.fixed_val.gb = blackLevelGreenB_; |
| | 1143 | * bls->config.fixed_val.b = blackLevelBlue_; |
| | 1144 | * } |
| | 1145 | * |
| | 1146 | * @type: The parameters block type, see |
| | 1147 | * :c:type:`rkisp1_ext_params_block_type` |
| | 1148 | * @flags: A bitmask of block flags |
| | 1149 | * @size: Size (in bytes) of the parameters block, including this header |
| | 1150 | */ |
| | 1151 | struct rkisp1_ext_params_block_header { |
| | 1152 | __u16 type; |
| | 1153 | __u16 flags; |
| | 1154 | __u32 size; |
| | 1155 | }; |
| | 1156 | |
| | 1157 | /** |
| | 1158 | * struct rkisp1_ext_params_bls_config - RkISP1 extensible params BLS config |
| | 1159 | * |
| | 1160 | * RkISP1 extensible parameters Black Level Subtraction configuration block. |
| | 1161 | * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS`. |
| | 1162 | * |
| | 1163 | * @header: The RkISP1 extensible parameters header, see |
| | 1164 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1165 | * @config: Black Level Subtraction configuration, see |
| | 1166 | * :c:type:`rkisp1_cif_isp_bls_config` |
| | 1167 | */ |
| | 1168 | struct rkisp1_ext_params_bls_config { |
| | 1169 | struct rkisp1_ext_params_block_header header; |
| | 1170 | struct rkisp1_cif_isp_bls_config config; |
| | 1171 | } __attribute__((aligned(8))); |
| | 1172 | |
| | 1173 | /** |
| | 1174 | * struct rkisp1_ext_params_dpcc_config - RkISP1 extensible params DPCC config |
| | 1175 | * |
| | 1176 | * RkISP1 extensible parameters Defective Pixel Cluster Correction configuration |
| | 1177 | * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC`. |
| | 1178 | * |
| | 1179 | * @header: The RkISP1 extensible parameters header, see |
| | 1180 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1181 | * @config: Defective Pixel Cluster Correction configuration, see |
| | 1182 | * :c:type:`rkisp1_cif_isp_dpcc_config` |
| | 1183 | */ |
| | 1184 | struct rkisp1_ext_params_dpcc_config { |
| | 1185 | struct rkisp1_ext_params_block_header header; |
| | 1186 | struct rkisp1_cif_isp_dpcc_config config; |
| | 1187 | } __attribute__((aligned(8))); |
| | 1188 | |
| | 1189 | /** |
| | 1190 | * struct rkisp1_ext_params_sdg_config - RkISP1 extensible params SDG config |
| | 1191 | * |
| | 1192 | * RkISP1 extensible parameters Sensor Degamma configuration block. Identified |
| | 1193 | * by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG`. |
| | 1194 | * |
| | 1195 | * @header: The RkISP1 extensible parameters header, see |
| | 1196 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1197 | * @config: Sensor Degamma configuration, see |
| | 1198 | * :c:type:`rkisp1_cif_isp_sdg_config` |
| | 1199 | */ |
| | 1200 | struct rkisp1_ext_params_sdg_config { |
| | 1201 | struct rkisp1_ext_params_block_header header; |
| | 1202 | struct rkisp1_cif_isp_sdg_config config; |
| | 1203 | } __attribute__((aligned(8))); |
| | 1204 | |
| | 1205 | /** |
| | 1206 | * struct rkisp1_ext_params_lsc_config - RkISP1 extensible params LSC config |
| | 1207 | * |
| | 1208 | * RkISP1 extensible parameters Lens Shading Correction configuration block. |
| | 1209 | * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC`. |
| | 1210 | * |
| | 1211 | * @header: The RkISP1 extensible parameters header, see |
| | 1212 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1213 | * @config: Lens Shading Correction configuration, see |
| | 1214 | * :c:type:`rkisp1_cif_isp_lsc_config` |
| | 1215 | */ |
| | 1216 | struct rkisp1_ext_params_lsc_config { |
| | 1217 | struct rkisp1_ext_params_block_header header; |
| | 1218 | struct rkisp1_cif_isp_lsc_config config; |
| | 1219 | } __attribute__((aligned(8))); |
| | 1220 | |
| | 1221 | /** |
| | 1222 | * struct rkisp1_ext_params_awb_gain_config - RkISP1 extensible params AWB |
| | 1223 | * gain config |
| | 1224 | * |
| | 1225 | * RkISP1 extensible parameters Auto-White Balance Gains configuration block. |
| | 1226 | * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN`. |
| | 1227 | * |
| | 1228 | * @header: The RkISP1 extensible parameters header, see |
| | 1229 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1230 | * @config: Auto-White Balance Gains configuration, see |
| | 1231 | * :c:type:`rkisp1_cif_isp_awb_gain_config` |
| | 1232 | */ |
| | 1233 | struct rkisp1_ext_params_awb_gain_config { |
| | 1234 | struct rkisp1_ext_params_block_header header; |
| | 1235 | struct rkisp1_cif_isp_awb_gain_config config; |
| | 1236 | } __attribute__((aligned(8))); |
| | 1237 | |
| | 1238 | /** |
| | 1239 | * struct rkisp1_ext_params_flt_config - RkISP1 extensible params FLT config |
| | 1240 | * |
| | 1241 | * RkISP1 extensible parameters Filter configuration block. Identified by |
| | 1242 | * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT`. |
| | 1243 | * |
| | 1244 | * @header: The RkISP1 extensible parameters header, see |
| | 1245 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1246 | * @config: Filter configuration, see :c:type:`rkisp1_cif_isp_flt_config` |
| | 1247 | */ |
| | 1248 | struct rkisp1_ext_params_flt_config { |
| | 1249 | struct rkisp1_ext_params_block_header header; |
| | 1250 | struct rkisp1_cif_isp_flt_config config; |
| | 1251 | } __attribute__((aligned(8))); |
| | 1252 | |
| | 1253 | /** |
| | 1254 | * struct rkisp1_ext_params_bdm_config - RkISP1 extensible params BDM config |
| | 1255 | * |
| | 1256 | * RkISP1 extensible parameters Demosaicing configuration block. Identified by |
| | 1257 | * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM`. |
| | 1258 | * |
| | 1259 | * @header: The RkISP1 extensible parameters header, see |
| | 1260 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1261 | * @config: Demosaicing configuration, see :c:type:`rkisp1_cif_isp_bdm_config` |
| | 1262 | */ |
| | 1263 | struct rkisp1_ext_params_bdm_config { |
| | 1264 | struct rkisp1_ext_params_block_header header; |
| | 1265 | struct rkisp1_cif_isp_bdm_config config; |
| | 1266 | } __attribute__((aligned(8))); |
| | 1267 | |
| | 1268 | /** |
| | 1269 | * struct rkisp1_ext_params_ctk_config - RkISP1 extensible params CTK config |
| | 1270 | * |
| | 1271 | * RkISP1 extensible parameters Cross-Talk configuration block. Identified by |
| | 1272 | * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK`. |
| | 1273 | * |
| | 1274 | * @header: The RkISP1 extensible parameters header, see |
| | 1275 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1276 | * @config: Cross-Talk configuration, see :c:type:`rkisp1_cif_isp_ctk_config` |
| | 1277 | */ |
| | 1278 | struct rkisp1_ext_params_ctk_config { |
| | 1279 | struct rkisp1_ext_params_block_header header; |
| | 1280 | struct rkisp1_cif_isp_ctk_config config; |
| | 1281 | } __attribute__((aligned(8))); |
| | 1282 | |
| | 1283 | /** |
| | 1284 | * struct rkisp1_ext_params_goc_config - RkISP1 extensible params GOC config |
| | 1285 | * |
| | 1286 | * RkISP1 extensible parameters Gamma-Out configuration block. Identified by |
| | 1287 | * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC`. |
| | 1288 | * |
| | 1289 | * @header: The RkISP1 extensible parameters header, see |
| | 1290 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1291 | * @config: Gamma-Out configuration, see :c:type:`rkisp1_cif_isp_goc_config` |
| | 1292 | */ |
| | 1293 | struct rkisp1_ext_params_goc_config { |
| | 1294 | struct rkisp1_ext_params_block_header header; |
| | 1295 | struct rkisp1_cif_isp_goc_config config; |
| | 1296 | } __attribute__((aligned(8))); |
| | 1297 | |
| | 1298 | /** |
| | 1299 | * struct rkisp1_ext_params_dpf_config - RkISP1 extensible params DPF config |
| | 1300 | * |
| | 1301 | * RkISP1 extensible parameters De-noise Pre-Filter configuration block. |
| | 1302 | * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF`. |
| | 1303 | * |
| | 1304 | * @header: The RkISP1 extensible parameters header, see |
| | 1305 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1306 | * @config: De-noise Pre-Filter configuration, see |
| | 1307 | * :c:type:`rkisp1_cif_isp_dpf_config` |
| | 1308 | */ |
| | 1309 | struct rkisp1_ext_params_dpf_config { |
| | 1310 | struct rkisp1_ext_params_block_header header; |
| | 1311 | struct rkisp1_cif_isp_dpf_config config; |
| | 1312 | } __attribute__((aligned(8))); |
| | 1313 | |
| | 1314 | /** |
| | 1315 | * struct rkisp1_ext_params_dpf_strength_config - RkISP1 extensible params DPF |
| | 1316 | * strength config |
| | 1317 | * |
| | 1318 | * RkISP1 extensible parameters De-noise Pre-Filter strength configuration |
| | 1319 | * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH`. |
| | 1320 | * |
| | 1321 | * @header: The RkISP1 extensible parameters header, see |
| | 1322 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1323 | * @config: De-noise Pre-Filter strength configuration, see |
| | 1324 | * :c:type:`rkisp1_cif_isp_dpf_strength_config` |
| | 1325 | */ |
| | 1326 | struct rkisp1_ext_params_dpf_strength_config { |
| | 1327 | struct rkisp1_ext_params_block_header header; |
| | 1328 | struct rkisp1_cif_isp_dpf_strength_config config; |
| | 1329 | } __attribute__((aligned(8))); |
| | 1330 | |
| | 1331 | /** |
| | 1332 | * struct rkisp1_ext_params_cproc_config - RkISP1 extensible params CPROC config |
| | 1333 | * |
| | 1334 | * RkISP1 extensible parameters Color Processing configuration block. |
| | 1335 | * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC`. |
| | 1336 | * |
| | 1337 | * @header: The RkISP1 extensible parameters header, see |
| | 1338 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1339 | * @config: Color processing configuration, see |
| | 1340 | * :c:type:`rkisp1_cif_isp_cproc_config` |
| | 1341 | */ |
| | 1342 | struct rkisp1_ext_params_cproc_config { |
| | 1343 | struct rkisp1_ext_params_block_header header; |
| | 1344 | struct rkisp1_cif_isp_cproc_config config; |
| | 1345 | } __attribute__((aligned(8))); |
| | 1346 | |
| | 1347 | /** |
| | 1348 | * struct rkisp1_ext_params_ie_config - RkISP1 extensible params IE config |
| | 1349 | * |
| | 1350 | * RkISP1 extensible parameters Image Effect configuration block. Identified by |
| | 1351 | * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_IE`. |
| | 1352 | * |
| | 1353 | * @header: The RkISP1 extensible parameters header, see |
| | 1354 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1355 | * @config: Image Effect configuration, see :c:type:`rkisp1_cif_isp_ie_config` |
| | 1356 | */ |
| | 1357 | struct rkisp1_ext_params_ie_config { |
| | 1358 | struct rkisp1_ext_params_block_header header; |
| | 1359 | struct rkisp1_cif_isp_ie_config config; |
| | 1360 | } __attribute__((aligned(8))); |
| | 1361 | |
| | 1362 | /** |
| | 1363 | * struct rkisp1_ext_params_awb_meas_config - RkISP1 extensible params AWB |
| | 1364 | * Meas config |
| | 1365 | * |
| | 1366 | * RkISP1 extensible parameters Auto-White Balance Measurement configuration |
| | 1367 | * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS`. |
| | 1368 | * |
| | 1369 | * @header: The RkISP1 extensible parameters header, see |
| | 1370 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1371 | * @config: Auto-White Balance measure configuration, see |
| | 1372 | * :c:type:`rkisp1_cif_isp_awb_meas_config` |
| | 1373 | */ |
| | 1374 | struct rkisp1_ext_params_awb_meas_config { |
| | 1375 | struct rkisp1_ext_params_block_header header; |
| | 1376 | struct rkisp1_cif_isp_awb_meas_config config; |
| | 1377 | } __attribute__((aligned(8))); |
| | 1378 | |
| | 1379 | /** |
| | 1380 | * struct rkisp1_ext_params_hst_config - RkISP1 extensible params Histogram config |
| | 1381 | * |
| | 1382 | * RkISP1 extensible parameters Histogram statistics configuration block. |
| | 1383 | * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS`. |
| | 1384 | * |
| | 1385 | * @header: The RkISP1 extensible parameters header, see |
| | 1386 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1387 | * @config: Histogram statistics configuration, see |
| | 1388 | * :c:type:`rkisp1_cif_isp_hst_config` |
| | 1389 | */ |
| | 1390 | struct rkisp1_ext_params_hst_config { |
| | 1391 | struct rkisp1_ext_params_block_header header; |
| | 1392 | struct rkisp1_cif_isp_hst_config config; |
| | 1393 | } __attribute__((aligned(8))); |
| | 1394 | |
| | 1395 | /** |
| | 1396 | * struct rkisp1_ext_params_aec_config - RkISP1 extensible params AEC config |
| | 1397 | * |
| | 1398 | * RkISP1 extensible parameters Auto-Exposure statistics configuration block. |
| | 1399 | * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS`. |
| | 1400 | * |
| | 1401 | * @header: The RkISP1 extensible parameters header, see |
| | 1402 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1403 | * @config: Auto-Exposure statistics configuration, see |
| | 1404 | * :c:type:`rkisp1_cif_isp_aec_config` |
| | 1405 | */ |
| | 1406 | struct rkisp1_ext_params_aec_config { |
| | 1407 | struct rkisp1_ext_params_block_header header; |
| | 1408 | struct rkisp1_cif_isp_aec_config config; |
| | 1409 | } __attribute__((aligned(8))); |
| | 1410 | |
| | 1411 | /** |
| | 1412 | * struct rkisp1_ext_params_afc_config - RkISP1 extensible params AFC config |
| | 1413 | * |
| | 1414 | * RkISP1 extensible parameters Auto-Focus statistics configuration block. |
| | 1415 | * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS`. |
| | 1416 | * |
| | 1417 | * @header: The RkISP1 extensible parameters header, see |
| | 1418 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1419 | * @config: Auto-Focus statistics configuration, see |
| | 1420 | * :c:type:`rkisp1_cif_isp_afc_config` |
| | 1421 | */ |
| | 1422 | struct rkisp1_ext_params_afc_config { |
| | 1423 | struct rkisp1_ext_params_block_header header; |
| | 1424 | struct rkisp1_cif_isp_afc_config config; |
| | 1425 | } __attribute__((aligned(8))); |
| | 1426 | |
| | 1427 | /** |
| | 1428 | * struct rkisp1_ext_params_compand_bls_config - RkISP1 extensible params |
| | 1429 | * Compand BLS config |
| | 1430 | * |
| | 1431 | * RkISP1 extensible parameters Companding configuration block (black level |
| | 1432 | * subtraction). Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS`. |
| | 1433 | * |
| | 1434 | * @header: The RkISP1 extensible parameters header, see |
| | 1435 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1436 | * @config: Companding BLS configuration, see |
| | 1437 | * :c:type:`rkisp1_cif_isp_compand_bls_config` |
| | 1438 | */ |
| | 1439 | struct rkisp1_ext_params_compand_bls_config { |
| | 1440 | struct rkisp1_ext_params_block_header header; |
| | 1441 | struct rkisp1_cif_isp_compand_bls_config config; |
| | 1442 | } __attribute__((aligned(8))); |
| | 1443 | |
| | 1444 | /** |
| | 1445 | * struct rkisp1_ext_params_compand_curve_config - RkISP1 extensible params |
| | 1446 | * Compand curve config |
| | 1447 | * |
| | 1448 | * RkISP1 extensible parameters Companding configuration block (expand and |
| | 1449 | * compression curves). Identified by |
| | 1450 | * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND` or |
| | 1451 | * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS`. |
| | 1452 | * |
| | 1453 | * @header: The RkISP1 extensible parameters header, see |
| | 1454 | * :c:type:`rkisp1_ext_params_block_header` |
| | 1455 | * @config: Companding curve configuration, see |
| | 1456 | * :c:type:`rkisp1_cif_isp_compand_curve_config` |
| | 1457 | */ |
| | 1458 | struct rkisp1_ext_params_compand_curve_config { |
| | 1459 | struct rkisp1_ext_params_block_header header; |
| | 1460 | struct rkisp1_cif_isp_compand_curve_config config; |
| | 1461 | } __attribute__((aligned(8))); |
| | 1462 | |
| | 1463 | /* |
| | 1464 | * The rkisp1_ext_params_compand_curve_config structure is counted twice as it |
| | 1465 | * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types. |
| | 1466 | */ |
| | 1467 | #define RKISP1_EXT_PARAMS_MAX_SIZE \ |
| | 1468 | (sizeof(struct rkisp1_ext_params_bls_config) +\ |
| | 1469 | sizeof(struct rkisp1_ext_params_dpcc_config) +\ |
| | 1470 | sizeof(struct rkisp1_ext_params_sdg_config) +\ |
| | 1471 | sizeof(struct rkisp1_ext_params_lsc_config) +\ |
| | 1472 | sizeof(struct rkisp1_ext_params_awb_gain_config) +\ |
| | 1473 | sizeof(struct rkisp1_ext_params_flt_config) +\ |
| | 1474 | sizeof(struct rkisp1_ext_params_bdm_config) +\ |
| | 1475 | sizeof(struct rkisp1_ext_params_ctk_config) +\ |
| | 1476 | sizeof(struct rkisp1_ext_params_goc_config) +\ |
| | 1477 | sizeof(struct rkisp1_ext_params_dpf_config) +\ |
| | 1478 | sizeof(struct rkisp1_ext_params_dpf_strength_config) +\ |
| | 1479 | sizeof(struct rkisp1_ext_params_cproc_config) +\ |
| | 1480 | sizeof(struct rkisp1_ext_params_ie_config) +\ |
| | 1481 | sizeof(struct rkisp1_ext_params_awb_meas_config) +\ |
| | 1482 | sizeof(struct rkisp1_ext_params_hst_config) +\ |
| | 1483 | sizeof(struct rkisp1_ext_params_aec_config) +\ |
| | 1484 | sizeof(struct rkisp1_ext_params_afc_config) +\ |
| | 1485 | sizeof(struct rkisp1_ext_params_compand_bls_config) +\ |
| | 1486 | sizeof(struct rkisp1_ext_params_compand_curve_config) +\ |
| | 1487 | sizeof(struct rkisp1_ext_params_compand_curve_config)) |
| | 1488 | |
| | 1489 | /** |
| | 1490 | * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version |
| | 1491 | * |
| | 1492 | * @RKISP1_EXT_PARAM_BUFFER_V1: First version of RkISP1 extensible parameters |
| | 1493 | */ |
| | 1494 | enum rksip1_ext_param_buffer_version { |
| | 1495 | RKISP1_EXT_PARAM_BUFFER_V1 = 1, |
| | 1496 | }; |
| | 1497 | |
| | 1498 | /** |
| | 1499 | * struct rkisp1_ext_params_cfg - RkISP1 extensible parameters configuration |
| | 1500 | * |
| | 1501 | * This struct contains the configuration parameters of the RkISP1 ISP |
| | 1502 | * algorithms, serialized by userspace into a data buffer. Each configuration |
| | 1503 | * parameter block is represented by a block-specific structure which contains a |
| | 1504 | * :c:type:`rkisp1_ext_params_block_header` entry as first member. Userspace |
| | 1505 | * populates the @data buffer with configuration parameters for the blocks that |
| | 1506 | * it intends to configure. As a consequence, the data buffer effective size |
| | 1507 | * changes according to the number of ISP blocks that userspace intends to |
| | 1508 | * configure and is set by userspace in the @data_size field. |
| | 1509 | * |
| | 1510 | * The parameters buffer is versioned by the @version field to allow modifying |
| | 1511 | * and extending its definition. Userspace shall populate the @version field to |
| | 1512 | * inform the driver about the version it intends to use. The driver will parse |
| | 1513 | * and handle the @data buffer according to the data layout specific to the |
| | 1514 | * indicated version and return an error if the desired version is not |
| | 1515 | * supported. |
| | 1516 | * |
| | 1517 | * Currently the single RKISP1_EXT_PARAM_BUFFER_V1 version is supported. |
| | 1518 | * When a new format version will be added, a mechanism for userspace to query |
| | 1519 | * the supported format versions will be implemented in the form of a read-only |
| | 1520 | * V4L2 control. If such control is not available, userspace should assume only |
| | 1521 | * RKISP1_EXT_PARAM_BUFFER_V1 is supported by the driver. |
| | 1522 | * |
| | 1523 | * For each ISP block that userspace wants to configure, a block-specific |
| | 1524 | * structure is appended to the @data buffer, one after the other without gaps |
| | 1525 | * in between nor overlaps. Userspace shall populate the @data_size field with |
| | 1526 | * the effective size, in bytes, of the @data buffer. |
| | 1527 | * |
| | 1528 | * The expected memory layout of the parameters buffer is:: |
| | 1529 | * |
| | 1530 | * +-------------------- struct rkisp1_ext_params_cfg -------------------+ |
| | 1531 | * | version = RKISP_EXT_PARAMS_BUFFER_V1; | |
| | 1532 | * | data_size = sizeof(struct rkisp1_ext_params_bls_config) | |
| | 1533 | * | + sizeof(struct rkisp1_ext_params_dpcc_config); | |
| | 1534 | * | +------------------------- data ---------------------------------+ | |
| | 1535 | * | | +------------- struct rkisp1_ext_params_bls_config -----------+ | | |
| | 1536 | * | | | +-------- struct rkisp1_ext_params_block_header ---------+ | | | |
| | 1537 | * | | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS; | | | | |
| | 1538 | * | | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; | | | | |
| | 1539 | * | | | | size = sizeof(struct rkisp1_ext_params_bls_config); | | | | |
| | 1540 | * | | | +---------------------------------------------------------+ | | | |
| | 1541 | * | | | +---------- struct rkisp1_cif_isp_bls_config -------------+ | | | |
| | 1542 | * | | | | enable_auto = 0; | | | | |
| | 1543 | * | | | | fixed_val.r = 256; | | | | |
| | 1544 | * | | | | fixed_val.gr = 256; | | | | |
| | 1545 | * | | | | fixed_val.gb = 256; | | | | |
| | 1546 | * | | | | fixed_val.b = 256; | | | | |
| | 1547 | * | | | +---------------------------------------------------------+ | | | |
| | 1548 | * | | +------------ struct rkisp1_ext_params_dpcc_config -----------+ | | |
| | 1549 | * | | | +-------- struct rkisp1_ext_params_block_header ---------+ | | | |
| | 1550 | * | | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC; | | | | |
| | 1551 | * | | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; | | | | |
| | 1552 | * | | | | size = sizeof(struct rkisp1_ext_params_dpcc_config); | | | | |
| | 1553 | * | | | +---------------------------------------------------------+ | | | |
| | 1554 | * | | | +---------- struct rkisp1_cif_isp_dpcc_config ------------+ | | | |
| | 1555 | * | | | | mode = RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE; | | | | |
| | 1556 | * | | | | output_mode = | | | | |
| | 1557 | * | | | | RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER; | | | | |
| | 1558 | * | | | | set_use = ... ; | | | | |
| | 1559 | * | | | | ... = ... ; | | | | |
| | 1560 | * | | | +---------------------------------------------------------+ | | | |
| | 1561 | * | | +-------------------------------------------------------------+ | | |
| | 1562 | * | +-----------------------------------------------------------------+ | |
| | 1563 | * +---------------------------------------------------------------------+ |
| | 1564 | * |
| | 1565 | * @version: The RkISP1 extensible parameters buffer version, see |
| | 1566 | * :c:type:`rksip1_ext_param_buffer_version` |
| | 1567 | * @data_size: The RkISP1 configuration data effective size, excluding this |
| | 1568 | * header |
| | 1569 | * @data: The RkISP1 extensible configuration data blocks |
| | 1570 | */ |
| | 1571 | struct rkisp1_ext_params_cfg { |
| | 1572 | __u32 version; |
| | 1573 | __u32 data_size; |
| | 1574 | __u8 data[RKISP1_EXT_PARAMS_MAX_SIZE]; |
| | 1575 | }; |
| | 1576 | |
| 999 | #endif /* _UAPI_RKISP1_CONFIG_H */ | 1577 | #endif /* _UAPI_RKISP1_CONFIG_H */ |