| @@ -32,6 +32,36 @@ struct rppx1_window { · 31 unmodified lines |
| 32 | 32 | __u16 v_size; |
| 33 | 33 | }; |
| 34 | 34 | |
| 35 | +/** |
| 36 | + * enum rppx1_meas_chan - Measurement point for the Histogram and EXM Modules |
| 37 | + * |
| 38 | + * Measurement points for the RPP-X1 Histogram measurement module and Exposure |
| 39 | + * measurement module. |
| 40 | + * |
| 41 | + * All tap points are available for the PRE1/PRE2 pipes. Only |
| 42 | + * RPPX1_MEAS_CHAN_SEL4 and RPPX1_MEAS_CHAN_SEL7 are available for the |
| 43 | + * MAIN_POST pipe. |
| 44 | + * |
| 45 | + * @RPPX1_MEAS_CHAN_SEL0: after input acquisition |
| 46 | + * @RPPX1_MEAS_CHAN_SEL1: after black level subtraction |
| 47 | + * @RPPX1_MEAS_CHAN_SEL2: after sensor gamma linearization |
| 48 | + * @RPPX1_MEAS_CHAN_SEL3: after lens shading correction |
| 49 | + * @RPPX1_MEAS_CHAN_SEL4: after auto white balance gains |
| 50 | + * @RPPX1_MEAS_CHAN_SEL5: after defect pixel correction |
| 51 | + * @RPPX1_MEAS_CHAN_SEL6: after denoise pre-filter |
| 52 | + * @RPPX1_MEAS_CHAN_SEL7: after demosaicing |
| 53 | + */ |
| 54 | +enum rppx1_meas_chan { |
| 55 | + RPPX1_MEAS_CHAN_SEL0, |
| 56 | + RPPX1_MEAS_CHAN_SEL1, |
| 57 | + RPPX1_MEAS_CHAN_SEL2, |
| 58 | + RPPX1_MEAS_CHAN_SEL3, |
| 59 | + RPPX1_MEAS_CHAN_SEL4, |
| 60 | + RPPX1_MEAS_CHAN_SEL5, |
| 61 | + RPPX1_MEAS_CHAN_SEL6, |
| 62 | + RPPX1_MEAS_CHAN_SEL7, |
| 63 | +}; |
| 64 | + |
| 35 | 65 | /* --------------------------------------------------------------------------- |
| 36 | 66 | * Parameter Structures |
| 37 | 67 | * |
| @@ -50,12 +80,16 @@ struct rppx1_window { · 12 unmodified lines |
| 50 | 80 | * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1: PRE1 pipe White Balance Gains |
| 51 | 81 | * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2: PRE2 White Balance Gains |
| 52 | 82 | * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST: MAIN_POST White Balance Gains |
| 83 | + * @RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1: PRE1 pipe Exposure Measurement |
| 84 | + * @RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2: PRE2 pipe Exposure Measurement |
| 53 | 85 | */ |
| 54 | 86 | enum rppx1_params_block_type { |
| 55 | 87 | RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST, |
| 56 | 88 | RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1, |
| 57 | 89 | RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2, |
| 58 | 90 | RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST, |
| 91 | + RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1, |
| 92 | + RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2, |
| 59 | 93 | }; |
| 60 | 94 | |
| 61 | 95 | /** |
| @@ -149,6 +183,66 @@ struct rppx1_awbg_params { · 87 unmodified lines |
| 149 | 183 | __u32 gain_green_b; |
| 150 | 184 | }; |
| 151 | 185 | |
| 186 | +/** |
| 187 | + * enum rppx1_exm_mode - Exposure measurement mode |
| 188 | + * |
| 189 | + * Exaposure measurement mode selection (RGB/Bayer). |
| 190 | + * |
| 191 | + * @RPPX1_EXP_MEASURING_MODE_DISABLED: no measurement |
| 192 | + * @RPPX1_EXP_MEASURING_MODE_RGB: Y/R/G/B measurement |
| 193 | + * @RPPX1_EXP_MEASURING_MODE_BAYER: Bayer RGB measurement |
| 194 | + */ |
| 195 | +enum rppx1_exm_mode { |
| 196 | + RPPX1_EXP_MEASURING_MODE_DISABLED, |
| 197 | + RPPX1_EXP_MEASURING_MODE_RGB, |
| 198 | + RPPX1_EXP_MEASURING_MODE_BAYER, |
| 199 | +}; |
| 200 | + |
| 201 | +/** |
| 202 | + * struct rppx1_exm_params - Exposure measurement configuration |
| 203 | + * |
| 204 | + * The RPP-X1 Exposure measurement unit is available on the PRE1 and PRE2 |
| 205 | + * pre-fusion pipes. Userspace selects which pipe to operate by setting |
| 206 | + * the @header.type field to RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1 or |
| 207 | + * RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2. |
| 208 | + * |
| 209 | + * Exposure measurement is performed in the RGB or Bayer domain, according to |
| 210 | + * the setting of the @mode field. The exposure measurement tap point is |
| 211 | + * selected according to the value of @channel_sel. |
| 212 | + * |
| 213 | + * The exposure measurement is performed on an input window specified in @wnd. |
| 214 | + * To each color component a programmable weight coefficient is associated. |
| 215 | + * Coefficients are represented as unsigned 8 bits integer values in Q1.7 format |
| 216 | + * ranging from 0 to 1.992. |
| 217 | + * |
| 218 | + * The @last_line fields controls when the exposure measurement completes. It |
| 219 | + * is usually programmed to the value of (@wnd.v_offs + @wnd.v_size + 1). |
| 220 | + * |
| 221 | + * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1 or |
| 222 | + * type = RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2) |
| 223 | + * @wnd: measurement window coordinates |
| 224 | + * @mode: exposure measure mode (from enum rppx1_exm_mode) |
| 225 | + * @last_line: line number for which the exposure measurement completes |
| 226 | + * @channel_sel: exposure measurement point (see enum rppx1_meas_chan) |
| 227 | + * @coeff_r: coefficient for the red Bayer sample or red color channel, Q1.7 |
| 228 | + * @coeff_g_gr: coefficient for the green/red Bayer sample or green color channel, Q1.7 |
| 229 | + * @coeff_b: coefficient for the blue Bayer sample or blue color channel, Q1.7 |
| 230 | + * @coeff_gb: coefficient for the green/blue Bayer sample, unused in RGB mode, Q1.7 |
| 231 | + * @reserved: padding |
| 232 | + */ |
| 233 | +struct rppx1_exm_params { |
| 234 | + struct v4l2_isp_params_block_header header; |
| 235 | + struct rppx1_window wnd; |
| 236 | + __u32 mode; |
| 237 | + __u32 last_line; |
| 238 | + __u8 channel_sel; |
| 239 | + __u8 coeff_r; |
| 240 | + __u8 coeff_g_gr; |
| 241 | + __u8 coeff_b; |
| 242 | + __u8 coeff_gb; |
| 243 | + __u8 reserved[3]; |
| 244 | +}; |
| 245 | + |
| 152 | 246 | /** |
| 153 | 247 | * RPPX1_PARAMS_MAX_SIZE - Maximum size of all RPP-X1 parameter blocks |
| 154 | 248 | * |
| @@ -159,7 +253,9 @@ struct rppx1_awbg_params { · 4 unmodified lines |
| 159 | 253 | (sizeof(struct rppx1_wbmeas_params) + \ |
| 160 | 254 | sizeof(struct rppx1_awbg_params) + \ |
| 161 | 255 | sizeof(struct rppx1_awbg_params) + \ |
| 162 | | − sizeof(struct rppx1_awbg_params)) |
| 256 | + sizeof(struct rppx1_awbg_params) + \ |
| 257 | + sizeof(struct rppx1_exm_params) + \ |
| 258 | + sizeof(struct rppx1_exm_params)) |
| 163 | 259 | |
| 164 | 260 | /* --------------------------------------------------------------------------- |
| 165 | 261 | * Statistics Structures |
| @@ -176,9 +272,13 @@ struct rppx1_awbg_params { · 10 unmodified lines |
| 176 | 272 | * NOTE: Only append to the enumeration as the numbers are uAPI. |
| 177 | 273 | * |
| 178 | 274 | * @RPPX1_STATS_BLOCK_TYPE_WBMEAS_POST: post-fusion white-balance measurement |
| 275 | + * @RPPX1_STATS_BLOCK_TYPE_EXM_PRE1: pre-fusion pipe1 exposure measurement |
| 276 | + * @RPPX1_STATS_BLOCK_TYPE_EXM_PRE2: pre-fusion pipe2 exposure measurement |
| 179 | 277 | */ |
| 180 | 278 | enum rppx1_stats_block_type { |
| 181 | 279 | RPPX1_STATS_BLOCK_TYPE_WBMEAS_POST, |
| 280 | + RPPX1_STATS_BLOCK_TYPE_EXM_PRE1, |
| 281 | + RPPX1_STATS_BLOCK_TYPE_EXM_PRE2, |
| 182 | 282 | }; |
| 183 | 283 | |
| 184 | 284 | /** |
| @@ -198,6 +298,25 @@ struct rppx1_wbmeas_stats { · 13 unmodified lines |
| 198 | 298 | __u32 mean_cr_or_r; |
| 199 | 299 | }; |
| 200 | 300 | |
| 301 | +/* Exposure Measurement */ |
| 302 | +#define RPPX1_EXM_NUM_WIN 25 |
| 303 | + |
| 304 | +/** |
| 305 | + * struct rppx1_exm_stats - Exposure measurement |
| 306 | + * |
| 307 | + * RPP-X1 exposure measurement calculates the mean value on 25 programmable |
| 308 | + * windows on the input picture. |
| 309 | + * |
| 310 | + * @header: block header (type = RPPX1_STATS_BLOCK_TYPE_EXM_PRE1) |
| 311 | + * @exp_mean: mean luminance values per block, up to 20-bit |
| 312 | + * @reserved: padding |
| 313 | + */ |
| 314 | +struct rppx1_exm_stats { |
| 315 | + struct v4l2_isp_block_header header; |
| 316 | + __u32 exp_mean[RPPX1_EXM_NUM_WIN]; |
| 317 | + __u32 reserved; |
| 318 | +}; |
| 319 | + |
| 201 | 320 | /** |
| 202 | 321 | * RPPX1_STATS_MAX_SIZE - Maximum size of all RPP-X1 statistics |
| 203 | 322 | * |
| @@ -205,6 +324,8 @@ struct rppx1_wbmeas_stats { · 1 unmodified line |
| 205 | 324 | * multiple pipes. |
| 206 | 325 | */ |
| 207 | 326 | #define RPPX1_STATS_MAX_SIZE \ |
| 208 | | − (sizeof(struct rppx1_wbmeas_stats)) |
| 327 | + (sizeof(struct rppx1_wbmeas_stats) + \ |
| 328 | + sizeof(struct rppx1_exm_stats) + \ |
| 329 | + sizeof(struct rppx1_exm_stats)) |
| 209 | 330 | |
| 210 | 331 | #endif /* __UAPI_RPP_X1_CONFIG_H */ |