linux/include/uapi/linux/omap3isp.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 * omap3isp.h
 *
 * TI OMAP3 ISP - User-space API
 *
 * Copyright (C) 2010 Nokia Corporation
 * Copyright (C) 2009 Texas Instruments, Inc.
 *
 * Contacts: Laurent Pinchart <[email protected]>
 *	     Sakari Ailus <[email protected]>
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef OMAP3_ISP_USER_H
#define OMAP3_ISP_USER_H

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

/*
 * Private IOCTLs
 *
 * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration
 * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration
 * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration
 * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration
 * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration
 * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data
 * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module
 */

#define VIDIOC_OMAP3ISP_CCDC_CFG
#define VIDIOC_OMAP3ISP_PRV_CFG
#define VIDIOC_OMAP3ISP_AEWB_CFG
#define VIDIOC_OMAP3ISP_HIST_CFG
#define VIDIOC_OMAP3ISP_AF_CFG
#define VIDIOC_OMAP3ISP_STAT_REQ
#define VIDIOC_OMAP3ISP_STAT_REQ_TIME32
#define VIDIOC_OMAP3ISP_STAT_EN

/*
 * Events
 *
 * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready
 * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready
 * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready
 */

#define V4L2_EVENT_OMAP3ISP_CLASS
#define V4L2_EVENT_OMAP3ISP_AEWB
#define V4L2_EVENT_OMAP3ISP_AF
#define V4L2_EVENT_OMAP3ISP_HIST

struct omap3isp_stat_event_status {};

/* AE/AWB related structures and flags*/

/* H3A Range Constants */
#define OMAP3ISP_AEWB_MAX_SATURATION_LIM
#define OMAP3ISP_AEWB_MIN_WIN_H
#define OMAP3ISP_AEWB_MAX_WIN_H
#define OMAP3ISP_AEWB_MIN_WIN_W
#define OMAP3ISP_AEWB_MAX_WIN_W
#define OMAP3ISP_AEWB_MIN_WINVC
#define OMAP3ISP_AEWB_MIN_WINHC
#define OMAP3ISP_AEWB_MAX_WINVC
#define OMAP3ISP_AEWB_MAX_WINHC
#define OMAP3ISP_AEWB_MAX_WINSTART
#define OMAP3ISP_AEWB_MIN_SUB_INC
#define OMAP3ISP_AEWB_MAX_SUB_INC
#define OMAP3ISP_AEWB_MAX_BUF_SIZE

#define OMAP3ISP_AF_IIRSH_MIN
#define OMAP3ISP_AF_IIRSH_MAX
#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN
#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX
#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN
#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX
#define OMAP3ISP_AF_PAXEL_INCREMENT_MIN
#define OMAP3ISP_AF_PAXEL_INCREMENT_MAX
#define OMAP3ISP_AF_PAXEL_HEIGHT_MIN
#define OMAP3ISP_AF_PAXEL_HEIGHT_MAX
#define OMAP3ISP_AF_PAXEL_WIDTH_MIN
#define OMAP3ISP_AF_PAXEL_WIDTH_MAX
#define OMAP3ISP_AF_PAXEL_HZSTART_MIN
#define OMAP3ISP_AF_PAXEL_HZSTART_MAX
#define OMAP3ISP_AF_PAXEL_VTSTART_MIN
#define OMAP3ISP_AF_PAXEL_VTSTART_MAX
#define OMAP3ISP_AF_THRESHOLD_MAX
#define OMAP3ISP_AF_COEF_MAX
#define OMAP3ISP_AF_PAXEL_SIZE
#define OMAP3ISP_AF_MAX_BUF_SIZE

/**
 * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values
 * saturation_limit: Saturation limit.
 * @win_height: Window Height. Range 2 - 256, even values only.
 * @win_width: Window Width. Range 6 - 256, even values only.
 * @ver_win_count: Vertical Window Count. Range 1 - 128.
 * @hor_win_count: Horizontal Window Count. Range 1 - 36.
 * @ver_win_start: Vertical Window Start. Range 0 - 4095.
 * @hor_win_start: Horizontal Window Start. Range 0 - 4095.
 * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095.
 * @blk_win_height: Black Window Height. Range 2 - 256, even values only.
 * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even
 *                     values only.
 * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even
 *                     values only.
 * @alaw_enable: AEW ALAW EN flag.
 */
