本文主要是介绍【Camera Sensor Driver笔记】三、点亮指南之Sensor DTS,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
== camera sensor 接口配置
xxsensor.cpp -> xxxsensor.so
CalculateExposure 函数
pCalculateExposure函数
(平台)输入参数:
pCalculateExposureData
realgain :total gain,ae算法传过来的值或者手动曝光的值
linecount:经过平台已经转换过的曝光时间
middlerealgain
middlelinecount
shortrealgain
shortlinecount
::作用于shdr
sensorResolutionIndex
...
输出参数:
pExposureInfo
analogRealGain:sensor的模拟gain
analogRegisterGain:sensor的模拟gain对应的寄存器的值
digitalRealGain:sensor的数字gain
digitalRegisterGain:sensor的数字gain对应的寄存器的值
ISPDigitalGain isp的数字gain
...
LineCount = ExposureTime / Tline
Tline = HTS * 1 / vt_clk , lineLengthPixelClock(一行要处理多少个pixel) * 1 / VTPixelClock(处理一个pixel的时间)
vt_clk = VTS * HTS * FPS, frameLengthLines * lineLengthPixelClock * FPS
Tline = 1 / (VTS * FPS),1/ (frameLengthLines * FPS)
FillExposureSettings 函数
pFillExposureSettings函数
输入参数:
pExposureData
曝光寄存器信息
analogRealGain:sensor的模拟gain
digitalRealGain:sensor的数字gain
...
输出参数:
pRegSettingsInfo
regSettingCount:sensor的寄存器数量
regSetting[]:sensor的寄存器数组
== Camera Sensor KMD DTS 配置
什么是DTS:DTS是一种用于描述硬件信息的数据结构和语言,它是树状结构的。
bengal-camera-sensor-qrd.dtsi
camera模组相关硬件描述(sensor,eeprom,actuator,flash,etc)
bengal-camera.dtsi
平台相关camera硬件描述(ife,ipe,csiphy,csid,cci,etc)
soc 节点(flash,cam-res-mgr)
&soc {
led_flash_rear: qcom,camera-flash@0 {
cell-index = <0>; //唯一标号 flash固定标号
compatible = "qcom,camera-flash"; //和driver匹配,匹配后调驱动probe
::struct of_device_id cam_flash_dt_match[] = {
:: .compatible = "qcom,camera-flash"
::}
flash-source = <&pmi632_flash0 &pmi632_flash1>; //引用flash节点,由BSP实现
torch-source = <&pmi632_torch0 &pmi632_torch1>; //引用torch节点,由BSP实现
switch-source = <&pmi632_switch0 &pmi632_switch1>; //引用switch节点
status = "ok"; //ok or disable
};
,,,
qcom,cam-res-mgr { //管理GPIO资源,封装kernel API 接口
compatible = "qcom,cam-res-mgr"; //和driver匹配,probe
status = "ok"; //ok or disable
};
};
cam_cci 节点
actuator
&cam_cci0 { //平台cci0 控制器
actuator_rear: qcom,actuator0 {
cell-index = <0>; //唯一标号
compatible = "qcom,actuator"; //和driver匹配,匹配后调驱动probe
cci-master = <0>; //cci index
cam_vaf-supply = <&L5P>; //电源引用节点,由BSP实现
regulator-names = "cam_vaf"; //电源名称
rgltr-cntrl-support; //regulator 精确控制使能
rgltr-min-voltage = <2800000>; //最小电压值,单位µV
rgltr-max-voltage = <2800000>; //最大电压值,单位µV
rgltr-load-current = <100000>; //电流,单位µA
status = "ok";
};
actuator_rear_aux: qcom,actuator1 {
cell-index = <1>;
compatible = "qcom,actuator";
cci-master = <1>;
cam_vaf-supply = <&L5P>;
regulator-names = "cam_vaf";
rgltr-cntrl-support;
rgltr-min-voltage = <2800000>;
rgltr-max-voltage = <2800000>;
rgltr-load-current = <100000>;
status = "ok";
};
sensor
qcom,cam-sensor0 {
cell-index = <0>; //唯一标号slot id ,和 module xml id唯一匹配
compatible = "qcom,cam-sensor"; //和driver匹配,匹配后调驱动probe
csiphy-sd-index = <0>; //csiphy id, 绑定csiphy,这个sensor用的哪个phy
sensor-position-roll = <270>; //会被xml配置覆盖
sensor-position-pitch = <0>;
sensor-position-yaw = <180>;
actuator-src = <&actuator_rear>; //绑定actuator节点
led-flash-src = <&led_flash_rear>; //绑定flash节点
eeprom-src = <&eeprom_rear>; //绑定eeprom节点
cam_vio-supply = <&L7P>; //引用IOvdd 节点,由BSP具体实现
cam_vana-supply = <&L4P>; //引用Avdd 节点,由BSP具体实现
cam_vdig-supply = <&L2P>; //引用Dvdd 节点,由BSP具体实现
cam_vaf-supply = <&L5P>; //引用AFvdd 节点,由BSP具体实现
cam_clk-supply = <&gcc_camss_top_gdsc>; //引用gdsc 时钟,由BSP实现
regulator-names = "cam_vio", "cam_vana", "cam_vdig",
"cam_clk", "cam_vaf"; //和上面的cam_ 没有顺序关系
//和下面的rgltr- 有顺序关系
rgltr-cntrl-support; //regulator 精确控制使能
rgltr-min-voltage = <1800000 2800000 1050000 0 2800000>;
rgltr-max-voltage = <1800000 2800000 1050000 0 2800000>;
rgltr-load-current = <120000 80000 1200000 0 100000>;
gpio-no-mux = <0>; //gpio复用
pinctrl-names = "cam_default", "cam_suspend"; //active, deactive
pinctrl-0 = <&cam_sensor_mclk0_active
&cam_sensor_rear0_reset_active>; //active 0对应 cam_default
pinctrl-1 = <&cam_sensor_mclk0_suspend
&cam_sensor_rear0_reset_suspend>; //deactive 1对应cam_suspend
gpios = <&tlmm 20 0>, // 平台tlmm pin 20 作为mclk 默认输出低电平
<&tlmm 18 0>; // 平台tlmm pin 18 作为reset 默认输出低电平
gpio-reset = <1>; //指定上面哪一个作为GPIO RESET使用
gpio-req-tbl-num = <0 1>; // GPIO 数组index
gpio-req-tbl-flags = <1 0>; //GPIO direction, 0:输出,1:输入; mclk作为输入,gpio作为输出
gpio-req-tbl-label = "CAMIF_MCLK0",
"CAM_RESET0";
cci-master = <0>; //cci总线
clocks = <&gcc GCC_CAMSS_MCLK0_CLK>; //引用MCLK节点,由BSP提供具体实现
clock-names = "cam_clk"; //MCLK时钟名称
clock-cntl-level = "turbo";
clock-rates = <19200000>; //MCLK时钟频率,19.2M or 24M
status = "ok";
};
EEPROM
eeprom_triple_rear_macro: qcom,eeprom@4 {
cell-index = <4>;
compatible = "qcom,eeprom";
reg = <0x4>;
cam_vio-supply = <&L6P>;
cam_vana-supply = <&L4P>;
cam_clk-supply = <&cam_cc_titan_top_gdsc>;
regulator-names = "cam_vio", "cam_vana", "cam_clk";
cci-device = <0>;
cci-master = <0>;
qcom,cam-sensor@4 {
cell-index = <4>;
compatible = "qcom,cam-sensor";
reg = <0x4>;
cam_vio-supply = <&L6P>;
cam_vana-supply = <&L4P>;
cam_clk-supply = <&cam_cc_titan_top_gdsc>;
regulator-names = "cam_vio", "cam_vana", "cam_clk";
sensor-mode = <0>;
cci-device = <0>;
cci-master = <0>;
}
}
这篇关于【Camera Sensor Driver笔记】三、点亮指南之Sensor DTS的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!