linux/drivers/staging/media/atomisp/include/linux/atomisp.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Support for Medifield PNW Camera Imaging ISP subsystem.
 *
 * Copyright (c) 2010 Intel Corporation. All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version
 * 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 *
 */

#ifndef _ATOM_ISP_H
#define _ATOM_ISP_H

#include <linux/types.h>
#include <linux/version.h>

/* struct media_device_info.hw_revision */
#define ATOMISP_HW_REVISION_MASK
#define ATOMISP_HW_REVISION_SHIFT
#define ATOMISP_HW_REVISION_ISP2300
#define ATOMISP_HW_REVISION_ISP2400
#define ATOMISP_HW_REVISION_ISP2401_LEGACY
#define ATOMISP_HW_REVISION_ISP2401

#define ATOMISP_HW_STEPPING_MASK
#define ATOMISP_HW_STEPPING_A0
#define ATOMISP_HW_STEPPING_B0

/*ISP binary running mode*/
#define CI_MODE_PREVIEW
#define CI_MODE_VIDEO
#define CI_MODE_STILL_CAPTURE
#define CI_MODE_NONE

#define OUTPUT_MODE_FILE
#define OUTPUT_MODE_TEXT

/*
 * Camera HAL sets this flag in v4l2_buffer reserved2 to indicate this
 * buffer has a per-frame parameter.
 */
#define ATOMISP_BUFFER_HAS_PER_FRAME_SETTING

/* Custom format for RAW capture from M10MO 0x3130314d */
#define V4L2_PIX_FMT_CUSTOM_M10MO_RAW

/* Custom media bus formats being used in atomisp */
#define V4L2_MBUS_FMT_CUSTOM_YUV420
#define V4L2_MBUS_FMT_CUSTOM_YVU420
#define V4L2_MBUS_FMT_CUSTOM_YUV422P
#define V4L2_MBUS_FMT_CUSTOM_YUV444
#define V4L2_MBUS_FMT_CUSTOM_NV12
#define V4L2_MBUS_FMT_CUSTOM_NV21
#define V4L2_MBUS_FMT_CUSTOM_NV16
#define V4L2_MBUS_FMT_CUSTOM_YUYV
#define V4L2_MBUS_FMT_CUSTOM_SBGGR16
#define V4L2_MBUS_FMT_CUSTOM_RGB32

/* Custom media bus format for M10MO RAW capture */
#if 0
#define V4L2_MBUS_FMT_CUSTOM_M10MO_RAW
#endif

/* Configuration used by Bayer noise reduction and YCC noise reduction */
struct atomisp_nr_config {};

/* Temporal noise reduction configuration */
struct atomisp_tnr_config {};

/* Histogram. This contains num_elements values of type unsigned int.
 * The data pointer is a DDR pointer (virtual address).
 */
struct atomisp_histogram {};

enum atomisp_ob_mode {};

/* Optical black level configuration */
struct atomisp_ob_config {};

/* Edge enhancement (sharpen) configuration */
struct atomisp_ee_config {};

struct atomisp_3a_output {};

enum atomisp_calibration_type {};

struct atomisp_gc_config {};

struct atomisp_3a_config {};

struct atomisp_dvs_grid_info {};

struct atomisp_dvs_envelop {};

struct atomisp_grid_info {};

struct atomisp_dis_vector {};

/* DVS 2.0 Coefficient types. This structure contains 4 pointers to
 *  arrays that contain the coeffients for each type.
 */
struct atomisp_dvs2_coef_types {};

/*
 * DVS 2.0 Statistic types. This structure contains 4 pointers to
 * arrays that contain the statistics for each type.
 */
struct atomisp_dvs2_stat_types {};

struct atomisp_dis_coefficients {};

struct atomisp_dvs2_statistics {};

struct atomisp_dis_statistics {};

struct atomisp_3a_rgby_output {};