struct omap3isp_h3a_aewb_config {};

/**
 * struct omap3isp_stat_data - Statistic data sent to or received from user
 * @ts: Timestamp of returned framestats.
 * @buf: Pointer to pass to user.
 * @buf_size: Size of buffer.
 * @frame_number: Frame number of requested stats.
 * @cur_frame: Current frame number being processed.
 * @config_counter: Number of the configuration associated with the data.
 */
struct omap3isp_stat_data {};

#ifdef __KERNEL__
struct omap3isp_stat_data_time32 {};
#endif

/* Histogram related structs */

/* Flags for number of bins */
#define OMAP3ISP_HIST_BINS_32
#define OMAP3ISP_HIST_BINS_64
#define OMAP3ISP_HIST_BINS_128
#define OMAP3ISP_HIST_BINS_256

/* Number of bins * 4 colors * 4-bytes word */
#define OMAP3ISP_HIST_MEM_SIZE_BINS(n)

#define OMAP3ISP_HIST_MEM_SIZE
#define OMAP3ISP_HIST_MIN_REGIONS
#define OMAP3ISP_HIST_MAX_REGIONS
#define OMAP3ISP_HIST_MAX_WB_GAIN
#define OMAP3ISP_HIST_MIN_WB_GAIN
#define OMAP3ISP_HIST_MAX_BIT_WIDTH
#define OMAP3ISP_HIST_MIN_BIT_WIDTH
#define OMAP3ISP_HIST_MAX_WG
#define OMAP3ISP_HIST_MAX_BUF_SIZE

/* Source */
#define OMAP3ISP_HIST_SOURCE_CCDC
#define OMAP3ISP_HIST_SOURCE_MEM

/* CFA pattern */
#define OMAP3ISP_HIST_CFA_BAYER
#define OMAP3ISP_HIST_CFA_FOVEONX3

struct omap3isp_hist_region {};

struct omap3isp_hist_config {};

/* Auto Focus related structs */

#define OMAP3ISP_AF_NUM_COEF

enum omap3isp_h3a_af_fvmode {};

/* Red, Green, and blue pixel location in the AF windows */
enum omap3isp_h3a_af_rgbpos {};

/* Contains the information regarding the Horizontal Median Filter */
struct omap3isp_h3a_af_hmf {};

/* Contains the information regarding the IIR Filters */
struct omap3isp_h3a_af_iir {};

/* Contains the information regarding the Paxels Structure in AF Engine */
struct omap3isp_h3a_af_paxel {};

/* Contains the parameters required for hardware set up of AF Engine */
struct omap3isp_h3a_af_config {};

/* ISP CCDC structs */

/* Abstraction layer CCDC configurations */
#define OMAP3ISP_CCDC_ALAW
#define OMAP3ISP_CCDC_LPF
#define OMAP3ISP_CCDC_BLCLAMP
#define OMAP3ISP_CCDC_BCOMP
#define OMAP3ISP_CCDC_FPC
#define OMAP3ISP_CCDC_CULL
#define OMAP3ISP_CCDC_CONFIG_LSC
#define OMAP3ISP_CCDC_TBL_LSC

#define OMAP3ISP_RGB_MAX

/* Enumeration constants for Alaw input width */
enum omap3isp_alaw_ipwidth {};

/**
 * struct omap3isp_ccdc_lsc_config - LSC configuration
 * @offset: Table Offset of the gain table.
 * @gain_mode_n: Vertical dimension of a paxel in LSC configuration.
 * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration.
 * @gain_format: Gain table format.
 * @fmtsph: Start pixel horizontal from start of the HS sync pulse.
 * @fmtlnh: Number of pixels in horizontal direction to use for the data
 *          reformatter.
 * @fmtslv: Start line from start of VS sync pulse for the data reformatter.
 * @fmtlnv: Number of lines in vertical direction for the data reformatter.
 * @initial_x: X position, in pixels, of the first active pixel in reference
 *             to the first active paxel. Must be an even number.
 * @initial_y: Y position, in pixels, of the first active pixel in reference
 *             to the first active paxel. Must be an even number.
 * @size: Size of LSC gain table. Filled when loaded from userspace.
 */
