RK3399 Camera

Android R(11)

Posted by LXG on February 23, 2023

Camera 使用-firefly

豪威集团-上海韦尔半导体股份有限公司

RK3399适配OV8858摄像头

Ov8858

OV: OmniVision 豪威集团

全球CMOS图像传感器厂商:

  1. 索尼 IMX
  2. 三星
  3. 豪威科技 OmniVision
  4. SK海力士
  5. 格科微 : 多名硅谷归国技术人员于2003年12月创立的外商独资企业
  6. 思比科 : 归国留学人员创办的专门从事CMOS图像传感器芯片设计、生产及销售的国家级高新技术企业
  7. 思特威
  8. 比亚迪微电子

驱动-android 7

配置

rk3399-android.dtsi


	isp0: isp@ff910000 {
		compatible = "rockchip,rk3399-isp", "rockchip,isp";
		reg = <0x0 0xff910000 0x0 0x4000>;
		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>;
		assigned-clocks = <&cru SCLK_CIF_OUT_SRC>;
		assigned-clock-parents = <&cru PLL_GPLL>;
		assigned-clock-rates = <800000000>;
		clocks =
			<&cru SCLK_CIF_OUT>, <&cru SCLK_CIF_OUT_SRC>,
			<&cru SCLK_DPHY_TX1RX1_CFG>, <&cru SCLK_MIPIDPHY_REF>,
			<&cru ACLK_ISP0_NOC>, <&cru ACLK_ISP0_WRAPPER>,
			<&cru HCLK_ISP0_NOC>, <&cru HCLK_ISP0_WRAPPER>,
			<&cru SCLK_ISP0>, <&cru SCLK_DPHY_RX0_CFG>;
		clock-names =
			"clk_cif_out", "clk_cif_pll",
			"pclk_dphytxrx", "pclk_dphy_ref",
			"aclk_isp0_noc", "aclk_isp0_wrapper",
			"hclk_isp0_noc", "hclk_isp0_wrapper",
			"clk_isp0", "pclk_dphyrx";
		resets = <&cru SRST_H_ISP0>, <&cru SRST_ISP0>;
		reset-names = "h_isp0", "isp0";
		pinctrl-names =
			"cif_clkout", "isp_dvp8bit0", "isp_mipi_fl",
			"isp_mipi_fl_prefl", "isp_flash_as_gpio",
			"isp_flash_as_trigger_out";
		pinctrl-0 = <&cif_clkout>;
		pinctrl-1 = <&cif_clkout &isp_dvp_d0d7>;
		pinctrl-2 = <&cif_clkout>;
		pinctrl-3 = <&cif_clkout &isp_prelight>;
		pinctrl-4 = <&isp_flash_trigger_as_gpio>;
		pinctrl-5 = <&isp_flash_trigger>;
		rockchip,isp,mipiphy = <2>;
		rockchip,isp,cifphy = <1>;
		rockchip,isp,dsiphy,reg = <0xff968000 0x8000>;
		rockchip,grf = <&grf>;
		rockchip,cru = <&cru>;
		rockchip,gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
		rockchip,isp,iommu-enable = <1>;
		power-domains = <&power RK3399_PD_ISP0>;
		iommus = <&isp0_mmu>;
		status = "disabled";
	};

	isp1: isp@ff920000 {
		compatible = "rockchip,rk3399-isp", "rockchip,isp";
		reg = <0x0 0xff920000 0x0 0x4000>;
		interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH 0>;
		clocks =
			<&cru ACLK_ISP1_NOC>, <&cru ACLK_ISP1_WRAPPER>,
			<&cru HCLK_ISP1_NOC>, <&cru HCLK_ISP1_WRAPPER>,
			<&cru SCLK_ISP1>, <&cru SCLK_CIF_OUT>,
			<&cru SCLK_CIF_OUT_SRC>, <&cru SCLK_DPHY_TX1RX1_CFG>,
			<&cru SCLK_MIPIDPHY_REF>, <&cru PCLK_ISP1_WRAPPER>,
			<&cru SCLK_DPHY_RX0_CFG>, <&cru PCLK_MIPI_DSI1>,
			<&cru SCLK_MIPIDPHY_CFG>;
		clock-names =
			"aclk_isp1_noc", "aclk_isp1_wrapper",
			"hclk_isp1_noc", "hclk_isp1_wrapper",
			"clk_isp1", "clk_cif_out",
			"clk_cif_pll", "pclk_dphytxrx",
			"pclk_dphy_ref", "pclk_isp1",
			"pclk_dphyrx", "pclk_mipi_dsi",
			"mipi_dphy_cfg";
		resets = <&cru SRST_H_ISP1>, <&cru SRST_ISP1>;
		reset-names = "h_isp1", "isp1";
		pinctrl-names =
			"cif_clkout", "isp_dvp8bit0", "isp_mipi_fl",
			"isp_mipi_fl_prefl", "isp_flash_as_gpio",
			"isp_flash_as_trigger_out";
		pinctrl-0 = <&cif_clkout>;
		pinctrl-1 = <&isp_dvp_d0d7>;
		pinctrl-2 = <&cif_clkout>;
		pinctrl-3 = <&isp_prelight>;
		pinctrl-4 = <&isp_flash_trigger_as_gpio>;
		pinctrl-5 = <&isp_flash_trigger>;
		rockchip,isp,mipiphy = <2>;
		rockchip,isp,cifphy = <1>;
		rockchip,isp,dsiphy,reg = <0xff968000 0x8000>;
		rockchip,grf = <&grf>;
		rockchip,cru = <&cru>;
		rockchip,gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
		rockchip,isp,iommu-enable = <1>;
		power-domains = <&power RK3399_PD_ISP1>;
		iommus = <&isp1_mmu>;
		status = "disabled";
	};

&isp0 {
        status = "okay";
};
&isp1 {
        status = "okay";
};

代码

kernel/drivers/media/video/rk_camsys


├── camsys_cif.c
├── camsys_cif.h
├── camsys_drv.c
├── camsys_gpio.h
├── camsys_internal.h
├── camsys_marvin.c
├── camsys_marvin.h
├── camsys_mipicsi_phy.c
├── camsys_mipicsi_phy.h
├── camsys_soc_priv.c
├── camsys_soc_priv.h
├── camsys_soc_rk3288.c
├── camsys_soc_rk3288.h
├── camsys_soc_rk3326.c
├── camsys_soc_rk3326.h
├── camsys_soc_rk3366.c
├── camsys_soc_rk3366.h
├── camsys_soc_rk3368.c
├── camsys_soc_rk3368.h
├── camsys_soc_rk3399.c
├── camsys_soc_rk3399.h
├── ext_flashled_drv
│   ├── flashlight.c
│   ├── flashlight.h
│   ├── Kconfig
│   ├── leds-rt8547.c
│   ├── leds-rt8547.h
│   ├── Makefile
│   ├── rk_ext_fshled_ctl.c
│   ├── rk_ext_fshled_ctl.h
│   ├── rtfled.c
│   └── rtfled.h
├── Kconfig
└── Makefile

HAL-android 7

hardware/rockchip/camera


├── Android.mk
├── CameraHal                  // 摄像头的 HAL 源码
│   ├── Android.mk
│   ├── AppMsgNotifier.cpp
│   ├── CameraAdapter.cpp
│   ├── CameraBuffer.cpp
│   ├── CameraDeinterlace.cpp
│   ├── CameraGLAdapter.cpp
│   ├── CameraGLAdapter.h
│   ├── CameraGL.h
│   ├── CameraHal_board_xml_parse.cpp
│   ├── CameraHal_board_xml_parse.h
│   ├── CameraHal.cpp
│   ├── CameraHal.h
│   ├── CameraHal_MediaProfile.cpp
│   ├── CameraHal_Mem.cpp
│   ├── CameraHal_Mem.h
│   ├── CameraHal_Module.cpp
│   ├── CameraHal_Module.h
│   ├── CameraHal_Tracer.c
│   ├── CameraHal_Tracer.h
│   ├── CameraHalUtil.cpp
│   ├── CameraIspAdapter.cpp
│   ├── CameraIspAdapter.h
│   ├── CameraIspSOCAdapter.cpp
│   ├── CameraIspTunning.cpp
│   ├── CameraIspTunning.h
│   ├── camera_mem.cpp
│   ├── camera_mem_gralloc.cpp
│   ├── camera_mem.h
│   ├── CameraSocAdapter.cpp
│   ├── CameraUSBAdapter.cpp
│   ├── common_type.h
│   ├── DisplayAdapter.cpp
│   ├── FaceDetector.h
│   ├── FakeCameraAdapter.cpp
│   ├── FakeCameraAdapter.h
│   ├── Jpeg_soft_encode.cpp
│   ├── lib
│   ├── MessageQueue.cpp
│   ├── MessageQueue.h
│   ├── MutliFrameDenoise.h
│   ├── Semaphore.cpp
│   ├── Semaphore.h
│   ├── SensorListener.cpp
│   └── SensorListener.h
├── Config
│   ├── Android.mk
│   ├── cam_board_rk3288.xml
│   ├── cam_board_rk3326.xml
│   ├── cam_board_rk3366.xml
│   ├── cam_board_rk3368.xml
│   ├── cam_board_rk3399.xml                  // 摄像头的参数设置
│   ├── lib_rkisp12_api_7x_32bit.so
│   ├── lib_rkisp12_api_7x_64bit.so
│   ├── lib_rkisp1_api_6x_32bit.so
│   ├── lib_rkisp1_api_6x_64bit.so
│   ├── lib_rkisp1_api_7x_32bit.so
│   ├── lib_rkisp1_api_7x_64bit.so
│   ├── rk32xx_camera.mk
│   └── user.mk
└── SiliconImage                           // ISP 库,包括所有支持模组的驱动源码
    ├── Android.mk
    ├── include
    └── isi

