客制化需求中经常有要改成单摄像或者又要改回双摄像的。这篇博客总结一下关于单双摄像头的修改。关于单双摄像头需要修改下面三个地方:
<一>
device\sprd\scx35\sp7731g_1h10\BoardConfig.mk 源码如下
#
# Copyright (C) 2011 The Android Open-Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# secure boot
BOARD_SECURE_BOOT_ENABLE := false
SECURE_BOOT_SIGNAL_KEY := false
include $(PLATCOMM)/BoardConfigCommon.mk
include $(PLATCOMM)/emmc/BoardConfigEmmc.mk
# board configs
TARGET_BOOTLOADER_BOARD_NAME := sp7731gea_hdr
# select camera 2M,3M,5M,8M
CAMERA_SUPPORT_SIZE := 5M
FRONT_CAMERA_SUPPORT_SIZE := 0P3M
TARGET_BOARD_NO_FRONT_SENSOR := false
TARGET_BOARD_CAMERA_FLASH_CTRL := false
CAMERA_PHYSICAL_SIZE := 1_3inch
FRONT_CAMERA_PHYSICAL_SIZE := 1_5inch
# camera sensor type
CAMERA_SENSOR_TYPE_BACK := "ov8825_mipi_raw"
CAMERA_SENSOR_TYPE_FRONT := "GC2155_MIPI_yuv"
AT_CAMERA_SENSOR_TYPE_BACK := "autotest_ov8825_mipi_raw"
AT_CAMERA_SENSOR_TYPE_FRONT := "autotest_GC2155_MIPI_yuv"
#face detect
TARGET_BOARD_CAMERA_FACE_DETECT := true
TARGET_BOARD_CAMERA_FD_LIB := omron
#hdr capture
TARGET_BOARD_CAMERA_HDR_CAPTURE := true
#full screen display
TARGET_BOARD_CAMERA_FULL_SCREEN_DISPLAY := true
#uv denoise
TARGET_BOARD_CAMERA_UV_DENOISE := true
#capture mem
TARGET_BOARD_LOW_CAPTURE_MEM := true
#snesor interface
TARGET_BOARD_BACK_CAMERA_INTERFACE := mipi
TARGET_BOARD_FRONT_CAMERA_INTERFACE := mipi
#select camera zsl cap mode
TARGET_BOARD_CAMERA_CAPTURE_MODE := false
#sprd zsl feature
TARGET_BOARD_CAMERA_SPRD_PRIVATE_ZSL := true
#rotation capture
TARGET_BOARD_CAMERA_ROTATION_CAPTURE := true
ifeq ($(strip $(ZEDIEL_PROJECT_CONFIG)), $(filter $(ZEDIEL_PROJECT_CONFIG), ZEDIEL_SI706AKA ZEDIEL_SI706ASB))
TARGET_BOARD_BACK_CAMERA_ROTATION := true
TARGET_BOARD_FRONT_CAMERA_ROTATION := true
endif
#rm zoom from 1080p recording
TARGET_BOARD_DISABLE_1080P_RECORDING_ZOOM := true
#select continuous auto focus
TARGET_BOARD_CAMERA_CAF := true
#select no camera flash
#TARGET_BOARD_CAMERA_NO_FLASH_DEV := true
#image angle in different project
#TARGET_BOARD_CAMERA_ADAPTER_IMAGE := 180
#pre_allocate capture memory
TARGET_BOARD_CAMERA_PRE_ALLOC_CAPTURE_MEM := false
#sc8830g isp ver 0;sc9630 isp ver 1
TARGET_BOARD_CAMERA_ISP_SOFTWARE_VERSION := 0
#select mipi d-phy mode(none, phya, phyb, phyab)
TARGET_BOARD_FRONT_CAMERA_MIPI := phyb
TARGET_BOARD_BACK_CAMERA_MIPI := phya
#select ccir pclk src(source0, source1)
TARGET_BOARD_FRONT_CAMERA_CCIR_PCLK := source0
TARGET_BOARD_BACK_CAMERA_CCIR_PCLK := source0
# select WCN
BOARD_HAVE_BLUETOOTH := true
ifeq ($(strip $(USE_SPRD_WCN)),true)
BOARD_SPRD_WCNBT_SR2351 := true
BOARD_HAVE_FM_TROUT := true
BOARD_USE_SPRD_FMAPP := true
endif
#2351 GPS
BOARD_USE_SPRD_4IN1_GPS := true
# WIFI configs
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
WPA_SUPPLICANT_VERSION := VER_2_1_DEVEL
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_sprdwl
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_sprdwl
BOARD_WLAN_DEVICE := sc2351
WIFI_DRIVER_FW_PATH_PARAM := "/data/misc/wifi/fwpath"
WIFI_DRIVER_FW_PATH_STA := "sta_mode"
WIFI_DRIVER_FW_PATH_P2P := "p2p_mode"
WIFI_DRIVER_FW_PATH_AP := "ap_mode"
WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/sprdwl.ko"
WIFI_DRIVER_MODULE_NAME := "sprdwl"
# select sensor
#USE_INVENSENSE_LIB := true
USE_SPRD_SENSOR_LIB := true
# BOARD_HAVE_ACC := mxc622x
# BOARD_HAVE_ACC := mc3xxx
# BOARD_HAVE_ACC := stk8baxx
BOARD_HAVE_ACC := compatible
BOARD_ACC_INSTALL := 6
BOARD_HAVE_ORI := NULL
BOARD_ORI_INSTALL := NULL
# BOARD_HAVE_PLS := stk3x1x
BOARD_HAVE_PLS := gsl1680
#BOARD_HAVE_PLS := NULL
# ext4 partition layout
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_CACHEIMAGE_PARTITION_SIZE := 150000000
BOARD_PRODNVIMAGE_PARTITION_SIZE := 5242880
BOARD_SYSINFOIMAGE_PARTITION_SIZE := 5242880
BOARD_PERSISTIMAGE_PARTITION_SIZE := 2097152
BOARD_FLASH_BLOCK_SIZE := 4096
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_PRODNVIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSINFOIMAGE_FILE_SYSTEM_TYPE := ext4
TARGET_SYSTEMIMAGES_SPARSE_EXT_DISABLED := true
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false
TARGET_CACHEIMAGES_SPARSE_EXT_DISABLED := false
TARGET_PRODNVIMAGES_SPARSE_EXT_DISABLED := true
TARGET_SYSINFOIMAGES_SPARSE_EXT_DISABLED := true
PRODUCT_COPY_FILES += $(BOARDDIR)/SC7730_UMS.xml:$(PRODUCT_OUT)/SC7730_UMS.xml
TARGET_GPU_USE_TILE_ALIGN := true
DEVICE_GSP_NOT_SCALING_UP_TWICE := true
#TARGET_USES_LOGD := false
# powerhint HAL config
# sprdemand, interhotplug, interpowerdown
BOARD_POWERHINT_HAL := sprdemand
在这个文件中第一点:
TARGET_BOARD_NO_FRONT_SENSOR := false
如果为false代表机器有双摄像头,如果为true代表只有后置摄像头没有前置摄像头。
#select mipi d-phy mode(none, phya, phyb, phyab)
TARGET_BOARD_FRONT_CAMERA_MIPI := phyb
TARGET_BOARD_BACK_CAMERA_MIPI := phya
这里面对应的是前后摄像头处理的寄存器。双摄像头情况下前摄FRONT对应得是phyb,后摄BACK对应的是phya,如果要改成单摄像头,单后摄的话不用做修改,单前摄的话把前摄的处理屏蔽,后摄改成phyb。这里面要解释下硬件上处理单摄像头都是用后摄摄像头的配置。
<三>
kernel\arch\arm\boot\dts\sprd-scx35_sp7731gea_hdr.dts
文件中 gpio角如下
sprd_sensor {
compatible = "sprd,sprd_sensor";
reg = <0x60c00000 0x1000>;
gpios = <&d_gpio_gpio 186 0 /* 0: main reset*/
&d_gpio_gpio 188 0 /* 1: main powerdown*/前摄
&d_gpio_gpio 186 0 /* 2:sub reset*/
&d_gpio_gpio 187 0 /* 3:sub powerdown*/后摄
&d_gpio_gpio 0 0 /* 4:main core voltage*/
如果是双摄像头的话就是上面这种配置,如果是单摄的话将后摄和前摄的gpio角对换,
sprd_sensor {
compatible = "sprd,sprd_sensor";
reg = <0x60c00000 0x1000>;
gpios = <&d_gpio_gpio 186 0 /* 0: main reset*/
&d_gpio_gpio 187 0 /* 1: main powerdown*/前摄
&d_gpio_gpio 186 0 /* 2:sub reset*/
&d_gpio_gpio 188 0 /* 3:sub powerdown*/后摄
&d_gpio_gpio 0 0 /* 4:main core voltage*/
以上是单双摄像头需要修改的地方。另外需要在
vendor\sprd\modules\libcamera\oem\src\sensor_cfg.c
const SENSOR_MATCH_T main_sensor_infor_tab[]=
{
#ifdef CONFIG_BACK_CAMERA_MIPI
#if defined(CONFIG_CAMERA_ISP_VERSION_V3) || defined(CONFIG_CAMERA_ISP_VERSION_V4)
//
{"s5k3l2xx_mipi", &g_s5k3l2xx_mipi_raw_info},
{"s5k4h5yc_mipi", &g_s5k4h5yc_mipi_raw_info},
{"s5k4h5yc_mipi", &g_s5k4h5yc_jsl_mipi_raw_info},
{"ov8825_mipi_raw", &g_ov8825_mipi_raw_info},
{"hi544_mipi_raw", &g_hi544_mipi_raw_info},
{"ov5640_mipi_yuv", &g_ov5640_mipi_yuv_info},
{"ov5640_mipi_raw", &g_ov5640_mipi_raw_info},
{"ov5670_mipi_raw", &g_ov5670_mipi_raw_info},
{"ov13850_mipi_raw", &g_ov13850_mipi_raw_info},
{"ov8858_mipi_raw", &g_ov8858_mipi_raw_info},
#else
#if 1
// {"sp2508_mipi",&g_sp2508_mipi_raw_info},
// {"gc2755_mipi",&g_gc2755_mipi_raw_info},
// {"sp2529_mipi",&g_SP2529_MIPI_yuv_info},
// {"gc5004_mipi",&g_gc5004_mipi_raw_info},
// {"gc2145_mipi",&g_GC2145_MIPI_yuv_info},
{"gc2145_back_mipi",&g_GC2145_BACK_MIPI_yuv_info},
{"gc2355_mipi",&g_gc2355_mipi_raw_info},
{"sp2509_back_mipi",&g_sp2509_back_mipi_raw_info},
{"gc2365_back_mipi", &g_gc2365_back_mipi_raw_info},
{"gc0310_mipi",&g_GC0310_BACK_MIPI_yuv_info},
{"gc030a_back_mipi", &g_gc030a_back_mipi_raw_info},
{"sp0a09_back_mipi",&g_sp0a09_back_mipi_raw_info},
{"gc5024_mipi",&g_gc5024_mipi_raw_info},
{"gc5005_mipi",&g_gc5005_mipi_raw_info},
{"ov5675_mipi_raw",&g_ov5675_mipi_raw_info},
//{"gc5024_mipi",&g_gc5024_mipi_raw_info},
// {"sp5408_mipi",&g_sp5408_raw_info},
// {"sp5409_mipi",&g_sp5409_mipi_raw_info},
// {"ov5645_mipi",&g_ov5645_mipi_yuv_info},
// {"bf3a20_mipi",&g_BF3A20_mipi_yuv_info},
#else
{"ov8825_mipi_raw", &g_ov8825_mipi_raw_info},
{"hi544_mipi_raw", &g_hi544_mipi_raw_info},
{"ov5640_mipi_yuv", &g_ov5640_mipi_yuv_info},
{"ov5648_mipi_raw", &g_ov5648_mipi_raw_info},
{"ov2680_mipi_raw", &g_ov2680_mipi_raw_info},
{"sr352_mipi_yuv", &g_sr352_mipi_yuv_info},
{"imx219_mipi_raw", &g_imx219_mipi_raw_info},
{"s5k4ec_mipi_yuv", &g_s5k4ec_mipi_yuv_info},
//{"ov8830_mipi_raw", &g_ov8830_mipi_raw_info},
{"imx179_mipi_raw", &g_imx179_mipi_raw_info},
{"ov8865_mipi_raw", &g_ov8865_mipi_raw_info},
{"ov13850_mipi_raw", &g_ov13850_mipi_raw_info},
//{"s5k5ccgx_yuv_info", &g_s5k5ccgx_yuv_info_mipi},
//{"s5k4e1ga_mipi_raw", &g_s5k4e1ga_mipi_raw_info},
//{"hi351_mipi_yuv", &g_hi351_mipi_yuv_info},
//{"ov5640_mipi_raw", &g_ov5640_mipi_raw_info},
//{"ov5647_mipi_raw_info", &g_ov5647_mipi_raw_info},
{"ov5670_mipi_raw", &g_ov5670_mipi_raw_info},
//{"SP2529_MIPI_yuv", &g_SP2529_MIPI_yuv_info},
#endif
#endif
#endif
#ifdef CONFIG_BACK_CAMERA_CCIR
{"ov5640_yuv", &g_ov5640_yuv_info},
{"hi253_yuv", &g_hi253_yuv_info},
{"ov5640_yuv", &g_ov5640_yuv_info},
{"hi253_yuv_info", &g_hi253_yuv_info},
{"GT2005_yuv", &g_GT2005_yuv_info},
{"s5k4ec_yuv", &g_s5k4ec_yuv_info},
{"sr352_yuv", &g_sr352_yuv_info},
//{"ov7675_yuv", &g_OV7675_yuv_info},
//{"ov2655_yuv", &g_OV2655_yuv_info},
//{"ov7675_yuv", &g_OV7675_yuv_info},
//{"ov2640_yuv", &g_OV2640_yuv_info},
{"HM2058_yuv", &g_HM2058_yuv_info},
#endif
{"", NULL},
};
const SENSOR_MATCH_T sub_sensor_infor_tab[]=
{
#ifdef CONFIG_FRONT_CAMERA_CCIR
{"GC2155_yuv", &g_GC2155_yuv_info},
{"hi253_yuv", &g_hi253_yuv_info},
{"GC0308_yuv", &g_GC0308_yuv_info},
{"GC2035_yuv", &g_GC2035_yuv_info},
{"HI702_yuv", &g_HI702_yuv_info},
{"ov7675_yuv", &g_OV7675_yuv_info},
//{"GC0309_yuv", &g_GC0309_yuv_info},
//{"OV7690_yuv", g_OV7690_yuv_info},
#endif
#ifdef CONFIG_FRONT_CAMERA_MIPI
#if (defined(CONFIG_CAMERA_ISP_VERSION_V3) || defined(CONFIG_CAMERA_ISP_VERSION_V4))
{"s5k5e3yx_mipi", &g_s5k5e3yx_mipi_raw_info},
{"ov5648_mipi_raw", &g_ov5648_mipi_raw_info},
{"ov2680_mipi_raw", &g_ov2680_mipi_raw_info},
#endif
{"sp2509_mipi",&g_sp2509_mipi_raw_info},
{"sp0a08_mipi",&g_sp0a08_mipi_raw_info},
{"sp0a09_mipi",&g_sp0a09_mipi_raw_info},
//{"hi255_yuv", &g_hi255_yuv_info},
// {"GC2155_MIPI_yuv", &g_GC2155_MIPI_yuv_info},
{"GC0310_MIPI_yuv", &g_GC0310_MIPI_yuv_info},
{"gc030a_mipi", &g_gc030a_mipi_raw_info},
{"gc2145_mipi",&g_GC2145_MIPI_yuv_info},
{"gc2365_mipi", &g_gc2365_mipi_raw_info},
#if !(defined(CONFIG_CAMERA_ISP_VERSION_V3) || defined(CONFIG_CAMERA_ISP_VERSION_V4))
{"GC0310_MIPI_yuv", &g_GC0310_MIPI_yuv_info},
{"sr030pc50_yuv", &g_sr030pc50_yuv_info},
#endif
#endif
{"", NULL},
在这里面注意要有你对应的前后摄像头的驱动文件的引用,如果上面几点都OK了就能正确的修改陈单双摄像头。