struct omap3isp_ccdc_lsc_config {};

/**
 * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract
 * @obgain: Optical black average gain.
 * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample.
 * @oblines: Optical Black Sample lines.
 * @oblen: Optical Black Sample Length.
 * @dcsubval: Digital Black Clamp subtract value.
 */
struct omap3isp_ccdc_bclamp {};

/**
 * struct omap3isp_ccdc_fpc - Faulty Pixels Correction
 * @fpnum: Number of faulty pixels to be corrected in the frame.
 * @fpcaddr: Memory address of the FPC Table
 */
struct omap3isp_ccdc_fpc {};

/**
 * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters
 * @b_mg: B/Mg pixels. 2's complement. -128 to +127.
 * @gb_g: Gb/G pixels. 2's complement. -128 to +127.
 * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127.
 * @r_ye: R/Ye pixels. 2's complement. -128 to +127.
 */
struct omap3isp_ccdc_blcomp {};

/**
 * omap3isp_ccdc_culling - Culling parameters
 * @v_pattern: Vertical culling pattern.
 * @h_odd: Horizontal Culling pattern for odd lines.
 * @h_even: Horizontal Culling pattern for even lines.
 */
struct omap3isp_ccdc_culling {};

/**
 * omap3isp_ccdc_update_config - CCDC configuration
 * @update: Specifies which CCDC registers should be updated.
 * @flag: Specifies which CCDC functions should be enabled.
 * @alawip: Enable/Disable A-Law compression.
 * @bclamp: Black clamp control register.
 * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement.
 * @fpc: Number of faulty pixels corrected in the frame, address of FPC table.
 * @cull: Cull control register.
 * @lsc: Pointer to LSC gain table.
 */
struct omap3isp_ccdc_update_config {};

/* Preview configurations */
#define OMAP3ISP_PREV_LUMAENH
#define OMAP3ISP_PREV_INVALAW
#define OMAP3ISP_PREV_HRZ_MED
#define OMAP3ISP_PREV_CFA
#define OMAP3ISP_PREV_CHROMA_SUPP
#define OMAP3ISP_PREV_WB
#define OMAP3ISP_PREV_BLKADJ
#define OMAP3ISP_PREV_RGB2RGB
#define OMAP3ISP_PREV_COLOR_CONV
#define OMAP3ISP_PREV_YC_LIMIT
#define OMAP3ISP_PREV_DEFECT_COR
/* Bit 11 was OMAP3ISP_PREV_GAMMABYPASS, now merged with OMAP3ISP_PREV_GAMMA */
#define OMAP3ISP_PREV_DRK_FRM_CAPTURE
#define OMAP3ISP_PREV_DRK_FRM_SUBTRACT
#define OMAP3ISP_PREV_LENS_SHADING
#define OMAP3ISP_PREV_NF
#define OMAP3ISP_PREV_GAMMA

#define OMAP3ISP_PREV_NF_TBL_SIZE
#define OMAP3ISP_PREV_CFA_TBL_SIZE
#define OMAP3ISP_PREV_CFA_BLK_SIZE
#define OMAP3ISP_PREV_GAMMA_TBL_SIZE
#define OMAP3ISP_PREV_YENH_TBL_SIZE

#define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS

/**
 * struct omap3isp_prev_hmed - Horizontal Median Filter
 * @odddist: Distance between consecutive pixels of same color in the odd line.
 * @evendist: Distance between consecutive pixels of same color in the even
 *            line.
 * @thres: Horizontal median filter threshold.
 */
struct omap3isp_prev_hmed {};

/*
 * Enumeration for CFA Formats supported by preview
 */
enum omap3isp_cfa_fmt {};

/**
 * struct omap3isp_prev_cfa - CFA Interpolation
 * @format: CFA Format Enum value supported by preview.
 * @gradthrs_vert: CFA Gradient Threshold - Vertical.
 * @gradthrs_horz: CFA Gradient Threshold - Horizontal.
 * @table: Pointer to the CFA table.
 */
