RK3288 Camera

Android 7.1

Posted by LXG on March 30, 2022

MIPI CSI 使用

Firefly-RK3399 Camera使用

相机系统综述 – ISP

rk-camera-tech

架构

camera_arch

基础

相机模组组成:

  1. 镜头 LENS
  2. 对焦马达 VCM
  3. 图像传感器 SENOSOR
  4. 图像信号处理器 ISP

camera_conception

按接口来划分,Camera 分为 DVP 、 MIPI、usb camera。

  • DVP是并口,需要PCLK、VSYNC、HSYNC、D[0:11]——可以是8/10/12bit数据,看 ISP 或 baseband 是否支持;
  • MIPI是LVDS,低压差分串口。只需要要CLKP/N、DATAP/N——最大支持4-lane,一般2-lane可以搞定。
  • usb camera 相当于集 sensor、isp 驱动于一身的消息通,通过 usb 接口对外提供 YUV、MJpeg 等图像数据。

MIPI接口比DVP的接口信号线少,由于是低压差分信号,产生的干扰小,抗干扰能力也强。最重要的是 DVP 接口在信号完整性方面受限制,速率也受限制。500W还可以勉强用DVP,800W及以上都采用MIPI接口。 USB摄像头,即插即用比较灵活,但是由于传输速率的瓶颈,其支持分辨率较低。

App

frameworks/base/core/java/android/hardware/Camera.java

system/lib/libandroid_runtime.so

frameworks/base/core/jni/android_hardware_Camera.cpp

system/lib/libcamera_client.so

frameworks/av/camera/Camera.cpp

frameworks/av/camera/CameraBase.cpp

mediaserver

/system/bin/mediaserver

frameworks/av/media/mediaserver/main_mediaserver.cpp

system/lib/libcameraservice.so

frameworks/av/services/camera/libcameraservice/CameraService.cpp

HAL

system/lib/hw/camera.rk30board.so

hardware/rockchip/camera/CameraHal/

Driver

drivers/media/video

v4l2_driver

DTS


&cif_isp0 {
        status = "okay";
};

HAL


Android:
`- hardware/rockchip/camera/
   |- Config
   |  `- cam_board_rk3399.xml      // 摄像头的参数设置
   |- CameraHal             // 摄像头的 HAL 源码
   `- SiliconImage          // ISP 库,包括所有支持模组的驱动源码
      `- isi/drv/OV13850    // OV13850 模组的驱动源码
         `- calib/OV13850.xml // OV13850 模组的调校参数

Kernel:
|- kernel/drivers/media/video/rk_camsys  // CamSys 驱动源码
`- kernel/include/media/camsys_head.h

cam_board_rk3288.xml


<?xml version="1.0" ?>
<BoardFile>
		<BoardXmlVersion version="v0.0xf.0">
		</BoardXmlVersion>

          <CamDevie>
			<HardWareInfo>
				<Sensor>
					<SensorName name="OV8858"></SensorName>
					<ModuleName name="NC" ></ModuleName>
					<SensorLens name="LG-9569A2"></SensorLens>
					<SensorDevID IDname="CAMSYS_DEVID_SENSOR_1B"></SensorDevID>
					<SensorHostDevID busnum="CAMSYS_DEVID_MARVIN" ></SensorHostDevID>
					<SensorI2cBusNum busnum="3"></SensorI2cBusNum>
					<SensorI2cAddrByte byte="2"></SensorI2cAddrByte>
					<SensorI2cRate rate="100000"></SensorI2cRate>
					<SensorAvdd name="NC" min="0" max="0" delay="0"></SensorAvdd>
					<SensorDvdd name="NC" min="0" max="0" delay="0"></SensorDvdd>
					<SensorDovdd name="NC" min="18000000" max="18000000"  delay="5000"></SensorDovdd>
					<SensorMclk mclk="24000000" delay="1000"></SensorMclk>
					<SensorGpioPwen ioname="RK30_PIN0_PC1" active="1" delay="1000"></SensorGpioPwen>
					<SensorGpioRst ioname="NC" active="0" delay="1000"></SensorGpioRst>
					<SensorGpioPwdn ioname="RK30_PIN2_PB6" active="0" delay="2000"></SensorGpioPwdn>
					<SensorFacing facing="back"></SensorFacing>
					<SensorInterface interface="MIPI"></SensorInterface>
					<SensorMirrorFlip mirror="0"></SensorMirrorFlip>
					<SensorOrientation orientation="0"></SensorOrientation>
					<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="1" sensorFmt="CamSys_Fmt_Raw_10b"></SensorPhy>
				</Sensor>
				<VCM>
					<VCMDrvName name="BuiltInSensor"></VCMDrvName>
					<VCMName name="NC"></VCMName>
					<VCMI2cBusNum busnum="3"></VCMI2cBusNum>
					<VCMI2cAddrByte byte="0"></VCMI2cAddrByte>
					<VCMI2cRate rate="0"></VCMI2cRate>
					<VCMVdd name="NC" min="0" max="0" delay="0"></VCMVdd>
					<VCMGpioPower ioname="RK30_PIN8_PA6" active="1" delay="1000"></VCMGpioPower>
					<VCMGpioPwdn ioname="NC" active="0" delay="0"></VCMGpioPwdn>
					<VCMCurrent start="0" rated="100" vcmmax="100" stepmode="4"  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="1"></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="0" height="0"></PreviewSize>
				<Preview_Minimum_FrameRate framerate="0"></Preview_Minimum_FrameRate>
				<FaceDetect support="0" MaxNum="1"></FaceDetect>
				<Cproc support="1" contrast="1.1" saturation="1.0" hue="0" brightness="0"></Cproc>
				<Gammaout support = "0" gamma = "1.0" offset = "0"></Gammaout>
				<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>