/*
 * Because we have 2 pipes at max to output metadata, therefore driver will use
 * ATOMISP_MAIN_METADATA to specify the metadata from the pipe which keeps
 * streaming always and use ATOMISP_SEC_METADATA to specify the metadata from
 * the pipe which is streaming by request like capture pipe of ZSL or SDV mode
 * as secondary metadata. And for the use case which has only one pipe
 * streaming like online capture, ATOMISP_MAIN_METADATA will be used.
 */
enum atomisp_metadata_type {};

struct atomisp_ext_isp_ctrl {};

struct atomisp_3a_statistics {};

/* White Balance (Gain Adjust) */
struct atomisp_wb_config {};

/* Color Space Conversion settings */
struct atomisp_cc_config {};

/* De pixel noise configuration */
struct atomisp_de_config {};

/* Chroma enhancement */
struct atomisp_ce_config {};

/* Defect pixel correction configuration */
struct atomisp_dp_config {};

/* XNR threshold */
struct atomisp_xnr_config {};

/* metadata config */
struct atomisp_metadata_config {};

/*
 * Generic resolution structure.
 */
struct atomisp_resolution {};

/*
 * This specifies the coordinates (x,y)
 */
struct atomisp_zoom_point {};

/*
 * This specifies the region
 */
struct atomisp_zoom_region {};

struct atomisp_dz_config {};

struct atomisp_parm {};

struct dvs2_bq_resolution {};

struct atomisp_dvs2_bq_resolutions {};

struct atomisp_dvs_6axis_config {};

struct atomisp_formats_config {};

struct atomisp_parameters {};

#define ATOMISP_GAMMA_TABLE_SIZE
struct atomisp_gamma_table {};

/* Morphing table for advanced ISP.
 * Each line of width elements takes up COORD_TABLE_EXT_WIDTH elements
 * in memory.
 */
#define ATOMISP_MORPH_TABLE_NUM_PLANES
struct atomisp_morph_table {};

#define ATOMISP_NUM_SC_COLORS
#define ATOMISP_SC_FLAG_QUERY

struct atomisp_shading_table {};

/* parameter for MACC */
#define ATOMISP_NUM_MACC_AXES
struct atomisp_macc_table {};

struct atomisp_macc_config {};

/* Parameter for ctc parameter control */
#define ATOMISP_CTC_TABLE_SIZE
struct atomisp_ctc_table {};

/* Parameter for overlay image loading */
struct atomisp_overlay {};

struct atomisp_exposure {};

/* For texture streaming. */
struct atomisp_bc_video_package {};

enum atomisp_focus_hp {};

/* Masks */
#define ATOMISP_FOCUS_STATUS_MOVING
#define ATOMISP_FOCUS_STATUS_ACCEPTS_NEW_MOVE
#define ATOMISP_FOCUS_STATUS_HOME_POSITION

enum atomisp_camera_port {};

enum atomisp_ext_isp_id {};

#define EXT_ISP_FOCUS_MODE_NORMAL
#define EXT_ISP_FOCUS_MODE_MACRO
#define EXT_ISP_FOCUS_MODE_TOUCH_AF
#define EXT_ISP_FOCUS_MODE_PREVIEW_CAF
#define EXT_ISP_FOCUS_MODE_MOVIE_CAF
#define EXT_ISP_FOCUS_MODE_FACE_CAF
#define EXT_ISP_FOCUS_MODE_TOUCH_MACRO
#define EXT_ISP_FOCUS_MODE_TOUCH_CAF

#define EXT_ISP_FOCUS_STOP
#define EXT_ISP_FOCUS_SEARCH
#define EXT_ISP_PAN_FOCUSING

#define EXT_ISP_CAF_RESTART_CHECK
#define EXT_ISP_CAF_STATUS_FOCUSING
#define EXT_ISP_CAF_STATUS_SUCCESS
#define EXT_ISP_CAF_STATUS_FAIL

#define EXT_ISP_AF_STATUS_INVALID
#define EXT_ISP_AF_STATUS_FOCUSING
#define EXT_ISP_AF_STATUS_SUCCESS
#define EXT_ISP_AF_STATUS_FAIL

enum atomisp_burst_capture_options {};