SiliconImage ISP 库-包括所有支持模组的驱动源码


├── Android.mk
├── include
│   ├── adpcc
│   │   └── adpcc.h
│   ├── adpf
│   │   └── adpf.h
│   ├── aec
│   │   └── aec.h
│   ├── af
│   │   └── af.h
│   ├── avs
│   │   └── avs.h
│   ├── awb
│   │   ├── awb_common.h
│   │   ├── awb.h
│   │   ├── awb_v10.h
│   │   └── awb_v11.h
│   ├── awdr
│   │   └── awdr.h
│   ├── bufferpool
│   │   ├── media_buffer.h
│   │   ├── media_buffer_pool.h
│   │   ├── media_buffer_queue_ex.h
│   │   └── media_buffer_queue.h
│   ├── bufsync_ctrl
│   │   ├── bufsync_ctrl_api.h
│   │   └── bufsync_ctrl_common.h
│   ├── cam_calibdb
│   │   ├── cam_calibdb_api.h
│   │   └── cam_calibdb_common.h
│   ├── cam_engine
│   │   ├── cam_engine_aaa_api.h
│   │   ├── cam_engine_api.h
│   │   ├── cam_engine_common.h
│   │   ├── cam_engine_cproc_api.h
│   │   ├── cam_engine_drv_api.h
│   │   ├── cam_engine_imgeffects_api.h
│   │   ├── cam_engine_isp_api.h
│   │   ├── cam_engine_jpe_api.h
│   │   ├── cam_engine_mi_api.h
│   │   └── cam_engine_simp_api.h
│   ├── cameric_drv
│   │   ├── cameric_cproc_drv_api.h
│   │   ├── cameric_drv_api.h
│   │   ├── cameric_drv_common.h
│   │   ├── cameric_dual_cropping_drv_api.h
│   │   ├── cameric_ie_drv_api.h
│   │   ├── cameric_isp_afm_drv_api.h
│   │   ├── cameric_isp_awb_drv_api.h
│   │   ├── cameric_isp_bls_drv_api.h
│   │   ├── cameric_isp_cac_drv_api.h
│   │   ├── cameric_isp_cnr_drv_api.h
│   │   ├── cameric_isp_degamma_drv_api.h
│   │   ├── cameric_isp_dpcc_drv_api.h
│   │   ├── cameric_isp_dpf_drv_api.h
│   │   ├── cameric_isp_drv_api.h
│   │   ├── cameric_isp_elawb_drv_api.h
│   │   ├── cameric_isp_exp_drv_api.h
│   │   ├── cameric_isp_flash_drv_api.h
│   │   ├── cameric_isp_flt_drv_api.h
│   │   ├── cameric_isp_hist_drv_api.h
│   │   ├── cameric_isp_is_drv_api.h
│   │   ├── cameric_isp_lsc_drv_api.h
│   │   ├── cameric_isp_vsm_drv_api.h
│   │   ├── cameric_isp_wdr_drv_api.h
│   │   ├── cameric_jpe_drv_api.h
│   │   ├── cameric_mi_drv_api.h
│   │   ├── cameric_mipi_drv_api.h
│   │   ├── cameric_simp_drv_api.h
│   │   └── mainpage.h
│   ├── cameric_reg_drv
│   │   └── cameric_reg_description.h
│   ├── camsys_head.h
│   ├── common
│   │   ├── align.h
│   │   ├── array_size.h
│   │   ├── cam_cb.h
│   │   ├── cam_info.h
│   │   ├── cam_types.h
│   │   ├── cea_861.h
│   │   ├── hdmi_3d.h
│   │   ├── list.h
│   │   ├── mipi.h
│   │   ├── misc.h
│   │   ├── picture_buffer.h
│   │   ├── return_codes.h
│   │   └── utl_fixfloat.h
│   ├── common_head.h
│   ├── dom_ctrl
│   │   ├── dom_ctrl_api.h
│   │   └── dom_ctrl_common.h
│   ├── ebase
│   │   ├── builtins.h
│   │   ├── dct_assert.h
│   │   ├── ext_types.h
│   │   ├── hashtable.h
│   │   ├── linux_compat.h
│   │   ├── list.h
│   │   ├── mainpage.h
│   │   ├── queue.h
│   │   ├── return_types.h
│   │   ├── slist.h
│   │   ├── sort.frag.h
│   │   ├── trace.h
│   │   └── types.h
│   ├── exa_ctrl
│   │   ├── exa_ctrl_api.h
│   │   └── exa_ctrl_common.h
│   ├── hal
│   │   ├── hal_altera_pci.h
│   │   ├── hal_api.h
│   │   ├── hal_cosim.h
│   │   └── hal_mockup.h
│   ├── i2c_drv
│   │   └── i2c_drv.h
│   ├── ibd
│   │   ├── ibd_api.h
│   │   └── ibd_common.h
│   ├── isi
│   │   ├── isi_common.h
│   │   ├── isi.h
│   │   └── isi_iss.h
│   ├── isp_cam_api
│   │   ├── calib_xml
│   │   └── cam_api
│   ├── mim_ctrl
│   │   ├── mim_ctrl_api.h
│   │   └── mim_ctrl_common.h
│   ├── mipi_drv
│   │   ├── mipi_drv_api.h
│   │   └── mipi_drv_common.h
│   ├── mom_ctrl
│   │   ├── mom_ctrl_api.h
│   │   └── mom_ctrl_common.h
│   ├── oslayer
│   │   ├── oslayer.h
│   │   ├── oslayer_linux.h
│   │   ├── oslayer_linux.h.bak
│   │   ├── oslayer_mfs.h
│   │   ├── oslayer_systemc.h
│   │   ├── oslayer_ucosii.h
│   │   └── oslayer_win32.h
│   ├── som_ctrl
│   │   ├── som_ctrl_api.h
│   │   └── som_ctrl_common.h
│   ├── version
│   │   ├── version.h
│   │   └── version_number.h
│   └── vom_ctrl
│       ├── vom_ctrl_api.h
│       └── vom_ctrl_common.h
└── isi
    ├── Android.mk
    ├── drv
    │   ├── Android.mk
    │   ├── AR0330
    │   ├── GC0308
    │   ├── GC2035
    │   ├── GC2145
    │   ├── GC2155_CIF
    │   ├── GC2355
    │   ├── GC2385
    │   ├── GC5005
    │   ├── GC5025
    │   ├── GC8034
    │   ├── GS8604
    │   ├── Hi551
    │   ├── HM2057
    │   ├── HM5040
    │   ├── HM8040
    │   ├── IMX179
    │   ├── IMX214
    │   ├── IMX214_B
    │   ├── IMX258
    │   ├── IMX274
    │   ├── IMX278
    │   ├── IMX290
    │   ├── IMX291
    │   ├── IMX317
    │   ├── JX507
    │   ├── NT99252
    │   ├── OV13850
    │   ├── OV13860
    │   ├── OV14825
    │   ├── OV2659
    │   ├── OV2680
    │   ├── OV2685_MIPI_YUV
    │   ├── OV2686
    │   ├── OV2710
    │   ├── OV2715
    │   ├── OV2718
    │   ├── OV2735
    │   ├── OV4188
    │   ├── OV4689
    │   ├── OV5630
    │   ├── OV5640
    │   ├── OV5645_MIPI_YUV
    │   ├── OV5647
    │   ├── OV5648
    │   ├── OV5693
    │   ├── OV5695
    │   ├── OV7251
    │   ├── OV8810
    │   ├── OV8820
    │   ├── OV8825
    │   ├── OV8856
    │   ├── OV8858
    │   │   ├── Android.mk
    │   │   ├── calib
    │   │   │   ├── OV8858_000V47-F415B-BW5B0.xml
    │   │   │   ├── OV8858_CMK-CB0407-FV3.xml
    │   │   │   ├── OV8858_CMK-CB0692-FV1.xml
    │   │   │   ├── OV8858_COB910-B800BA-E_V1.0.xml
    │   │   │   ├── OV8858_COB910-B800BA-E_V3.0.xml
    │   │   │   ├── OV8858_COB910-B800BA-E.xml
    │   │   │   ├── OV8858_lens_LG-40108A7_OTP.xml
    │   │   │   ├── OV8858_lens_LG-9569A2_OTP.xml
    │   │   │   ├── OV8858_lens_LG-9569A2.xml
    │   │   │   ├── OV8858_lens_R5AV08.xml
    │   │   │   ├── OV8858_lens_SUNNY-3813A_OTP.xml
    │   │   │   ├── OV8858_lens_SUNNY-3813A.xml
    │   │   │   ├── OV8858_LG-40108A7.xml
    │   │   │   ├── OV8858_LG-9569A2.xml
    │   │   │   ├── OV8858_OIN8A32.xml
    │   │   │   ├── OV8858_R1A_lens_LG-9569A2_OTP.xml
    │   │   │   ├── OV8858_R1A_lens_LG-9569A2.xml
    │   │   │   ├── OV8858_R1A_lens_SUNNY-3813A_OTP.xml
    │   │   │   ├── OV8858_R1A_lens_SUNNY-3813A.xml
    │   │   │   ├── OV8858_R2A_lens_LG-40108A7_OTP.xml
    │   │   │   ├── OV8858_R2A_lens_LG-9569A2_OTP.xml
    │   │   │   ├── OV8858_R5AV08.xml
    │   │   │   ├── OV8858_SUNNY-3813A.xml
    │   │   │   └── OV8858.xml
    │   │   ├── include_priv
    │   │   │   └── OV8858_MIPI_priv.h
    │   │   └── source
    │   │       ├── OV8858_MIPI.c
    │   │       └── OV8858_tables.c

    │   ├── OV8865
    │   ├── OV9282
    │   ├── S5K4H8
    │   ├── SC031GS_PARREL_RAW
    │   ├── SP2509V
    │   ├── SP2518
    │   ├── SP2519
    │   ├── SP5506
    │   ├── TC358743XBG_MIPI_YUV
    │   └── TC358749XBG_MIPI_YUV
    ├── include
    │   ├── isi_common.h
    │   ├── isi.h
    │   └── isi_iss.h
    ├── include_priv
    │   └── isi_priv.h
    └── source
        ├── Android.mk
        ├── Android.mk.bak
        ├── isi.c
        └── isisup.c

