1 /* 2 * linux-5.4/drivers/media/platform/sunxi-vin/platform/platform_cfg.h 3 * 4 * Copyright (c) 2007-2017 Allwinnertech Co., Ltd. 5 * 6 * Authors: Zhao Wei <zhaowei@allwinnertech.com> 7 * 8 * This software is licensed under the terms of the GNU General Public 9 * License version 2, as published by the Free Software Foundation, and 10 * may be copied, distributed, and modified under those terms. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 */ 18 19 #ifndef __PLATFORM_CFG__H__ 20 #define __PLATFORM_CFG__H__ 21 22 /*#define FPGA_VER*/ 23 #define SUNXI_MEM 24 #define disp_sync_video 1 25 26 #if defined (CONFIG_ARCH_SUN8IW15P1) || defined (CONFIG_ARCH_SUN8IW17P1) || defined (CONFIG_ARCH_SUN50IW3P1) || defined (CONFIG_ARCH_SUN50IW6P1) 27 #define NO_SUPPROT_CCU_PLATDORM 28 #define NO_SUPPROT_ISP_BRIDGE_PLATDORM 29 #define NO_SUPPROT_HARDWARE_CALCULATE 30 #else 31 32 #if defined CONFIG_ARCH_SUN8IW16P1 || defined CONFIG_ARCH_SUN8IW19P1 33 #define ISP0_BRIDGE_VALID 34 #endif 35 36 #if defined(CONFIG_BUF_AUTO_UPDATE) 37 #define BUF_AUTO_UPDATE 38 #endif 39 40 #endif 41 42 #if defined (CONFIG_ARCH_SUN50IW10) 43 #if defined (CONFIG_SUPPORT_ISP_TDM) 44 #define SUPPORT_ISP_TDM 45 #endif 46 #endif 47 48 #if defined CONFIG_SENSOR_POWER || defined CONFIG_SENSOR_POWER_MODULE 49 #define SENSOR_POER_BEFORE_VIN 50 #endif 51 52 #ifndef FPGA_VER 53 #include <linux/clk.h> 54 //#include <sunxi-clk.h> 55 #include <linux/clk-provider.h> 56 #include <linux/pinctrl/consumer.h> 57 #include <linux/pinctrl/pinconf.h> 58 #include <linux/regulator/consumer.h> 59 #endif 60 61 #include <linux/gpio.h> 62 #include <sunxi-gpio.h> 63 #include <linux/of.h> 64 #include <linux/of_gpio.h> 65 #include <linux/of_irq.h> 66 #include <linux/of_address.h> 67 68 #include <linux/slab.h> 69 #include <linux/kernel.h> 70 71 #include "../utility/vin_os.h" 72 #include "../vin-mipi/combo_common.h" 73 74 #ifdef FPGA_VER 75 #define DPHY_CLK (48*1000*1000) 76 #else 77 #define DPHY_CLK (150*1000*1000) 78 #endif 79 80 enum isp_platform { 81 ISP500 = 0, 82 ISP520, 83 ISP521, 84 ISP_VERSION_NUM, 85 }; 86 87 #if defined CONFIG_ARCH_SUN50IW3P1 88 #include "sun50iw3p1_vin_cfg.h" 89 #define CROP_AFTER_SCALER 90 #elif defined CONFIG_ARCH_SUN50IW6P1 91 #include "sun50iw6p1_vin_cfg.h" 92 #define CROP_AFTER_SCALER 93 #elif defined CONFIG_ARCH_SUN50IW9P1 94 #include "sun50iw9p1_vin_cfg.h" 95 #elif defined CONFIG_ARCH_SUN50IW10 96 #include "sun50iw10p1_vin_cfg.h" 97 #elif defined CONFIG_ARCH_SUN8IW12P1 98 #include "sun8iw12p1_vin_cfg.h" 99 #elif defined CONFIG_ARCH_SUN8IW15P1 100 #include "sun8iw15p1_vin_cfg.h" 101 #elif defined CONFIG_ARCH_SUN8IW16P1 102 #include "sun8iw16p1_vin_cfg.h" 103 #elif defined CONFIG_ARCH_SUN8IW17P1 104 #include "sun8iw12p1_vin_cfg.h" 105 #elif defined CONFIG_ARCH_SUN8IW19P1 106 #include "sun8iw19p1_vin_cfg.h" 107 #elif defined CONFIG_ARCH_SUN8IW20 108 #include "sun8iw20_vin_cfg.h" 109 #elif defined CONFIG_ARCH_SUN20IW1 110 #include "sun8iw20_vin_cfg.h" 111 #endif 112 113 #define MOV_ROUND_UP(x, n) (((x) + (1 << (n)) - 1) >> (n)) 114 115 struct mbus_framefmt_res { 116 u32 res_pix_fmt; 117 u32 res_mipi_bps; 118 u8 res_combo_mode; 119 u8 res_wdr_mode; 120 u8 res_time_hs; 121 u8 res_lp_mode; 122 u8 fps; 123 }; 124 125 enum steam_on_seq { 126 SENSOR_BEFORE_MIPI = 0, 127 MIPI_BEFORE_SENSOR, 128 }; 129 130 #define CSI_CH_0 (1 << 20) 131 #define CSI_CH_1 (1 << 21) 132 #define CSI_CH_2 (1 << 22) 133 #define CSI_CH_3 (1 << 23) 134 135 #define MAX_DETECT_NUM 3 136 137 /* 138 * The subdevices' group IDs. 139 */ 140 #define VIN_GRP_ID_SENSOR (1 << 8) 141 #define VIN_GRP_ID_MIPI (1 << 9) 142 #define VIN_GRP_ID_CSI (1 << 10) 143 #define VIN_GRP_ID_ISP (1 << 11) 144 #define VIN_GRP_ID_SCALER (1 << 12) 145 #define VIN_GRP_ID_CAPTURE (1 << 13) 146 #define VIN_GRP_ID_STAT (1 << 14) 147 #define VIN_GRP_ID_TDM_RX (1 << 15) 148 149 #define VIN_ALIGN_WIDTH 16 150 #define VIN_ALIGN_HEIGHT 16 151 152 #endif /*__PLATFORM_CFG__H__*/ 153