struct omap3isp_prev_cfa {};

/**
 * struct omap3isp_prev_csup - Chrominance Suppression
 * @gain: Gain.
 * @thres: Threshold.
 * @hypf_en: Flag to enable/disable the High Pass Filter.
 */
struct omap3isp_prev_csup {};

/**
 * struct omap3isp_prev_wbal - White Balance
 * @dgain: Digital gain (U10Q8).
 * @coef3: White balance gain - COEF 3 (U8Q5).
 * @coef2: White balance gain - COEF 2 (U8Q5).
 * @coef1: White balance gain - COEF 1 (U8Q5).
 * @coef0: White balance gain - COEF 0 (U8Q5).
 */
struct omap3isp_prev_wbal {};

/**
 * struct omap3isp_prev_blkadj - Black Level Adjustment
 * @red: Black level offset adjustment for Red in 2's complement format
 * @green: Black level offset adjustment for Green in 2's complement format
 * @blue: Black level offset adjustment for Blue in 2's complement format
 */
struct omap3isp_prev_blkadj {};

/**
 * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending
 * @matrix: Blending values(S12Q8 format)
 *              [RR] [GR] [BR]
 *              [RG] [GG] [BG]
 *              [RB] [GB] [BB]
 * @offset: Blending offset value for R,G,B in 2's complement integer format.
 */
struct omap3isp_prev_rgbtorgb {};

/**
 * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr
 * @matrix: Color space conversion coefficients(S10Q8)
 *              [CSCRY]  [CSCGY]  [CSCBY]
 *              [CSCRCB] [CSCGCB] [CSCBCB]
 *              [CSCRCR] [CSCGCR] [CSCBCR]
 * @offset: CSC offset values for Y offset, CB offset and CR offset respectively
 */
struct omap3isp_prev_csc {};

/**
 * struct omap3isp_prev_yclimit - Y, C Value Limit
 * @minC: Minimum C value
 * @maxC: Maximum C value
 * @minY: Minimum Y value
 * @maxY: Maximum Y value
 */
struct omap3isp_prev_yclimit {};

/**
 * struct omap3isp_prev_dcor - Defect correction
 * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF
 * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct
 */
struct omap3isp_prev_dcor {};

/**
 * struct omap3isp_prev_nf - Noise Filter
 * @spread: Spread value to be used in Noise Filter
 * @table: Pointer to the Noise Filter table
 */
struct omap3isp_prev_nf {};

/**
 * struct omap3isp_prev_gtables - Gamma correction tables
 * @red: Array for red gamma table.
 * @green: Array for green gamma table.
 * @blue: Array for blue gamma table.
 */
struct omap3isp_prev_gtables {};

/**
 * struct omap3isp_prev_luma - Luma enhancement
 * @table: Array for luma enhancement table.
 */
struct omap3isp_prev_luma {};

/**
 * struct omap3isp_prev_update_config - Preview engine configuration (user)
 * @update: Specifies which ISP Preview registers should be updated.
 * @flag: Specifies which ISP Preview functions should be enabled.
 * @shading_shift: 3bit value of shift used in shading compensation.
 * @luma: Pointer to luma enhancement structure.
 * @hmed: Pointer to structure containing the odd and even distance.
 *        between the pixels in the image along with the filter threshold.
 * @cfa: Pointer to structure containing the CFA interpolation table, CFA.
 *       format in the image, vertical and horizontal gradient threshold.
 * @csup: Pointer to Structure for Chrominance Suppression coefficients.
 * @wbal: Pointer to structure for White Balance.
 * @blkadj: Pointer to structure for Black Adjustment.
 * @rgb2rgb: Pointer to structure for RGB to RGB Blending.
 * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr.
 * @yclimit: Pointer to structure for Y, C Value Limit.
 * @dcor: Pointer to structure for defect correction.
 * @nf: Pointer to structure for Noise Filter
 * @gamma: Pointer to gamma structure.
 */
struct omap3isp_prev_update_config {};

#endif	/* OMAP3_ISP_USER_H */