配置过程-android 7

原理图

ov8858_camera

从原理图获取需要配置的引脚:GPIO2_B4/DVP_PDN0_H, GPIO2_B3/CIF_CLKO, MIPI_RST0/GPIO0_B0

cam_board.xml


<?xml version="1.0" ?>
<BoardFile>
		<BoardXmlVersion version="v0.0xf.0">
		</BoardXmlVersion>
		<CamDevie>
			<HardWareInfo>
				<Sensor>
					<SensorName name="OV8858" ></SensorName>                             <!--Sensor 名称-->
					<SensorLens name="LG-9569A2"></SensorLens>
					<SensorDevID IDname="CAMSYS_DEVID_SENSOR_1A"></SensorDevID>          <!--Sensor 软件标识-->
					<SensorHostDevID busnum="CAMSYS_DEVID_MARVIN" ></SensorHostDevID>  <!--采集控制器名称-->
					<SensorI2cBusNum busnum="1"></SensorI2cBusNum>    <!--Sensor 所连接的主控 I2C 通道号, 具体通道号请参考摄像头原理图连接主控的 I2C 通道号-->
					<SensorI2cAddrByte byte="2"></SensorI2cAddrByte>  <!--Sensor 寄存器地址长度-->
					<SensorI2cRate rate="100000"></SensorI2cRate>     <!--Sensor 的 I2C 频率,单位:Hz,用于设置 I2C 的频率-->
					<SensorAvdd name="NC" min="28000000" max="28000000" delay="0"></SensorAvdd>  <!--Sensor AVDD 的 PMU LDO 名称。如果不是连接到 PMU,那么只需填写 NC-->
					<SensorDvdd name="NC" min="12000000" max="12000000" delay="0"></SensorDvdd>  <!--Sensor DOVDD 的 PMU LDO 名称。如果不是连接到 PMU,那么只需填写 NC。注意 min 以及 max 值必须填写,这决定了 Sensor 的 IO 电压。-->
					<SensorDovdd name="NC" min="18000000" max="18000000" delay="5000"></SensorDovdd> <!--ensor DVDD 的 PMU LDO 名称。-->
					<SensorMclk mclk="24000000" delay="1000"></SensorMclk>  <!--Sensor 输入时钟频率, 单位:Hz,用于设置摄像头的时钟。-->
					<SensorGpioPwen ioname="NC" active="1" delay="1000"></SensorGpioPwen>   <!--Sensor Power 引脚。 直接填写名称即可, active 填写电源有效电平。-->
					<SensorGpioRst ioname="RK30_PIN0_PB0" active="0" delay="1000"></SensorGpioRst>  <!--Sensor Reset 引脚。直接填写名称即可,active 填写复位的有效电平。-->
					<SensorGpioPwdn ioname="RK30_PIN2_PB4" active="0" delay="0"></SensorGpioPwdn>  <!--Sensor PowerDown 引脚。直接填写名称即可,active 填写休眠的有效电平。-->
					<SensorFacing facing="back"></SensorFacing>            <!--选择 Sensor 作为前置还是后置-->
					<SensorInterface interface="MIPI"></SensorInterface>   <!--Sensor 的接口方式-->
					<SensorMirrorFlip mirror="0"></SensorMirrorFlip>        <!--Sensor 的镜像方式-->
					<SensorOrientation orientation="180"></SensorOrientation>   <!--Sensor 的角度信息-->
					<SensorPowerupSequence seq="1234"></SensorPowerupSequence>
					<SensorFovParemeter h="60.0" v="60.0"></SensorFovParemeter>
					<SensorAWB_Frame_Skip fps="15"></SensorAWB_Frame_Skip>
					<SensorPhy phyMode="CamSys_Phy_Mipi" lane="2"  phyIndex="0" sensorFmt="CamSys_Fmt_Raw_10b"></SensorPhy>  <!--物理接口设置-->
					<!--phyMode:Sensor 接口硬件连接方式,对 MIPI Sensor 来说,该值取 CamSys_Phy_Mipi
                                            lane:Sensor mipi 接口数据通道数
                                            phyIndex:Sensor MIPI 连接的主控 MIPI phy 编号
                                            sensorFmt:Sensor 输出数据格式,目前仅支持 CamSys_Fmt_Raw_10b
                                        -->
				</Sensor>
				<VCM>
					<VCMDrvName name="DW9714"></VCMDrvName>
					<VCMName name="HuaYong6505"></VCMName>
					<VCMI2cBusNum busnum="1"></VCMI2cBusNum>
					<VCMI2cAddrByte byte="0"></VCMI2cAddrByte>
					<VCMI2cRate rate="0"></VCMI2cRate>
					<VCMVdd name="NC" min="0" max="0" delay="0"></VCMVdd>
					<VCMGpioPower ioname="NC" active="0" delay="1000"></VCMGpioPower>
					<VCMGpioPwdn ioname="NC" active="0" delay="0"></VCMGpioPwdn>
					<VCMCurrent start="20" rated="80" vcmmax="100" stepmode="13"  drivermax="100"></VCMCurrent>
				</VCM>
				<Flash>
					<FlashName name="Internal"></FlashName>
					<FlashI2cBusNum busnum="0"></FlashI2cBusNum>
					<FlashI2cAddrByte byte="0"></FlashI2cAddrByte>
					<FlashI2cRate rate="0"></FlashI2cRate>
					<FlashTrigger ioname="NC" active="0"></FlashTrigger>
					<FlashEn ioname="NC" active="0"></FlashEn>
					<FlashModeType mode="1"></FlashModeType>
					<FlashLuminance luminance="0"></FlashLuminance>
					<FlashColorTemp colortemp="0"></FlashColorTemp>
				</Flash>
			</HardWareInfo>
			<SoftWareInfo>
				<AWB>
					<AWB_Auto support="1"></AWB_Auto>
					<AWB_Incandescent support="1"></AWB_Incandescent>
					<AWB_Fluorescent support="1"></AWB_Fluorescent>
					<AWB_Warm_Fluorescent support="1"></AWB_Warm_Fluorescent>
					<AWB_Daylight support="1"></AWB_Daylight>
					<AWB_Cloudy_Daylight support="1"></AWB_Cloudy_Daylight>
					<AWB_Twilight support="1"></AWB_Twilight>
					<AWB_Shade support="1"></AWB_Shade>
				</AWB>
				<Sence>
					<Sence_Mode_Auto support="1"></Sence_Mode_Auto>
					<Sence_Mode_Action support="1"></Sence_Mode_Action>
					<Sence_Mode_Portrait support="1"></Sence_Mode_Portrait>
					<Sence_Mode_Landscape support="1"></Sence_Mode_Landscape>
					<Sence_Mode_Night support="1"></Sence_Mode_Night>
					<Sence_Mode_Night_Portrait support="1"></Sence_Mode_Night_Portrait>
					<Sence_Mode_Theatre support="1"></Sence_Mode_Theatre>
					<Sence_Mode_Beach support="1"></Sence_Mode_Beach>
					<Sence_Mode_Snow support="1"></Sence_Mode_Snow>
					<Sence_Mode_Sunset support="1"></Sence_Mode_Sunset>
					<Sence_Mode_Steayphoto support="1"></Sence_Mode_Steayphoto>
					<Sence_Mode_Pireworks support="1"></Sence_Mode_Pireworks>
					<Sence_Mode_Sports support="1"></Sence_Mode_Sports>
					<Sence_Mode_Party support="1"></Sence_Mode_Party>
					<Sence_Mode_Candlelight support="1"></Sence_Mode_Candlelight>
					<Sence_Mode_Barcode support="1"></Sence_Mode_Barcode>
					<Sence_Mode_HDR support="1"></Sence_Mode_HDR>
				</Sence>
				<Effect>
					<Effect_None support="1"></Effect_None>
					<Effect_Mono support="1"></Effect_Mono>
					<Effect_Solarize support="1"></Effect_Solarize>
					<Effect_Negative support="1"></Effect_Negative>
					<Effect_Sepia support="1"></Effect_Sepia>
					<Effect_Posterize support="1"></Effect_Posterize>
					<Effect_Whiteboard support="1"></Effect_Whiteboard>
					<Effect_Blackboard support="1"></Effect_Blackboard>
					<Effect_Aqua support="1"></Effect_Aqua>
				</Effect>
				<FocusMode>
					<Focus_Mode_Auto support="1"></Focus_Mode_Auto>
					<Focus_Mode_Infinity support="1"></Focus_Mode_Infinity>
					<Focus_Mode_Marco support="1"></Focus_Mode_Marco>
					<Focus_Mode_Fixed support="1"></Focus_Mode_Fixed>
					<Focus_Mode_Edof support="1"></Focus_Mode_Edof>
					<Focus_Mode_Continuous_Video support="0"></Focus_Mode_Continuous_Video>
					<Focus_Mode_Continuous_Picture support="1"></Focus_Mode_Continuous_Picture>
				</FocusMode>
				<FlashMode>
					<Flash_Mode_Off support="1"></Flash_Mode_Off>
					<Flash_Mode_On support="1"></Flash_Mode_On>
					<Flash_Mode_Torch support="1"></Flash_Mode_Torch>
					<Flash_Mode_Auto support="1"></Flash_Mode_Auto>
					<Flash_Mode_Red_Eye support="1"></Flash_Mode_Red_Eye>
				</FlashMode>
				<AntiBanding>
					<Anti_Banding_Auto support="1"></Anti_Banding_Auto>
					<Anti_Banding_50HZ support="1"></Anti_Banding_50HZ>
					<Anti_Banding_60HZ support="1"></Anti_Banding_60HZ>
					<Anti_Banding_Off support="1"></Anti_Banding_Off>
				</AntiBanding>
				<HDR support="1"></HDR>
				<ZSL support="1"></ZSL>
				<DigitalZoom support="1"></DigitalZoom>
				<Continue_SnapShot support="1"></Continue_SnapShot>
				<InterpolationRes resolution="0"></InterpolationRes>
				<PreviewSize width="1920" height="1080"></PreviewSize>
				<FaceDetect support="0" MaxNum="1"></FaceDetect>
				<DV>
					<DV_QCIF name="qcif" width="176" height="144" fps="10" support="1"></DV_QCIF>
					<DV_QVGA name="qvga" width="320" height="240" fps="10" support="1"></DV_QVGA>
					<DV_CIF name="cif" width="352" height="288" fps="10" support="1"></DV_CIF>
					<DV_VGA name="480p" width="640" height="480" fps="10" support="0"></DV_VGA>
					<DV_480P name="480p" width="720" height="480" fps="10" support="0"></DV_480P>
					<DV_720P name="720p" width="1280" height="720" fps="10" support="1"></DV_720P>
					<DV_1080P name="1080p" width="1920" height="1080" fps="10" support="1"></DV_1080P>
				</DV>
			</SoftWareInfo>
		</CamDevie>