#define EXT_ISP_SHOT_MODE_AUTO
#define EXT_ISP_SHOT_MODE_BEAUTY_FACE
#define EXT_ISP_SHOT_MODE_BEST_PHOTO
#define EXT_ISP_SHOT_MODE_DRAMA
#define EXT_ISP_SHOT_MODE_BEST_FACE
#define EXT_ISP_SHOT_MODE_ERASER
#define EXT_ISP_SHOT_MODE_PANORAMA
#define EXT_ISP_SHOT_MODE_RICH_TONE_HDR
#define EXT_ISP_SHOT_MODE_NIGHT
#define EXT_ISP_SHOT_MODE_SOUND_SHOT
#define EXT_ISP_SHOT_MODE_ANIMATED_PHOTO
#define EXT_ISP_SHOT_MODE_SPORTS

/*Private IOCTLs for ISP */
#define ATOMISP_IOC_G_XNR
#define ATOMISP_IOC_S_XNR
#define ATOMISP_IOC_G_NR
#define ATOMISP_IOC_S_NR
#define ATOMISP_IOC_G_TNR
#define ATOMISP_IOC_S_TNR
#define ATOMISP_IOC_G_HISTOGRAM
#define ATOMISP_IOC_S_HISTOGRAM
#define ATOMISP_IOC_G_BLACK_LEVEL_COMP
#define ATOMISP_IOC_S_BLACK_LEVEL_COMP
#define ATOMISP_IOC_G_EE
#define ATOMISP_IOC_S_EE
/* Digital Image Stabilization:
 * 1. get dis statistics: reads DIS statistics from ISP (every frame)
 * 2. set dis coefficients: set DIS filter coefficients (one time)
 * 3. set dis motion vecotr: set motion vector (result of DIS, every frame)
 */
#define ATOMISP_IOC_G_DIS_STAT

#define ATOMISP_IOC_G_DVS2_BQ_RESOLUTIONS

#define ATOMISP_IOC_S_DIS_COEFS

#define ATOMISP_IOC_S_DIS_VECTOR

#define ATOMISP_IOC_G_3A_STAT
#define ATOMISP_IOC_G_ISP_PARM
#define ATOMISP_IOC_S_ISP_PARM
#define ATOMISP_IOC_G_ISP_GAMMA
#define ATOMISP_IOC_S_ISP_GAMMA
#define ATOMISP_IOC_G_ISP_GDC_TAB
#define ATOMISP_IOC_S_ISP_GDC_TAB

/* macc parameter control*/
#define ATOMISP_IOC_G_ISP_MACC
#define ATOMISP_IOC_S_ISP_MACC

/* Defect pixel detection & Correction */
#define ATOMISP_IOC_G_ISP_BAD_PIXEL_DETECTION
#define ATOMISP_IOC_S_ISP_BAD_PIXEL_DETECTION

/* False Color Correction */
#define ATOMISP_IOC_G_ISP_FALSE_COLOR_CORRECTION
#define ATOMISP_IOC_S_ISP_FALSE_COLOR_CORRECTION

/* ctc parameter control */
#define ATOMISP_IOC_G_ISP_CTC
#define ATOMISP_IOC_S_ISP_CTC

/* white balance Correction */
#define ATOMISP_IOC_G_ISP_WHITE_BALANCE
#define ATOMISP_IOC_S_ISP_WHITE_BALANCE

/* fpn table loading */
#define ATOMISP_IOC_S_ISP_FPN_TABLE

/* overlay image loading */
#define ATOMISP_IOC_G_ISP_OVERLAY
#define ATOMISP_IOC_S_ISP_OVERLAY

/* bcd driver bridge */
#define ATOMISP_IOC_CAMERA_BRIDGE

#define ATOMISP_IOC_S_EXPOSURE

/* white balance Correction */
#define ATOMISP_IOC_G_3A_CONFIG
#define ATOMISP_IOC_S_3A_CONFIG

/* LCS (shading) table write */
#define ATOMISP_IOC_S_ISP_SHD_TAB

/* Gamma Correction */
#define ATOMISP_IOC_G_ISP_GAMMA_CORRECTION

