/* * header for cameras. * * Copyright (c) 2017 by Allwinnertech Co., Ltd. http://www.allwinnertech.com * * Authors: Zhao Wei * Yang Feng * * 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. */ #ifndef __CAMERA__H__ #define __CAMERA__H__ #include #include "../../vin.h" #include "../../utility/vin_common.h" #include "../../vin_cci/cci_helper.h" #include "../../platform/platform_cfg.h" /* * Basic window sizes. These probably belong somewhere more globally * useful. */ #define ABS_SENSOR(x) ((x) > 0 ? (x) : -(x)) #define HXGA_WIDTH 4000 #define HXGA_HEIGHT 3000 #define QUXGA_WIDTH 3264 #define QUXGA_HEIGHT 2448 #define QSXGA_WIDTH 2592 #define QSXGA_HEIGHT 1936 #define QXGA_WIDTH 2048 #define QXGA_HEIGHT 1536 #define HD1080_WIDTH 1920 #define HD1080_HEIGHT 1080 #define UXGA_WIDTH 1600 #define UXGA_HEIGHT 1200 #define SXGA_WIDTH 1280 #define SXGA_HEIGHT 960 #define HD720_WIDTH 1280 #define HD720_HEIGHT 720 #define XGA_WIDTH 1024 #define XGA_HEIGHT 768 #define SVGA_WIDTH 800 #define SVGA_HEIGHT 600 #define VGA_WIDTH 640 #define VGA_HEIGHT 480 #define QVGA_WIDTH 320 #define QVGA_HEIGHT 240 #define CIF_WIDTH 352 #define CIF_HEIGHT 288 #define QCIF_WIDTH 176 #define QCIF_HEIGHT 144 #define CSI_GPIO_HIGH 1 #define CSI_GPIO_LOW 0 #define CCI_BITS_8 8 #define CCI_BITS_16 16 #define SENSOR_MAGIC_NUMBER 0x156977 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) struct isp_get_cfg_t { unsigned int sensor_wdr_on; unsigned int sensor_get_fps; unsigned char sensor_deinit; unsigned char get_yuv_en; }; /* * ISP_GET_CFG_NUM: * there is only two part sector, part0 and part1 * part0 is VIN_SENSOR0_RESERVE_ADDR/ISP1_NORFLASH_SAVE * part1 is VIN_SENSOR1_RESERVE_ADDR/ISP1_NORFLASH_SAVE * two_linear mode: part0 corresponding isp0, part1 corresponding isp1 * one_linear and one_wdr mode: part0 corresponding isp0, part1 corresponding isp2 * two_wdr mode: part0 corresponding isp0, part1 corresponding isp2 */ #ifdef CONFIG_SUPPORT_THREE_CAMERA #define ISP_GET_CFG_NUM 3 #else #define ISP_GET_CFG_NUM 2 #endif extern struct isp_get_cfg_t isp_get_cfg[ISP_GET_CFG_NUM]; enum power_seq_cmd { PWR_OFF = 0, PWR_ON = 1, }; enum ir_status_cmd { IR_DAY, IR_NIGHT, }; struct sensor_format_struct { u32 mbus_code; unsigned int width; unsigned int height; unsigned int offs_h; unsigned int offs_v; unsigned int mipi_bps; unsigned int hoffset; unsigned int voffset; unsigned int hts; unsigned int vts; unsigned int pclk; unsigned int fps_fixed; unsigned int bin_factor; unsigned int intg_min; unsigned int intg_max; unsigned int intg_mid_min; unsigned int intg_mid_max; unsigned int intg_short_min; unsigned int intg_short_max; unsigned int gain_min; unsigned int gain_max; unsigned int wdr_mode; enum v4l2_field field; void *regs; /* Regs to tweak */ int regs_size; void *switch_regs; /* Regs to tweak */ int switch_regs_size; }; #define DEV_DBG_EN 0 #if (DEV_DBG_EN == 1) #define sensor_dbg(x, arg...) printk(KERN_DEBUG"[%s_debug]"x, SENSOR_NAME, ##arg) #else #define sensor_dbg(x, arg...) #endif #define sensor_err(x, arg...) printk(KERN_ERR"[%s_err]"x, SENSOR_NAME, ##arg) #define sensor_print(x, arg...) printk(KERN_DEBUG"[%s]"x, SENSOR_NAME, ##arg) struct sensor_exp_gain; struct sensor_fuc_core { int (*g_mbus_config)(int id, struct v4l2_mbus_config *cfg, struct mbus_framefmt_res *res); int (*sensor_test_i2c)(int id); int (*sensor_power)(int id, int on); int (*s_ir_status)(int id, int status); int (*s_stream)(int id, int isp_id, int enable); int (*s_switch)(int id); int (*s_exp_gain)(int id, struct sensor_exp_gain *exp_gain); struct sensor_format_struct *(*sensor_g_format)(int id, int isp_id); struct sensor_format_struct *(*sensor_g_switch_format)(int id, int isp_id); }; extern struct sensor_fuc_core gc4663_core; extern struct sensor_fuc_core gc2053_core; extern struct sensor_fuc_core gc2083_core; extern struct sensor_fuc_core sc2355_core; extern struct sensor_fuc_core sc2356_core; extern struct sensor_fuc_core sc2336_core; extern struct sensor_fuc_core sc3336_core; extern struct sensor_fuc_core sc500ai_core; extern struct sensor_fuc_core sc5336_core; extern struct sensor_fuc_core gc0406_core; extern struct sensor_fuc_core gc1054_core; extern struct sensor_fuc_core gc1084_core; extern struct sensor_fuc_core tp9950_mipi_core; extern struct sensor_fuc_core tp9953_dvp_core; extern struct sensor_fuc_core imx319_core; extern struct sensor_fuc_core imx335_core; extern struct sensor_fuc_core sc035hgs_core; extern struct sensor_fuc_core tp2815_core; extern struct sensor_fuc_core bf2253l_core; extern struct sensor_fuc_core n5_core; extern struct sensor_fuc_core f37p_dvp_core; extern struct sensor_fuc_core f37p_core; extern struct sensor_fuc_core f355p_dvp_core; extern struct sensor_fuc_core f355p_core; extern struct sensor_fuc_core bf2257cs_core; extern struct sensor_fuc_core ov02b10_core; extern struct sensor_fuc_core sc202cs_core; #endif /*__CAMERA__H__*/