和你一起終身學習,這裏是程序員 Android
經典好文推薦,通過閱讀本文,您將收穫以下知識點:
一、相機Sensor 點亮相關的文件
二、Sensor 驅動文件詳解
一、相機Sensor 點亮相關的文件
1.1 Sensor 驅動XML以及CPP文件
- Sensor 文件路徑:
vendor\qcom\proprietary\chi-cdk\oem\sensor\sensor_name
這顆Sensor 目錄裏面會有Sensor廠商提供或者別的項目copy過來成熟的 sensor.cpp 、 sensor.xml 、Android.mk文件
比如:
vendor\qcom\proprietary\chi-cdk\oem\sensor\imx586
vendor\qcom\proprietary\chi-cdk\oem\sensor\imx586\imx586.cpp
vendor\qcom\proprietary\chi-cdk\oem\sensor\imx586\imx586.xml
vendor\qcom\proprietary\chi-cdk\oem\sensor\imx586\Android.mk
- sensor*.xml 編譯生成bin文件
bin文件編譯腳本命令參考如下:
./buildbins_.py --yaml-file-name buildbins_.yaml
buildbins_.yaml 文件中需要把對應的senesor.xml 以及module.xml 添加上
執行py腳本後會生成com.qti.sensor*.bin文件
- sensor*.cpp 編譯生成so 文件
so可以按正常的編譯庫文件編譯
1.2 Module 配置XML文件
Module 配置文件路徑:
\vendor\qcom\proprietary\chi-cdk\oem\module
比如:
\vendor\qcom\proprietary\chi-cdk\oem\module\imx586_module.xml
1.3 dtsi 設備樹文件
dtsi 設備樹文件路徑如下:
\kernel\msm-4.19\arch\arm64\boot\dts\vendor\camera
比如target_name-camera-sensor-platform.dtsi
需要編譯dtboimage 編譯生成dtbo.img ,
另外需要編譯bootimge 生成 boot.img, 使用fastboot flash dtbo dtbo.img 刷入手機中(需要跟bootimage一起刷入)
二、Sensor 驅動文件詳解
2.1 sensor*.xml 文件詳解
sensor*.xml 會包含
power settings,resolution, initialization settings, and exposure settings等
vendor\qcom\proprietary\chi-cdk\api\sensor\camxsensordriver.xsd 可以查看這個xml的詳細內容
<sensorDriverData>
<slaveInfo>
<sensorName>s5_rear</sensorName>
<slaveAddress>0x5a</slaveAddress>
<sensorId> 0x38e1</sensorId>
<i2cFrequencyMode>FAST</i2cFrequencyMode>
//上下電順序相反
<powerUpSequence> </powerUpSequence>
<powerDownSequence> </powerDownSequence>
</slaveInfo>
<resolutionInfo>
<sensorVersion>0</sensorVersion>
<!-- Res 0 8160*6144 10fps --> 第一個必須Full 全尺寸size
<resolutionData>
<streamInfo>
<streamConfiguration>
// 50M Full Size
<frameDimension>
<xStart>0</xStart>
<yStart>0</yStart>
<width>8160</width>
<height>6144</height>
</frameDimension>
</streamConfiguration>
</streamInfo>
<!--Line length pixel clock of frame
Typically this value is the active width + blanking width -->
<lineLengthPixelClock>8688</lineLengthPixelClock>
<!--Frame length lines of frame
Typically this value is the active height + blanking height -->
<frameLengthLines>6400</frameLengthLines>
<!--Output pixel clock -->
<outputPixelClock>556800000</outputPixelClock>
// 幀率fps = outputPixelClock/(frameLengthLines*lineLengthPixelClock)
// 10fps =556800000/(6400*8688)=10.013
<!--Maximum frame rate -->
<frameRate>10.07</frameRate>
<regSetting> </regSetting>
<!--Crop information for the frame -->
<cropInfo>
<left>0</left>
<right>0</right>
<top>0</top>
<bottom>0</bottom>
</cropInfo>
<!--List of features / capabilities supported by sensor -->
<capability>QUADCFA</capability>
<RemosaicTypeInfo>SWRemosaic</RemosaicTypeInfo>
<ADCReadoutTime>-6</ADCReadoutTime>
</resolutionData>
<!-- Res 1 4080*3072 30fps 4:3 -->
<resolutionData>
<frameDimension>
<xStart>0</xStart>
<yStart>0</yStart>
<width>4080</width>
<height>3072</height>
</frameDimension>
</resolutionData>
<!-- Res 2 4080*2296 30fps -->
<resolutionData>
<frameDimension>
<xStart>0</xStart>
<yStart>388</yStart>
<width>4080</width>
<height>2296</height>
</frameDimension>
</resolutionData>
<!-- Res 3 4080*3072 24fps -->
<resolutionData>
<frameDimension>
<xStart>0</xStart>
<yStart>0</yStart>
<width>4080</width>
<height>3072</height>
</frameDimension>
</resolutionInfo>
<exposureControlInfo></exposureControlInfo>
<streamOnSettings> </streamOnSettings>
<streamOffSettings> </streamOffSettings>
<masterSettings></masterSettings>
<initSettings></initSettings>
<resolutionData>
</sensorDriverData>
2.2 module.xml 文件詳解
module.xml主要用來存儲camera一些特殊信息,比如 lens鏡頭,mountangles掛載角度,actuator馬達,OIS光學防抖,Flash 閃光燈等
<cameraModuleData>
<moduleGroup>
<moduleConfiguration description="Module configuration">
<cameraId>0</cameraId>
<!--Name of the module integrator -->
<moduleName>sunny</moduleName>
<sensorName>s5_rear</sensorName>
<actuatorName> </actuatorName>
<oisName></oisName>
<eepromName> </eepromName>
<flashName> </flashName>
<pdafName> </pdafName>
<!--Chromatix name is used to used to open binary.
Binary name is of the form sensor_model_chromatix.bin -->
<chromatixName>s5_rear</chromatixName>
<position>REAR</position>
<!--Mount Angle -->
<mountAngle>0</mountAngle>
<!--CSI Information -->
<CSIInfo description="CSI Information">
<laneAssign>0x3210</laneAssign>
<isComboMode>0</isComboMode>
</CSIInfo>
<!--Lens information -->
<lensInfo description="Lens Information">
<!--Focal length of the lens in millimeters. -->
<focalLength>4.05</focalLength>
<maxYawDegree>180</maxYawDegree>
</lensInfo>
</moduleConfiguration>
</moduleGroup>
</cameraModuleData>
2.3 dtsi 設備樹文件詳解
Camera客製化DTSI 參考文檔目錄
kernel\msm-4.19\Documentation\devicetree\bindings\media\camera
主要配置camera電源LDO, camera IIC通訊配置,根據硬件原理圖配置出相應的電壓給camera,包括AVDD,DVDD, 和IOVDD
參考文檔:
80-p9301-97_p_camera_sensor_driver_bring-up_guide.pdf
至此,本篇已結束。轉載網絡的文章,小編覺得很優秀,歡迎點擊閱讀原文,支持原創作者,如有侵權,懇請聯繫小編刪除,歡迎您的建議與指正。同時期待您的關注,感謝您的閱讀,謝謝!