FILE
atomisp_cmd.h
File preview with syntax highlighting.
linux-6.19.14/drivers/staging/media/atomisp/pci/atomisp_cmd.h
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Support for Medifield PNW Camera Imaging ISP subsystem. 4 * 5 * Copyright (c) 2010 Intel Corporation. All Rights Reserved. 6 * 7 * Copyright (c) 2010 Silicon Hive www.siliconhive.com. 8 */ 9 10#ifndef __ATOMISP_CMD_H__ 11#define __ATOMISP_CMD_H__ 12 13#include "../../include/linux/atomisp.h" 14#include <linux/interrupt.h> 15#include <linux/videodev2.h> 16 17#include <media/v4l2-subdev.h> 18 19#include "atomisp_internal.h" 20 21#include "ia_css_types.h" 22#include "ia_css.h" 23 24struct atomisp_device; 25struct ia_css_frame; 26 27#define MSI_ENABLE_BIT 16 28#define INTR_DISABLE_BIT 10 29#define BUS_MASTER_ENABLE 2 30#define MEMORY_SPACE_ENABLE 1 31#define INTR_IER 24 32#define INTR_IIR 16 33 34/* Helper function */ 35void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr, 36 unsigned int size); 37struct camera_mipi_info *atomisp_to_sensor_mipi_info(struct v4l2_subdev *sd); 38struct atomisp_video_pipe *atomisp_to_video_pipe(struct video_device *dev); 39int atomisp_reset(struct atomisp_device *isp); 40int atomisp_buffers_in_css(struct atomisp_video_pipe *pipe); 41void atomisp_buffer_done(struct ia_css_frame *frame, enum vb2_buffer_state state); 42void atomisp_flush_video_pipe(struct atomisp_video_pipe *pipe, enum vb2_buffer_state state, 43 bool warn_on_css_frames); 44void atomisp_clear_css_buffer_counters(struct atomisp_sub_device *asd); 45 46/* Interrupt functions */ 47void atomisp_msi_irq_init(struct atomisp_device *isp); 48void atomisp_msi_irq_uninit(struct atomisp_device *isp); 49void atomisp_assert_recovery_work(struct work_struct *work); 50irqreturn_t atomisp_isr(int irq, void *dev); 51irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr); 52const struct atomisp_format_bridge *get_atomisp_format_bridge_from_mbus( 53 u32 mbus_code); 54bool atomisp_is_mbuscode_raw(uint32_t code); 55 56/* Get internal fmt according to V4L2 fmt */ 57bool atomisp_is_viewfinder_support(struct atomisp_device *isp); 58 59/* ISP features control function */ 60 61/* 62 * Function to enable/disable lens geometry distortion correction (GDC) and 63 * chromatic aberration correction (CAC) 64 */ 65int atomisp_gdc_cac(struct atomisp_sub_device *asd, int flag, 66 __s32 *value); 67 68/* Function to enable/disable low light mode (including ANR) */ 69int atomisp_low_light(struct atomisp_sub_device *asd, int flag, 70 __s32 *value); 71 72/* 73 * Function to enable/disable extra noise reduction (XNR) in low light 74 * condition 75 */ 76int atomisp_xnr(struct atomisp_sub_device *asd, int flag, int *arg); 77 78int atomisp_formats(struct atomisp_sub_device *asd, int flag, 79 struct atomisp_formats_config *config); 80 81/* Function to configure noise reduction */ 82int atomisp_nr(struct atomisp_sub_device *asd, int flag, 83 struct atomisp_nr_config *config); 84 85/* Function to configure temporal noise reduction (TNR) */ 86int atomisp_tnr(struct atomisp_sub_device *asd, int flag, 87 struct atomisp_tnr_config *config); 88 89/* Function to configure black level compensation */ 90int atomisp_black_level(struct atomisp_sub_device *asd, int flag, 91 struct atomisp_ob_config *config); 92 93/* Function to configure edge enhancement */ 94int atomisp_ee(struct atomisp_sub_device *asd, int flag, 95 struct atomisp_ee_config *config); 96 97/* Function to update Gamma table for gamma, brightness and contrast config */ 98int atomisp_gamma(struct atomisp_sub_device *asd, int flag, 99 struct atomisp_gamma_table *config); 100 101/* Function to update Ctc table for Chroma Enhancement */ 102int atomisp_ctc(struct atomisp_sub_device *asd, int flag, 103 struct atomisp_ctc_table *config); 104 105/* Function to update gamma correction parameters */ 106int atomisp_gamma_correction(struct atomisp_sub_device *asd, int flag, 107 struct atomisp_gc_config *config); 108 109/* Function to update Gdc table for gdc */ 110int atomisp_gdc_cac_table(struct atomisp_sub_device *asd, int flag, 111 struct atomisp_morph_table *config); 112 113/* Function to update table for macc */ 114int atomisp_macc_table(struct atomisp_sub_device *asd, int flag, 115 struct atomisp_macc_config *config); 116 117/* Function to get DIS statistics. */ 118int atomisp_get_dis_stat(struct atomisp_sub_device *asd, 119 struct atomisp_dis_statistics *stats); 120 121/* Function to get DVS2 BQ resolution settings */ 122int atomisp_get_dvs2_bq_resolutions(struct atomisp_sub_device *asd, 123 struct atomisp_dvs2_bq_resolutions *bq_res); 124 125/* Function to set the DIS coefficients. */ 126int atomisp_set_dis_coefs(struct atomisp_sub_device *asd, 127 struct atomisp_dis_coefficients *coefs); 128 129/* Function to set the DIS motion vector. */ 130int atomisp_set_dis_vector(struct atomisp_sub_device *asd, 131 struct atomisp_dis_vector *vector); 132 133/* Function to set/get 3A stat from isp */ 134int atomisp_3a_stat(struct atomisp_sub_device *asd, int flag, 135 struct atomisp_3a_statistics *config); 136 137int atomisp_set_parameters(struct video_device *vdev, 138 struct atomisp_parameters *arg); 139 140/* Function to set/get isp parameters to isp */ 141int atomisp_param(struct atomisp_sub_device *asd, int flag, 142 struct atomisp_parm *config); 143 144/* Function to configure color effect of the image */ 145int atomisp_color_effect(struct atomisp_sub_device *asd, int flag, 146 __s32 *effect); 147 148/* Function to configure bad pixel correction */ 149int atomisp_bad_pixel(struct atomisp_sub_device *asd, int flag, 150 __s32 *value); 151 152/* Function to configure bad pixel correction params */ 153int atomisp_bad_pixel_param(struct atomisp_sub_device *asd, int flag, 154 struct atomisp_dp_config *config); 155 156/* Function to enable/disable video image stablization */ 157int atomisp_video_stable(struct atomisp_sub_device *asd, int flag, 158 __s32 *value); 159 160/* Function to configure fixed pattern noise */ 161int atomisp_fixed_pattern(struct atomisp_sub_device *asd, int flag, 162 __s32 *value); 163 164/* Function to configure fixed pattern noise table */ 165int atomisp_fixed_pattern_table(struct atomisp_sub_device *asd, 166 struct v4l2_framebuffer *config); 167 168/* Function to configure false color correction */ 169int atomisp_false_color(struct atomisp_sub_device *asd, int flag, 170 __s32 *value); 171 172/* Function to configure false color correction params */ 173int atomisp_false_color_param(struct atomisp_sub_device *asd, int flag, 174 struct atomisp_de_config *config); 175 176/* Function to configure white balance params */ 177int atomisp_white_balance_param(struct atomisp_sub_device *asd, int flag, 178 struct atomisp_wb_config *config); 179 180int atomisp_3a_config_param(struct atomisp_sub_device *asd, int flag, 181 struct atomisp_3a_config *config); 182 183/* Function to setup digital zoom */ 184int atomisp_digital_zoom(struct atomisp_sub_device *asd, int flag, 185 __s32 *value); 186 187/* Function set camera_prefiles.xml current sensor pixel array size */ 188int atomisp_set_array_res(struct atomisp_sub_device *asd, 189 struct atomisp_resolution *config); 190 191/* Function to calculate real zoom region for every pipe */ 192int atomisp_calculate_real_zoom_region(struct atomisp_sub_device *asd, 193 struct ia_css_dz_config *dz_config, 194 enum ia_css_pipe_id css_pipe_id); 195 196int atomisp_cp_general_isp_parameters(struct atomisp_sub_device *asd, 197 struct atomisp_parameters *arg, 198 struct atomisp_css_params *css_param, 199 bool from_user); 200 201int atomisp_cp_lsc_table(struct atomisp_sub_device *asd, 202 struct atomisp_shading_table *source_st, 203 struct atomisp_css_params *css_param, 204 bool from_user); 205 206int atomisp_css_cp_dvs2_coefs(struct atomisp_sub_device *asd, 207 struct ia_css_dvs2_coefficients *coefs, 208 struct atomisp_css_params *css_param, 209 bool from_user); 210 211int atomisp_cp_morph_table(struct atomisp_sub_device *asd, 212 struct atomisp_morph_table *source_morph_table, 213 struct atomisp_css_params *css_param, 214 bool from_user); 215 216int atomisp_cp_dvs_6axis_config(struct atomisp_sub_device *asd, 217 struct atomisp_dvs_6axis_config *user_6axis_config, 218 struct atomisp_css_params *css_param, 219 bool from_user); 220 221int atomisp_makeup_css_parameters(struct atomisp_sub_device *asd, 222 struct atomisp_parameters *arg, 223 struct atomisp_css_params *css_param); 224 225int atomisp_compare_grid(struct atomisp_sub_device *asd, 226 struct atomisp_grid_info *atomgrid); 227 228/* Get sensor padding values for the non padded width x height resolution */ 229void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height, 230 u32 *padding_w, u32 *padding_h); 231 232/* Set sensor power (no-op if already on/off) */ 233int atomisp_s_sensor_power(struct atomisp_device *isp, unsigned int input, bool on); 234 235/* Select which sensor to use, must be called with a valid input */ 236int atomisp_select_input(struct atomisp_device *isp, unsigned int input); 237 238/* Setup media-controller links to reflect input_curr setting */ 239void atomisp_setup_input_links(struct atomisp_device *isp); 240 241/* This function looks up the closest available resolution. */ 242int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, 243 const struct atomisp_format_bridge **fmt_ret, 244 const struct atomisp_format_bridge **snr_fmt_ret); 245 246int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f); 247 248int atomisp_set_shading_table(struct atomisp_sub_device *asd, 249 struct atomisp_shading_table *shading_table); 250 251void atomisp_free_internal_buffers(struct atomisp_sub_device *asd); 252 253int atomisp_freq_scaling(struct atomisp_device *vdev, 254 enum atomisp_dfs_mode mode, 255 bool force); 256 257void atomisp_buf_done(struct atomisp_sub_device *asd, int error, 258 enum ia_css_buffer_type buf_type, 259 enum ia_css_pipe_id css_pipe_id, 260 bool q_buffers, enum atomisp_input_stream_id stream_id); 261 262/* Events. Only one event has to be exported for now. */ 263void atomisp_eof_event(struct atomisp_sub_device *asd, uint8_t exp_id); 264 265enum mipi_port_id atomisp_port_to_mipi_port(struct atomisp_device *isp, 266 enum atomisp_camera_port port); 267 268void atomisp_apply_css_parameters( 269 struct atomisp_sub_device *asd, 270 struct atomisp_css_params *css_param); 271void atomisp_free_css_parameters(struct atomisp_css_params *css_param); 272 273void atomisp_handle_parameter_and_buffer(struct atomisp_video_pipe *pipe); 274 275void atomisp_flush_params_queue(struct atomisp_video_pipe *asd); 276 277/* Function to do Raw Buffer related operation, after enable Lock Unlock Raw Buffer */ 278int atomisp_exp_id_unlock(struct atomisp_sub_device *asd, int *exp_id); 279int atomisp_exp_id_capture(struct atomisp_sub_device *asd, int *exp_id); 280 281void atomisp_init_raw_buffer_bitmap(struct atomisp_sub_device *asd); 282 283/* Function to enable/disable zoom for capture pipe */ 284int atomisp_enable_dz_capt_pipe(struct atomisp_sub_device *asd, 285 unsigned int *enable); 286 287u32 atomisp_get_pixel_depth(u32 pixelformat); 288 289/* Function for HAL to inject a fake event to wake up poll thread */ 290int atomisp_inject_a_fake_event(struct atomisp_sub_device *asd, int *event); 291 292/* 293 * Function for HAL to query how many invalid frames at the beginning of ISP 294 * pipeline output 295 */ 296int atomisp_get_invalid_frame_num(struct video_device *vdev, 297 int *invalid_frame_num); 298 299int atomisp_power_off(struct device *dev); 300int atomisp_power_on(struct device *dev); 301#endif /* __ATOMISP_CMD_H__ */
~/
Read-only file preview.