</BoardFile>


I2C 波形样张

mipi_camera_i2c

时钟波形信号

mipi_camera_clock

IMX258 驱动调试

I2C 使用-firefly


[   15.002593] E:camsys_i2c_write(92): i2c write dev(addr:0x20) failed!,err = -6
[   15.004566] E:camsys_i2c_read(152): i2c read dev(addr:0xa0) failed,tryagain-1!
[   15.004794] E:camsys_i2c_read(152): i2c read dev(addr:0xa0) failed,tryagain-0!
[   15.005182] E:camsys_i2c_read(152): i2c read dev(addr:0xa0) failed,tryagain-1!
[   15.005364] E:camsys_i2c_read(152): i2c read dev(addr:0xa0) failed,tryagain-0!
[   15.005609] E:camsys_i2c_read(152): i2c read dev(addr:0xa0) failed,tryagain-1!
[   15.005797] E:camsys_i2c_read(152): i2c read dev(addr:0xa0) failed,tryagain-0!
[   15.006062] E:camsys_i2c_read(152): i2c read dev(addr:0xa0) failed,tryagain-1!
[   15.006244] E:camsys_i2c_read(152): i2c read dev(addr:0xa0) failed,tryagain-0!


如果调用 I2C 传输接口返回值为 -6(-ENXIO)时候,表示为 NACK 错误,即对方设备无应答响应,这种情况一 般为外设的问题,常见的有以下几种情况:

  1. I2C 地址错误;
  2. I2C slave 设备处于不正常工作状态,比如没有上电,错误的上电时序以及设备异常等;
  3. I2C 时序不符合slave设备所要求也会产生 NACK 信号,比如 slave 设备需要的是 stop 信号,而不是repeat start 信号的时候;
  4. I2C 总线受外部干扰导致的,用示波器测量可以看到是一个ACK波形

相机调试-Andorid 11

参考文档


├── common
│   └── Camera_External_FAQ_v1.0 .pdf
├── HAL1
│   ├── README_CN.txt
│   ├── README_EN.txt
│   ├── RK312x_Camera_User_Manual_v1.4(3288&3368).pdf
│   ├── RK_ISP10_Camera_User_Manual_v2.3.pdf
│   ├── RKISPV1_Camera_Module_AVL_v1.7.pdf
│   ├── Rockchip_Camera_AVL_v2.0_Package_20180515.7z
│   ├── Rockchip_Introduction_RKISPV1_Camera_Driver_Debugging_Method_CN.pdf
│   ├── Rockchip_Introduction_RKISPV1_Camera_FAQ_CN.pdf
│   ├── Rockchip SOFIA 3G-R_PMB8018(x3_C3230RK)_Camera_Module_AVL_v1.6_20160226.pdf
│   └── Rockchip_Trouble_Shooting_Android_CameraHAL1_CN_EN.pdf
├── HAL3
│   ├── camera_engine_rkisp_user_manual_v2.2.pdf
│   ├── camera_hal3_user_manual_v2.3.pdf
│   ├── README_CN.txt
│   ├── RKCIF_Driver_User_Manual_v1.0.pdf
│   ├── RKISP1_IQ_Parameters_User_Guide_v1.2.pdf
│   ├── RKISP_Driver_User_Manual_v1.3.pdf
│   ├── Rockchip_Color_Optimization_Guide_ISP
│   ├── Rockchip_Development_Guide_3A_ISP
│   ├── Rockchip_Development_Guide_ISP
│   ├── Rockchip_Driver_Guide_VI
│   ├── Rockchip_IQ_Tools_Guide_ISP
│   ├── Rockchip_Trouble_Shooting_Camera_FAQ_CN_EN_CameraHAL3.pdf
│   ├── Rockchip_Tuning_Guide_ISP
│   └── USB_UVC_Integrated_Cameras.pdf
└── README.txt

驱动源码-android 11

kernel/arch/arm64/configs/rockchip_defconfig


CONFIG_VIDEO_OV8858=y

CONFIG_VIDEO_IMX258=y

kernel/drivers/media/i2c/ov8858.c

kernel/drivers/media/i2c/imx258.c

DTS 相机配置

arch/arm64/boot/dts/rockchip/rk3399-evb-ind-lpddr4-v13-android-avb.dts