#define ATOMISP_IOC_S_ISP_GAMMA_CORRECTION

#define ATOMISP_IOC_S_PARAMETERS

#define ATOMISP_IOC_EXP_ID_UNLOCK

#define ATOMISP_IOC_EXP_ID_CAPTURE

#define ATOMISP_IOC_S_ENABLE_DZ_CAPT_PIPE

#define ATOMISP_IOC_G_FORMATS_CONFIG

#define ATOMISP_IOC_S_FORMATS_CONFIG

#define ATOMISP_IOC_INJECT_A_FAKE_EVENT

#define ATOMISP_IOC_S_ARRAY_RESOLUTION

/* for depth mode sensor frame sync compensation */
#define ATOMISP_IOC_G_DEPTH_SYNC_COMP

#define ATOMISP_IOC_S_SENSOR_EE_CONFIG

/*
 * Reserved ioctls. We have customer implementing it internally.
 * We can't use both numbers to not cause ABI conflict.
 * Anyway, those ioctls are hacks and not implemented by us:
 *
 * #define ATOMISP_IOC_G_SENSOR_REG \
 *	_IOW('v', BASE_VIDIOC_PRIVATE + 55, struct atomisp_sensor_regs)
 * #define ATOMISP_IOC_S_SENSOR_REG \
 *	_IOW('v', BASE_VIDIOC_PRIVATE + 56, struct atomisp_sensor_regs)
 */

/*  ISP Private control IDs */
#define V4L2_CID_ATOMISP_BAD_PIXEL_DETECTION
#define V4L2_CID_ATOMISP_POSTPROCESS_GDC_CAC
#define V4L2_CID_ATOMISP_VIDEO_STABLIZATION
#define V4L2_CID_ATOMISP_FIXED_PATTERN_NR
#define V4L2_CID_ATOMISP_FALSE_COLOR_CORRECTION
#define V4L2_CID_ATOMISP_LOW_LIGHT

/* Camera class:
 * Exposure, Flash and privacy (indicator) light controls, to be upstreamed */
#define V4L2_CID_CAMERA_LASTP1

#define V4L2_CID_RUN_MODE
#define ATOMISP_RUN_MODE_VIDEO
#define ATOMISP_RUN_MODE_STILL_CAPTURE
#define ATOMISP_RUN_MODE_PREVIEW
#define ATOMISP_RUN_MODE_MIN
#define ATOMISP_RUN_MODE_MAX

#define V4L2_CID_ENABLE_VFPP
#define V4L2_CID_ATOMISP_CONTINUOUS_MODE
#define V4L2_CID_ATOMISP_CONTINUOUS_RAW_BUFFER_SIZE
#define V4L2_CID_ATOMISP_CONTINUOUS_VIEWFINDER

#define V4L2_CID_VFPP
#define ATOMISP_VFPP_ENABLE
#define ATOMISP_VFPP_DISABLE_SCALER
#define ATOMISP_VFPP_DISABLE_LOWLAT

#define V4L2_CID_START_ZSL_CAPTURE
/* Lock and unlock raw buffer */
#define V4L2_CID_ENABLE_RAW_BUFFER_LOCK

#define V4L2_CID_EXPOSURE_ZONE_NUM
/* Disable digital zoom */
#define V4L2_CID_DISABLE_DZ

#define V4L2_CID_ATOMISP_SELECT_ISP_VERSION

#define V4L2_BUF_FLAG_BUFFER_INVALID
#define V4L2_BUF_FLAG_BUFFER_VALID

#define V4L2_BUF_TYPE_VIDEO_CAPTURE_ION

#define V4L2_EVENT_ATOMISP_3A_STATS_READY
#define V4L2_EVENT_ATOMISP_METADATA_READY
#define V4L2_EVENT_ATOMISP_ACC_COMPLETE
#define V4L2_EVENT_ATOMISP_PAUSE_BUFFER
#define V4L2_EVENT_ATOMISP_CSS_RESET
/* Nonstandard color effects for V4L2_CID_COLORFX */
enum {};

#endif /* _ATOM_ISP_H */