摄像头知识积累
1. 攝像頭通用知識
1.1 sensor類型
camera sensor分為YUV sensor 和Bayer sensor。
YUV sensor又叫SOC sensor,它的輸出格式是YUV格式的,YUV格式又分很多種,常見的有YUV422,YUV420。
YUV: luma (Y) + chroma (UV) 格式, 一般情況下sensor支持YUV422格式,即數據格式是按Y-U-Y-V次序輸出的
比如斑馬掃描頭SE4750 sensor是單Y輸出,斑馬技術說的。
Bayer sensor的數據輸出格式是RAW格式的。
現在的主流是Bayer sensor,因為YUV sensor的數據量都比較大,例如YUV422格式1個pixel占據兩個bytes,而RAW10格式的1個pixel只占10bit。一般的YUV sensor像素都比較低。
YUV sensor內部會自帶一個isp對鏡頭傳進來的圖像進行簡單的圖像效果處理(通過寄存器設置),然后以YUV格式(一般是YUV420SP)輸出。而Bayer sensor用的是平臺自帶的isp,不同的模組都需要進行效果調試。
?
?
2.高通平臺
2.1 攝像頭設備樹節點
* Qualcomm MSM Sensor
MSM sensor node contains properties of camera sensor
Required properties:
- compatible : should be manufacturer name followed by sensor name
? ? - "qcom,camera"
? ? - "shinetech,gc0310"
- reg : should contain i2c slave address of the device
以上兩個設置需要查看主板原理圖,看主板上攝像頭是接在CSI0還是CSI1上的,一般后攝像頭都會接到CSI0上,前攝像頭會接在CSI1上。
比如下面是msm8953下的
qcom,camera@0 {//主攝像頭
?? ??? ?cell-index = <0>;
?? ??? ?compatible = "qcom,camera";
?? ??? ?reg = <0x0>;
?? ??? ?qcom,csiphy-sd-index = <0>;
?? ??? ?qcom,csid-sd-index = <0>;
?? ??? ?qcom,mount-angle = <90>;
? ? ? ? ...}
qcom,camera@2 {//2D軟解碼
?? ??? ?cell-index = <2>;
?? ??? ?compatible = "qcom,camera";
?? ??? ?reg = <0x2>;
?? ??? ?qcom,csiphy-sd-index = <1>;
?? ??? ?qcom,csid-sd-index = <1>;
?? ??? ?qcom,mount-angle = <90>;
...}
qcom,camera@1 {//前置攝像頭
?? ??? ?cell-index = <1>;
?? ??? ?compatible = "qcom,camera";
?? ??? ?reg = <0x01>;
?? ??? ?qcom,csiphy-sd-index = <2>;
?? ??? ?qcom,csid-sd-index = <1>;
?? ??? ?qcom,mount-angle = <90>;
}
- qcom,gpio-reset : should contain index to gpio used by sensors reset_n,從0開始
- qcom,gpio-standby : should contain index to gpio used by sensors standby_n
- qcom,gpio-vio : should contain index to gpio used by sensors io vreg enable
- qcom,gpio-vana : should contain index to gpio used by sensors analog vreg enable
- qcom,gpio-vdig : should contain index to gpio used by sensors digital vreg enable
- qcom,gpio-vaf : should contain index to gpio used by sensors af vreg enable
- qcom,gpio-af-pwdm : should contain index to gpio used by sensors af pwdm_n
- qcom,gpio-req-tbl-num : should contain index to gpios specific to this sensor
- qcom,gpio-req-tbl-flags : should contain direction of gpios present in
- qcom,gpio-req-tbl-label : should contain name of gpios present in
- qcom,gpio-set-tbl-flags : should contain value to be configured for the gpios
? ? present in qcom,gpio-set-tbl-num property (in the same order)
qcom,gpio-set-tbl-flags= <0 2>; //(0 – GPIOF_OUT_INIT_LOW, 2 -GPIOF_OUT_INIT_HIGH)
gpios = <&tlmm 28 0>,
?? ??? ??? ?<&tlmm 40 0>,
?? ??? ??? ?<&tlmm 39 0>,
?? ??? ??? ?<&tlmm 16 0>;? ? ? ?
?? ??? ?qcom,gpio-reset = <1>;1指向GPIO40
?? ??? ?qcom,gpio-standby = <2>;
?? ??? ?qcom,gpio-custom2 = <3>;??
?? ??? ?qcom,gpio-req-tbl-num = <0 1 2 3>;
?? ??? ?qcom,gpio-req-tbl-flags = <1 0 0 0>;//(0 – output gpio, 1 – input gpio)
?? ??? ?qcom,gpio-req-tbl-label = "CAMIF_MCLK2",//(gpio name)
?? ??? ??? ??? ??? ? ?"CAM_RESET2",
?? ??? ??? ??? ??? ? ?"CAM_STANDBY2",
?? ??? ??? ??? ??? ? ?"CAM_DVDD_1V2";? ? ? ??
//下面以msm8937的主攝像頭來距離說明
?? ?qcom,camera@0 {
<name>[@<unit-address>]如果一個節點描述的設備有地址,則應該給出@uni-address,多個相同類型設備節點的name可以是一樣,只要unit-address不同即可,設備的unit-address地址也經常在其對應節點的reg屬性中給出,對于掛在內存空間的設備而言,@字符后跟的一般就是該設備在內存空間的基地址,對于掛在I2C總線上的外設而言,@后面一般跟的是從設備的I2C地址。
?? ??? ?cell-index = <0>;//0為后置攝像頭,1為前置攝像頭
?? ??? ?compatible = "qcom,camera";
?? ??? ?reg = <0x0>;
?? ??? ?qcom,csiphy-sd-index = <0>;
- qcom,csiphy-sd-index : should contain csiphy instance that will used to
? ? receive sensor data
? ? - 0, 1, 2
?? ??? ?qcom,csid-sd-index = <0>;
- qcom,csid-sd-index : should contain csid core instance that will used to
? ? receive sensor data
? ? - 0, 1, 2, 3
傳感器所用 CSID 硬件的索引;若同時使用兩個傳感器,則該設置不能使用
同一個值。
?? ??? ?qcom,mount-angle = <90>;
?? ??? ?qcom,actuator-src = <&actuator0>;
?? ??? ?qcom,led-flash-src = <&led_flash0>;
?? ??? ?/*qcom,eeprom-src = <&eeprom0>;*/ ?/* Modified by huangfusheng 2016-10-08 */
?? ??? ?cam_vdig-supply = <&pm8937_l23>;
?? ??? ?cam_vana-supply = <&pm8937_l22>;
?? ??? ?cam_vio-supply = <&pm8937_l6>;
?? ??? ?cam_vaf-supply = <&pm8937_l17>;
?? ??? ?qcom,cam-vreg-name = "cam_vdig", "cam_vio", "cam_vana",
?? ??? ??? ??? ??? ??? ??? ?"cam_vaf";
?? ??? ?qcom,cam-vreg-min-voltage = <1200000 0 2800000 2850000>;
?? ??? ?qcom,cam-vreg-max-voltage = <1200000 0 2800000 2850000>;
?? ??? ?qcom,cam-vreg-op-mode = <200000 0 80000 100000>;
?? ??? ?pinctrl-names = "cam_default", "cam_suspend";
?? ??? ?pinctrl-0 = <&cam_sensor_mclk0_default
?? ??? ??? ??? ?&cam_sensor_rear_default>;
?? ??? ?pinctrl-1 = <&cam_sensor_mclk0_sleep
?? ??? ??? ??? ?&cam_sensor_rear_sleep>;
?? ??? ?gpios = <&tlmm 26 0>,
?? ??? ??? ?<&tlmm 36 0>,
?? ??? ??? ?<&tlmm 35 0>,
?? ??? ??? ?<&tlmm 16 0>, ? ? ? /* Add GC8024 DVDD enable by huangfusheng 2016-10-08 */
?? ??? ??? ?<&tlmm 92 0>; ?//125 ? ?/* Add REAR CAMERA VAF enable by huangfusheng 2016-10-08 */
?? ??? ?qcom,gpio-reset = <1>;
?? ??? ?qcom,gpio-standby = <2>;
?? ??? ?qcom,gpio-custom2 = <3>; ? ?/* Add GC8024 DVDD enable by huangfusheng 2016-10-08 */
?? ??? ?qcom,gpio-custom3 = <4>; ? ?/* Add REAR CAMERA VAF enable by huangfusheng 2016-10-08 */
?? ??? ?qcom,gpio-req-tbl-num = <0 1 2 3 4>;
?? ??? ?qcom,gpio-req-tbl-flags = <1 0 0 0 0>;
?? ??? ?qcom,gpio-req-tbl-label = "CAMIF_MCLK0",
?? ??? ??? ?"CAM_RESET0",
?? ??? ??? ?"CAM_STANDBY0",
?? ??? ??? ?"CAM_DVDD_1V2", ? ? ? ? /* Add DVDD GC8024 enable by huangfusheng 2016-10-08 */
?? ??? ??? ?"CAM_DVAF_2V8"; ? ? ? ? /* Add REAR CAMERA VAF enable by huangfusheng 2016-10-08 */
?? ??? ?qcom,sensor-position = <0>;
?? ??? ?qcom,sensor-mode = <0>;
?? ??? ?qcom,cci-master = <0>;
?? ??? ?clocks = <&clock_gcc clk_mclk0_clk_src>,
?? ??? ??? ?<&clock_gcc clk_gcc_camss_mclk0_clk>;
?? ??? ?clock-names = "cam_src_clk", "cam_clk";
?? ??? ?qcom,clock-rates = <24000000 0>;
?? ?};
?
3.解像力測試
相關鏈接:
linux驅動由淺入深系列:camera驅動之一(背景及基礎知識篇)
https://blog.csdn.net/RadianceBlau/article/details/76460907
?
4.HDR寬動態
dynamic range大約要85DB才算是寬動態,比如AR0230CS這個sensor
下面是OV2735,不支持寬動態
Camera sensor bring up
https://blog.csdn.net/tamell5555/article/details/52190765
一文看懂安卓Android攝像頭的移植方法-Android系統開發干貨來襲
http://blog.sina.com.cn/s/blog_14f0dc1a10102xqd3.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
- 上一篇: 高通平台耳机插拔检测
- 下一篇: Ubuntu搭建git服务器,外网可访问