&i2c1 {
	status = "okay";

	ov8858: ov8858@36 {
		status = "okay";
		compatible = "ovti,ov8858";
		reg = <0x36>;
		clocks = <&cru SCLK_CIF_OUT>;
		clock-names = "xvclk";
		/* avdd-supply = <>; */
		/* dvdd-supply = <>; */
		/* dovdd-supply = <>; */
		/* reset-gpios = <>; */
		reset-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>;
		pwdn-gpios = <&gpio2 RK_PB4 GPIO_ACTIVE_LOW>;
		pinctrl-names = "rockchip,camera_default";
		pinctrl-0 = <&cif_clkout>;
		rockchip,camera-module-index = <0>;
		rockchip,camera-module-facing = "back";
		rockchip,camera-module-mclk-name = "clk_cif_out";
		rockchip,camera-module-name = "CameraKing";            //ov8858_CameraKing_Largan-9569A2.xml
		rockchip,camera-module-lens-name = "Largan-9569A2";
		port {
			ucam_out0: endpoint {
				remote-endpoint = <&mipi_in_ucam0>;
				data-lanes = <1 2 3 4>;
			};
		};
	};

};


&i2c2 {
	status = "okay";

	imx258: imx258@1a {
	        status = "okay";
                compatible = "sony,imx258";
                reg = <0x1a>;
                clocks = <&cru SCLK_CIF_OUT>;
                clock-names = "xvclk";
		/* avdd-supply = <>; */
		/* dvdd-supply = <>; */
		/* dovdd-supply = <>; */
                reset-gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
                pwdn-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_LOW>;
                pinctrl-names = "rockchip,camera_default";
                pinctrl-0 = <&cif_clkout>;
                rockchip,camera-module-index = <1>;
                rockchip,camera-module-facing = "front";
                rockchip,camera-module-name = "GEIR180089";      //imx258_GEIR180089_LG500627G.xml
                rockchip,camera-module-lens-name = "LG500627G";
                port {
                        ucam_out1: endpoint {
                                remote-endpoint = <&mipi_in_ucam1>;
                                data-lanes = <1 2>;
                        };
                };
        };

};

&mipi_dphy_rx0 {
	status = "okay";

	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@0 {
			reg = <0>;
			#address-cells = <1>;
			#size-cells = <0>;

			mipi_in_ucam0: endpoint@1 {
				reg = <1>;
				remote-endpoint = <&ucam_out0>;
				data-lanes = <1 2 3 4>;
			};
		};

		port@1 {
			reg = <1>;
			#address-cells = <1>;
			#size-cells = <0>;

			dphy_rx0_out: endpoint@0 {
				reg = <0>;
				remote-endpoint = <&isp0_mipi_in>;
			};
		};
	};
};


&mipi_dphy_tx1rx1 {
	status = "okay";

	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@0 {
			reg = <0>;
			#address-cells = <1>;
			#size-cells = <0>;

			mipi_in_ucam1: endpoint@1 {
				reg = <1>;
				remote-endpoint = <&ucam_out1>;
				data-lanes = <1 2>;
			};
		};

		port@1 {
			reg = <1>;
			#address-cells = <1>;
			#size-cells = <0>;

			dphy_tx1rx1_out: endpoint@0 {
				reg = <0>;
				remote-endpoint = <&isp1_mipi_in>;
			};
		};
	};
};

&rkisp1_0 {
	status = "okay";

	port {
		#address-cells = <1>;
		#size-cells = <0>;

		isp0_mipi_in: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&dphy_rx0_out>;
		};
	};
};

&rkisp1_1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&cif_clkout>;
	port {
		#address-cells = <1>;
		#size-cells = <0>;

		isp1_mipi_in: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&dphy_tx1rx1_out>;
		};
	};
};

&isp0_mmu {
        status = "okay";
};

&isp1_mmu {
        status = "okay";
};

相机参数配置

hardware/rockchip/camera/etc/camera/camera3_profiles_rk3399.xml


<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd

     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.
-->
<CameraSettings>
	<Profiles cameraId="0" name="ov8858" moduleId="m00">
        <Supported_hardware>
            <hwType value="SUPPORTED_HW_RKISP1"/>
        </Supported_hardware>

        <Android_metadata> <!-- Android static metadata only -->
            <!-- Color Correction -->
            <colorCorrection.availableAberrationModes value="OFF"/>
            <!-- Control -->
            <control.availableModes value="AUTO"/>
            <control.aeAvailableAntibandingModes value="OFF,50HZ,60Hz,AUTO"/>
            <control.aeAvailableModes value="ON,OFF"/>
            <control.aeLockAvailable value="FALSE"/>
            <!-- <control.aeAvailableTargetFpsRanges value="15,30,30,30,60,60"/> -->
            <control.aeAvailableTargetFpsRanges value="15,15,15,30,30,30"/>
            <control.aeCompensationRange value="-6,6"/>
            <control.aeCompensationStep value="1,3"/>
            <control.afAvailableModes value="OFF,AUTO,MACRO,CONTINUOUS_VIDEO,CONTINUOUS_PICTURE,EDOF"/>
            <control.availableEffects value="OFF"/>
            <!-- <control.awbAvailableModes value="AUTO"/> -->
            <control.awbAvailableModes value="AUTO,INCANDESCENT,FLUORESCENT,DAYLIGHT,CLOUDY_DAYLIGHT"/>
            <control.awbLockAvailable value="true"/>
            <control.availableSceneModes value="DISABLED"/>
            <control.availableVideoStabilizationModes value="OFF"/>
            <control.maxRegions value="1,0,1"/>
            <!-- JPEG -->
            <jpeg.maxSize value="11985408"/>  <!-- 3264*2448*1.5 -->
            <jpeg.availableThumbnailSizes value="0,0,160,120,320,180,320,240"/> <!-- INCREASING ORDER -->
            <!-- Lens Info-->
            <!-- TODO: availableApertures now is fake for we do not get the real apertures -->
            <lens.info.availableApertures value="2.0"/> <!-- HAL may override this value from CMC for RAW sensors -->
            <lens.info.availableFocalLengths value="2.04"/> <!-- HAL may override this value from CMC for RAW sensors -->
            <lens.info.availableOpticalStabilization value="OFF"/> <!-- OPTIONS: OFF, ON -->
            <lens.info.hyperfocalDistance value="0.0"/> <!-- HAL may override this value from CMC for RAW sensors -->
            <lens.info.minimumFocusDistance value="0.1"/> <!-- HAL may override this value from CMC for RAW sensors -->
            <!-- Lens -->
            <lens.facing value="BACK"/>
            <!-- Request -->
            <request.maxNumOutputStreams value="1,2,1"/>
            <request.pipelineMaxDepth value="4"/>
            <request.maxNumInputStreams value="0"/>
            <request.partialResultCount value="1"/>
            <!-- <request.availableCapabilities value="BACKWARD_COMPATIBLE,YUV_REPROCESSING,PRIVATE_REPROCESSING"/> -->
            <request.availableCapabilities value="BACKWARD_COMPATIBLE"/>
            <request.availableRequestKeys value="blackLevel.lock,
                colorCorrection.aberrationMode,
                colorCorrection.gains,
                colorCorrection.transform,
                control.aeAntibandingMode,
                control.aeExposureCompensation,
                control.aeLock,
                control.aeMode,
                control.aeTargetFpsRange,
                control.aePrecaptureTrigger,
                control.afMode,
                control.aeRegions,
                control.afRegions,
                control.afTrigger,
                control.awbLock,
                control.awbMode,
                control.captureIntent,
                control.effectMode,
                control.mode,
                control.sceneMode,
                control.videoStabilizationMode,
                edge.mode,
                flash.mode,
                jpeg.gpsLocation,
                jpeg.orientation,
                jpeg.quality,
                jpeg.thumbnailQuality,
                jpeg.thumbnailSize,
                lens.aperture,
                lens.focalLength,
                lens.opticalStabilizationMode,
                noiseReduction.mode,
                scaler.cropRegion,
                statistics.faceDetectMode,
                statistics.hotPixelMapMode,
                statistics.sceneFlicker,
                statistics.lensShadingMapMode
                "/>

            <request.availableResultKeys value="colorCorrection.mode,
                colorCorrection.transform,
                colorCorrection.gains,
                colorCorrection.aberrationCorrectionMode,
                control.aeAntibandingMode,
                control.aeExposureCompensation,
                control.aeLock,
                control.aeMode,
                control.aeTargetFpsRange,
                control.aePrecaptureTrigger,
                control.afMode,
                control.aeRegions,
                control.afRegions,
                control.afTrigger,
                control.awbLock,
                control.awbMode,
                control.captureIntent,
                control.effectMode,
                control.mode,
                control.sceneMode,
                control.videoStabilizationMode,
                control.aeState,
                control.afState,
                control.awbState,
                sync.frameNumber,
                edge.mode,
                flash.mode,
                jpeg.gpsLocation,
                jpeg.orientation,
                jpeg.quality,
                jpeg.thumbnailQuality,
                jpeg.thumbnailSize,
                lens.focalLength,
                lens.aperture,
                lens.opticalStabilizationMode,
                request.pipelineDepth,
                scaler.cropRegion,
                sensor.testPatternData,
                sensor.testPatternMode,
                sensor.timestamp,
                sensor.rollingShutterSkew,
                statistics.faceDetectMode,
                statistics.hotPixelMapMode,
                statistics.faces,
                noiseReduction.mode,
                statistics.sceneFlicker,
                statistics.lensShadingMapMode
                "/>
            <request.availableCharacteristicsKeys value="0"/>
            <!-- Scaler -->
            <scaler.availableMaxDigitalZoom value="4.0"/>
            <scaler.availableInputOutputFormatsMap value="IMPLEMENTATION_DEFINED,2,YCbCr_420_888,BLOB,YCbCr_420_888,2,YCbCr_420_888,BLOB"/>
            <scaler.availableStreamConfigurations value="BLOB,3264x2448,OUTPUT,
                BLOB,2592x1944,OUTPUT,
                BLOB,1920x1080,OUTPUT,
                BLOB,1280x960,OUTPUT,
                BLOB,1280x720,OUTPUT,
                BLOB,640x480,OUTPUT,
                BLOB,320x240,OUTPUT,
                BLOB,176x144,OUTPUT,
                YCbCr_420_888,3264x2448,OUTPUT,
                YCbCr_420_888,2592x1944,OUTPUT,
                YCbCr_420_888,1920x1080,OUTPUT,
                YCbCr_420_888,1280x960,OUTPUT,
                YCbCr_420_888,1280x720,OUTPUT,
                YCbCr_420_888,640x480,OUTPUT,
                YCbCr_420_888,320x240,OUTPUT,
                YCbCr_420_888,176x144,OUTPUT,
                IMPLEMENTATION_DEFINED,3264x2448,OUTPUT,
                IMPLEMENTATION_DEFINED,2592x1944,OUTPUT,
                IMPLEMENTATION_DEFINED,1920x1080,OUTPUT,
                IMPLEMENTATION_DEFINED,1280x960,OUTPUT,
                IMPLEMENTATION_DEFINED,1280x720,OUTPUT,
                IMPLEMENTATION_DEFINED,640x480,OUTPUT,
                IMPLEMENTATION_DEFINED,320x240,OUTPUT,
                IMPLEMENTATION_DEFINED,176x144,OUTPUT"/>
            <scaler.availableMinFrameDurations value="BLOB,3264x2448,33333333,
                BLOB,2592x1944,33333333,
                BLOB,1920x1080,33333333,
                BLOB,1280x960,33333333,
                BLOB,1280x720,33333333,
                BLOB,640x480,33333333,
                BLOB,320x240,33333333,
                BLOB,176x144,33333333,
                YCbCr_420_888,3264x2448,33333333,
                YCbCr_420_888,2592x1944,33333333,
                YCbCr_420_888,1920x1080,33333333,
                YCbCr_420_888,1280x960,33333333,
                YCbCr_420_888,1280x720,33333333,
                YCbCr_420_888,640x480,33333333,
                YCbCr_420_888,320x240,33333333,
                YCbCr_420_888,176x144,33333333,
                IMPLEMENTATION_DEFINED,3264x2448,33333333,
                IMPLEMENTATION_DEFINED,2592x1944,33333333,
                IMPLEMENTATION_DEFINED,1920x1080,33333333,
                IMPLEMENTATION_DEFINED,1280x960,33333333,
                IMPLEMENTATION_DEFINED,1280x720,33333333,
                IMPLEMENTATION_DEFINED,640x480,33333333,
                IMPLEMENTATION_DEFINED,320x240,33333333,
                IMPLEMENTATION_DEFINED,176x144,33333333" />
            <scaler.availableStallDurations value="BLOB,3264x2448,33333333,
                                                   BLOB,2592x1944,33333333,
                                                   BLOB,1920x1080,33333333,
                                                   BLOB,1280x960,33333333,
                                                   BLOB,1280x720,33333333,
                                                   BLOB,640x480,33333333,
                                                   BLOB,320x240,33333333,
                                                   BLOB,176x144,33333333" />
            <scaler.croppingType value="CENTER_ONLY"/>
            <!-- Sensor Info -->
            <sensor.info.activeArraySize value="0,0,3264,2448"/>
            <sensor.info.sensitivityRange value="32,2400"/>
            <sensor.info.colorFilterArrangement value="BGGR"/> <!-- HAL may override this value from CMC for RAW sensors -->
            <sensor.info.exposureTimeRange value="100000,333333330"/>
            <sensor.info.maxFrameDuration value="66666666"/>
            <sensor.info.physicalSize value="5.5,4.5"/> <!-- 4224x1.12um 3136x1.12um -->
            <sensor.info.pixelArraySize value="3264x2448"/>
            <sensor.info.whiteLevel value="0"/> <!-- HAL may override this value from CMC for RAW sensors -->
            <sensor.info.timestampSource value="UNKNOWN"/>
            <!-- Sensor -->
            <sensor.baseGainFactor value="0,1"/> <!-- HAL may override this value from CMC for RAW sensors -->
            <sensor.blackLevelPattern value="0,0,0,0"/>
            <sensor.maxAnalogSensitivity value="2400"/> <!-- HAL may override this value from CMC for RAW sensors -->
            <sensor.orientation value="270"/>
            <sensor.profileHueSatMapDimensions value="0,0,0"/>
            <sensor.availableTestPatternModes value="OFF,COLOR_BARS"/>
            <!-- Info -->
            <info.supportedHardwareLevel value="LIMITED"/>
            <!-- shading -->
            <!-- <shading.availableModes value="OFF"/> -->
            <!-- Statistics Info -->
            <statistics.info.availableFaceDetectModes value="OFF"/>
            <statistics.info.histogramBucketCount value="0"/>
            <statistics.info.maxFaceCount value="0"/>
            <statistics.info.availableHotPixelMapModes value="OFF"/>
            <statistics.info.availableLensShadingMapModes value="OFF"/>
            <!-- Flash -->
            <flash.colorTemperature value="0"/>
            <flash.maxEnergy value="0"/>
            <!-- Flash info -->
            <flash.info.available value="FALSE"/>
            <flash.info.chargeDuration value="1000000"/>
            <flash.maxEnergy value="10"/>
            <!-- Sync -->
            <sync.maxLatency value="PER_FRAME_CONTROL"/>
            <!-- maxCaptureStall -->
            <reprocess.maxCaptureStall value="4"/>
            <!-- Edge -->
            <edge.availableEdgeModes value="OFF,FAST,HIGH_QUALITY"/>
            <!-- Noise Reduction -->
            <noiseReduction.availableNoiseReductionModes value="OFF,FAST,HIGH_QUALITY"/>

        </Android_metadata>

<!-- ******************PSL specific section start **************************************************************-->
        <Hal_tuning_RKISP1> <!-- Parameters to tune the HAL and hacks for the HAL that are camera dependent -->
            <flipping value="" value_v=""/> <!-- value: SENSOR_FLIP_H or "", value_v: SENSOR_FLIP_V or "" -->
            <supportIsoMap value="false"/>
            <supportTuningSize value="3264x2448"/>
        </Hal_tuning_RKISP1>

        <Sensor_info_RKISP1> <!-- Information that parametrizes the behavior or qualities of the physical sensor -->
            <sensorType value="SENSOR_TYPE_RAW"/> <!-- SENSOR_TYPE_SOC or SENSOR_TYPE_RAW -->
            <exposure.sync value="true"/> <!-- compensate expsure sync-->
            <sensor.digitalGain value="true"/> <!-- digital gain support on sensor-->
            <gain.lag value="2"/> <!-- camera3 HAL CPF parameters moved here start-->
            <exposure.lag value="2"/>
            <fov value= "54.8" value_v="42.5"/>
            <statistics.initialSkip value="1"/> <!-- camera3 HAL CPF parameters moved here end-->
            <frame.initialSkip value="3"/> <!-- should equal actual skipFrames - 2 for driver dropped 2 frames -->
            <isoAnalogGain1 value="75"/> <!--Pseudo ISO corresponding analog gain value 1.0. -->
            <cITMaxMargin value="10"/> <!--coarse integration time max margin -->
            <aiq.workingMode value="NORMAL"/> <!-- NORMAL or HDR2 or HDR3 -->
        </Sensor_info_RKISP1>

<!-- ******************PSL specific section end **************************************************************-->
    </Profiles>

    <!-- RAW SENSOR REFERENCE SETTING -->
    <Profiles cameraId="1" name="imx258" moduleId="m01">
        <Supported_hardware>
            <hwType value="SUPPORTED_HW_RKISP1"/> <!-- SHOULD NOT EDIT -->
        </Supported_hardware>

       <Android_metadata> <!-- Android static metadata only -->
            <!-- if forceAutoGenAndroidMetas is configred "true", those settings below between 'AUTO GENERATE START' -->
            <!--and 'AUTO GENERATE END' will be covered by CameraHal, if you want to configure manually, you must set-->
            <!-- forceAutoGenAndroidMetas to "false" firstly, this feature is supported from CameraHal version 2.1.0-->
            <!--************************AUTO GENERATE START*************************-->
             <control.aeAvailableTargetFpsRanges value="15,15,10,20,20,20,10,30,30,30"/> <!-- critical field, refer to doc camera_hal3_user_manual_vx.x.pdf -->
            <!-- JPEG -->
            <jpeg.maxSize value="20000000"/> <!-- not less than max_blob_width*max_blob_height*3/2 -->
            <!-- The aspect ratio of the largest thumbnail size will be same as the aspect ratio of largest JPEG output size -->
            <jpeg.availableThumbnailSizes value="0,0,160,120,320,180,320,240"/>
            <scaler.availableStreamConfigurations value="
                BLOB,4096x3072,OUTPUT,
                BLOB,2096x1560,OUTPUT,
                BLOB,1920x1080,OUTPUT,
                BLOB,1280x960,OUTPUT,
                BLOB,1280x720,OUTPUT,
                BLOB,640x480,OUTPUT,
                BLOB,352x288,OUTPUT,
                BLOB,320x240,OUTPUT,
                BLOB,176x144,OUTPUT,
                YCbCr_420_888,4096x3072,OUTPUT,
                YCbCr_420_888,2096x1560,OUTPUT,
                YCbCr_420_888,1920x1080,OUTPUT,
                YCbCr_420_888,1280x960,OUTPUT,
                YCbCr_420_888,1280x720,OUTPUT,
                YCbCr_420_888,640x480,OUTPUT,
                YCbCr_420_888,352x288,OUTPUT,
                YCbCr_420_888,320x240,OUTPUT,
                YCbCr_420_888,176x144,OUTPUT,
                IMPLEMENTATION_DEFINED,4096x3072,OUTPUT,
                IMPLEMENTATION_DEFINED,2096x1560,OUTPUT,
                IMPLEMENTATION_DEFINED,1920x1080,OUTPUT,
                IMPLEMENTATION_DEFINED,1280x960,OUTPUT,
                IMPLEMENTATION_DEFINED,1280x720,OUTPUT,
                IMPLEMENTATION_DEFINED,640x480,OUTPUT,
                IMPLEMENTATION_DEFINED,352x288,OUTPUT,
                IMPLEMENTATION_DEFINED,320x240,OUTPUT,
                IMPLEMENTATION_DEFINED,176x144,OUTPUT" /> <!-- critical field, refer to doc camera_hal3_user_manual_vx.x.pdf -->
            <scaler.availableMinFrameDurations value="
                BLOB,4096x3072,50000000,
                BLOB,2096x1560,33333333,
                BLOB,1920x1080,33333333,
                BLOB,1280x960,33333333,
                BLOB,1280x720,33333333,
                BLOB,640x480,33333333,
                BLOB,352x288,33333333,
                BLOB,320x240,33333333,
                BLOB,176x144,33333333,
                YCbCr_420_888,4096x3072,50000000,
                YCbCr_420_888,2096x1560,33333333,
                YCbCr_420_888,1920x1080,33333333,
                YCbCr_420_888,1280x960,33333333,
                YCbCr_420_888,1280x720,33333333,
                YCbCr_420_888,640x480,33333333,
                YCbCr_420_888,352x288,33333333,
                YCbCr_420_888,320x240,33333333,
                YCbCr_420_888,176x144,33333333,
                IMPLEMENTATION_DEFINED,4096x3072,50000000,
                IMPLEMENTATION_DEFINED,2096x1560,33333333,
                IMPLEMENTATION_DEFINED,1920x1080,33333333,
                IMPLEMENTATION_DEFINED,1280x960,33333333,
                IMPLEMENTATION_DEFINED,1280x720,33333333,
                IMPLEMENTATION_DEFINED,640x480,33333333,
                IMPLEMENTATION_DEFINED,352x288,33333333,
                IMPLEMENTATION_DEFINED,320x240,33333333,
                IMPLEMENTATION_DEFINED,176x144,33333333" /> <!-- critical field, refer to doc camera_hal3_user_manual_vx.x.pdf -->
            <scaler.availableStallDurations value="
                                                   BLOB,4096x3072,66666666,
                                                   BLOB,2096x1560,33333333,
                                                   BLOB,1920x1080,33333333,
                                                   BLOB,1280x960,33333333,
                                                   BLOB,1280x720,33333333,
                                                   BLOB,640x480,33333333,
                                                   BLOB,352x288,33333333,
                                                   BLOB,320x240,33333333,
                                                   BLOB,176x144,33333333" /> <!-- critical field, refer to doc camera_hal3_user_manual_vx.x.pdf -->
            <sensor.info.activeArraySize value="0,0,4208,3120"/> <!-- sensor max output frame size,left & top should be 0 -->
            <sensor.info.sensitivityRange value="32,2400"/> <!-- SHOULD NOT EDIT, not unsed now -->
            <sensor.info.exposureTimeRange value="100000,200000000"/> <!-- COULD NOT EDIT, not unsed now -->
            <sensor.info.maxFrameDuration value="200000000"/> <!-- COULD NOT EDIT, not unsed now -->
            <sensor.info.pixelArraySize value="4208x3120"/> <!-- sensor max output frame size -->
            <sensor.maxAnalogSensitivity value="2400"/> <!-- SHOULD NOT EDIT --> 
            <!--************************AUTO GENERATE END*************************-->
            <!-- Color Correction -->
            <colorCorrection.availableAberrationModes value="OFF"/> <!-- SHOULD NOT EDIT -->
            <!-- Control -->
            <control.availableModes value="AUTO"/> <!-- SHOULD NOT EDIT -->
            <control.aeAvailableAntibandingModes value="50HZ,60Hz"/> <!-- SHOULD NOT EDIT, not support AUTO now -->
            <control.aeAvailableModes value="ON,ON_AUTO_FLASH,ON_ALWAYS_FLASH"/> <!-- remove ON_AUTO_FLASH,ON_ALWAYS_FLASH if flash is not available-->
            <control.aeLockAvailable value="FALSE"/> <!-- SHOULD NOT EDIT, not support TRUE now -->

            <control.aeCompensationRange value="0,0"/> <!-- SHOULD NOT EDIT, not suppoted now -->
            <control.aeCompensationStep value="0,1"/> <!-- SHOULD NOT EDIT, not suppoted now -->
            <control.afAvailableModes value="AUTO,CONTINUOUS_VIDEO,CONTINUOUS_PICTURE,OFF"/> <!-- set to OFF if af is not available -->
            <control.availableEffects value="OFF"/> <!-- SHOULD NOT EDIT, not support any efffect now -->
            <control.awbAvailableModes value="AUTO,INCANDESCENT,FLUORESCENT,DAYLIGHT,CLOUDY_DAYLIGHT"/> <!-- SHOULD NOT EDIT -->
            <control.awbLockAvailable value="FALSE"/> <!-- SHOULD NOT EDIT, not support TRUE now -->
            <control.availableSceneModes value="DISABLED"/> <!-- SHOULD NOT EDIT, not support any scene mode now -->
            <control.availableVideoStabilizationModes value="OFF"/> <!-- SHOULD NOT EDIT -->
            <control.maxRegions value="1,0,1"/> <!-- SHOULD NOT EDIT -->

            <!-- Lens Info-->
            <lens.info.availableApertures value="2.0"/> <!-- refer to sensor module spec -->
            <lens.info.availableFocalLengths value="2.04"/> <!-- refer to sensor module spec -->
            <lens.info.availableOpticalStabilization value="OFF"/> <!-- SHOULD NOT EDIT -->
            <lens.info.hyperfocalDistance value="0.0"/> <!-- SHOULD NOT EDIT -->
            <lens.info.minimumFocusDistance value="0.1"/> <!-- refer to sensor module spec, can't be 0 if af is available -->
            <!-- Lens -->
            <lens.facing value="BACK"/> <!-- BACK or FRONT -->
            <!-- Request -->
            <request.maxNumOutputStreams value="1,2,1"/> <!-- SHOULD NOT EDIT -->
            <request.pipelineMaxDepth value="4"/> <!-- could be increased -->
            <request.maxNumInputStreams value="0"/> <!-- SHOULD NOT EDIT -->
            <request.partialResultCount value="1"/> <!-- SHOULD NOT EDIT -->
            <request.availableCapabilities value="BACKWARD_COMPATIBLE"/> <!-- SHOULD NOT EDIT -->

            <request.availableRequestKeys value="blackLevel.lock,
                colorCorrection.aberrationMode,
                colorCorrection.gains,
                colorCorrection.transform,
                control.aeAntibandingMode,
                control.aeExposureCompensation,
                control.aeLock,
                control.aeMode,
                control.aeTargetFpsRange,
                control.aePrecaptureTrigger,
                control.afMode,
                control.aeRegions,
                control.afRegions,
                control.afTrigger,
                control.awbLock,
                control.awbMode,
                control.captureIntent,
                control.effectMode,
                control.mode,
                control.sceneMode,
                control.videoStabilizationMode,
                edge.mode,
                flash.mode,
                jpeg.gpsLocation,
                jpeg.orientation,
                jpeg.quality,
                jpeg.thumbnailQuality,
                jpeg.thumbnailSize,
                lens.aperture,
                lens.focalLength,
                lens.opticalStabilizationMode,
                noiseReduction.mode,
                scaler.cropRegion,
                statistics.faceDetectMode,
                statistics.hotPixelMapMode,
                statistics.sceneFlicker,
                statistics.lensShadingMapMode
                "/> <!-- SHOULD NOT EDIT -->

            <request.availableResultKeys value="colorCorrection.mode,
                colorCorrection.transform,
                colorCorrection.gains,
                colorCorrection.aberrationCorrectionMode,
                control.aeAntibandingMode,
                control.aeExposureCompensation,
                control.aeLock,
                control.aeMode,
                control.aeTargetFpsRange,
                control.aePrecaptureTrigger,
                control.afMode,
                control.afRegions,
                control.afTrigger,
                control.awbLock,
                control.awbMode,
                control.captureIntent,
                control.effectMode,
                control.mode,
                control.sceneMode,
                control.videoStabilizationMode,
                control.aeState,
                control.afState,
                control.awbState,
                sync.frameNumber,
                edge.mode,
                flash.mode,
                jpeg.gpsLocation,
                jpeg.orientation,
                jpeg.quality,
                jpeg.thumbnailQuality,
                jpeg.thumbnailSize,
                lens.focalLength,
                lens.aperture,
                lens.opticalStabilizationMode,
                request.pipelineDepth,
                scaler.cropRegion,
                sensor.testPatternData,
                sensor.testPatternMode,
                sensor.timestamp,
                sensor.frameDuration,
                sensor.rollingShutterSkew,
                statistics.faceDetectMode,
                statistics.hotPixelMapMode,
                statistics.faces,
                noiseReduction.mode,
                statistics.sceneFlicker,
                statistics.lensShadingMapMode
                "/> <!-- SHOULD NOT EDIT -->
            <request.availableCharacteristicsKeys value="0"/> <!-- SHOULD NOT EDIT -->
            <!-- Scaler -->
            <scaler.availableMaxDigitalZoom value="4.0"/> <!-- not greater than 4.0 -->
            <scaler.availableInputOutputFormatsMap value="IMPLEMENTATION_DEFINED,2,YCbCr_420_888,BLOB,YCbCr_420_888,2,YCbCr_420_888,BLOB"/> <!-- SHOULD NOT EDIT -->
            <scaler.croppingType value="CENTER_ONLY"/> <!-- SHOULD NOT EDIT -->
            <!-- Sensor Info -->
            <sensor.info.colorFilterArrangement value="BGGR"/> <!-- SHOULD NOT EDIT, not unsed now -->
            <sensor.info.physicalSize value="5.5,4.5"/> <!-- 4224x1.12um 3136x1.12um -->
            <sensor.info.whiteLevel value="0"/> <!-- SHOULD NOT EDIT -->
            <sensor.info.timestampSource value="UNKNOWN"/> <!-- SHOULD NOT EDIT -->
            <!-- Sensor -->
            <sensor.baseGainFactor value="0,1"/> <!-- SHOULD NOT EDIT -->
            <sensor.blackLevelPattern value="0,0,0,0"/> <!-- SHOULD NOT EDIT -->
            <sensor.orientation value="90"/> <!-- 0,90,180 or 270 -->
            <sensor.profileHueSatMapDimensions value="0,0,0"/> <!-- SHOULD NOT EDIT -->
            <sensor.availableTestPatternModes value="OFF,COLOR_BARS"/> <!-- SHOULD NOT EDIT -->
            <!-- Info -->
            <info.supportedHardwareLevel value="LIMITED"/> <!-- SHOULD NOT EDIT -->
            <!-- shading -->
            <!-- <shading.availableModes value="OFF"/> -->
            <!-- Statistics Info -->
            <statistics.info.availableFaceDetectModes value="OFF"/> <!-- SHOULD NOT EDIT -->
            <statistics.info.histogramBucketCount value="0"/> <!-- SHOULD NOT EDIT -->
            <statistics.info.maxFaceCount value="0"/> <!-- SHOULD NOT EDIT -->
            <statistics.info.availableHotPixelMapModes value="OFF"/> <!-- SHOULD NOT EDIT -->
            <statistics.info.availableLensShadingMapModes value="OFF"/> <!-- SHOULD NOT EDIT -->
            <!-- Flash -->
            <flash.colorTemperature value="0"/> <!-- SHOULD NOT EDIT -->
            <!-- Flash info -->
            <flash.info.available value="TRUE"/> <!-- TRUE if flash is available -->
            <flash.info.chargeDuration value="1000000"/> <!-- SHOULD NOT EDIT -->
            <flash.maxEnergy value="10"/> <!-- SHOULD NOT EDIT -->
            <!-- Sync -->
            <sync.maxLatency value="UNKNOWN"/> <!-- SHOULD NOT EDIT -->
            <!-- maxCaptureStall -->
            <reprocess.maxCaptureStall value="4"/> <!-- SHOULD NOT EDIT -->
            <!-- Edge -->
            <edge.availableEdgeModes value="OFF,FAST,HIGH_QUALITY"/> <!-- SHOULD NOT EDIT -->
            <!-- Noise Reduction -->
            <noiseReduction.availableNoiseReductionModes value="OFF,FAST,HIGH_QUALITY"/> <!-- SHOULD NOT EDIT -->

        </Android_metadata>

<!-- ******************PSL specific section start **************************************************************-->
        <Hal_tuning_RKISP1> <!-- Parameters to tune the HAL and hacks for the HAL that are camera dependent -->
            <!-- if forceAutoGenAndroidMetas is configred "true", those settings below between 'AUTO GENERATE START' -->
            <!--and 'AUTO GENERATE END' will be covered by CameraHal, if you want to configure manually, you must set-->
            <!-- forceAutoGenAndroidMetas to "false" firstly, this feature is supported from CameraHal version 2.1.0-->
            <!--************************AUTO GENERATE START*************************-->
            <supportTuningSize value="4208x3120,2096x1560"/> <!-- refer to IQ file -->
            <!--************************AUTO GENERATE END*************************-->
            <forceAutoGenAndroidMetas value="false"/>
        </Hal_tuning_RKISP1>

        <Sensor_info_RKISP1> <!-- Information that parametrizes the behavior or qualities of the physical sensor -->
            <sensorType value="SENSOR_TYPE_RAW"/> <!-- SENSOR_TYPE_SOC or SENSOR_TYPE_RAW -->
            <frame.initialSkip value="0"/> <!-- skip frames when streaming on -->
        </Sensor_info_RKISP1>
<!-- ******************PSL specific section end **************************************************************-->
    </Profiles>

    <hal_tuning> <!-- Parameters to tune the HAL that are camera independent but common across PSL's -->
        <!-- gfxHalToV4L2PixelFmtTable
          This table encodes the agreement between the Camera HAL and the
          Gfx and video HAL's. It maps the gfxHAL pixel formats (that the client
          can request for a stream) to concrete V4L2 pixel formats that
          the Camera HW can provide.
          This is needed for several reasons:
          - the pixel layout is not well defined (implementation_defined)
          - the pixel layout changes from sensor to sensor (RAW)
          Most entries are camera independent but some are not.
          For camera dependent entries sensorId field is used.
        -->
        <gfxHalToV4L2PixelFmtTable.impl_defined_preview value="V4L2_PIX_FMT_NV12"/>
        <gfxHalToV4L2PixelFmtTable.impl_defined_video value="V4L2_PIX_FMT_NV12"/>
        <gfxHalToV4L2PixelFmtTable.raw_sensor sensorId="0" value="V4L2_PIX_FMT_SBGGR10"/>
        <gfxHalToV4L2PixelFmtTable.ycbcr_420_888 value="V4L2_PIX_FMT_NV12"/>
    </hal_tuning>

    <Common> <!-- Common parameters of camera -->
    </Common>
</CameraSettings>