1.cust_mt6771_camera.dtsi修改
这个设备树文件主要配置相机的reset,powerdown,avdd,dvdd,dovdd,clk引脚信息,已经配置了一些相机信息,我们调试时需要根据需求进行修改
reset和powerdown引脚配置
camera_pins_cam0_rst_0: cam0@0 {
pins_cmd_dat {
pinmux = <PINMUX_GPIO101__FUNC_GPIO101>;
slew-rate = <1>;
output-low;
};
};
camera_pins_cam0_rst_1: cam0@1 {
pins_cmd_dat {
pinmux = <PINMUX_GPIO101__FUNC_GPIO101>;
slew-rate = <1>;
output-high;
};
};
camera_pins_cam0_pnd_0: cam0@2 {
pins_cmd_dat {
pinmux = <PINMUX_GPIO97__FUNC_GPIO97>;
slew-rate = <1>;
output-low;
};
};
camera_pins_cam0_pnd_1: cam0@3 {
pins_cmd_dat {
pinmux = <PINMUX_GPIO97__FUNC_GPIO97>;
slew-rate = <1>;
output-high;
};
};
根据原理图配置相应引脚,一般默认0为主摄像头,1为前摄像头
avdd,dvdd,dovdd引脚配置
根据硬件原理图分析引脚是GPIO供电或系统供电
(这里示例配置avdd、dvddGPIO供电,dovdd系统供电)
GPIO供电:
camera_pins_cam0_vcama_0: cam0@vcam0 {
pins_cmd_dat {
pinmux = <PINMUX_GPIO17__FUNC_GPIO17>;
slew-rate = <1>;
output-low;
};
};
camera_pins_cam0_vcama_1: cam0@vcam1 {
pins_cmd_dat {
pinmux = <PINMUX_GPIO17__FUNC_GPIO17>;
slew-rate = <1>;
output-high;
};
};
camera_pins_cam0_vcamd_0: cam0@vcam2 {
pins_cmd_dat {
pinmux = <PINMUX_GPIO178__FUNC_GPIO178>;
slew-rate = <1>;
output-low;
};
};
camera_pins_cam0_vcamd_1: cam0@vcam3 {
pins_cmd_dat {
pinmux = <PINMUX_GPIO178__FUNC_GPIO178>;
slew-rate = <1>;
output-high;
};
};
系统供电:
?cam0_vcamio-supply = <&mt_pmic_vcamio_ldo_reg>;
clk引脚配置
camera_pins_cam0_mclk_off: camera_pins_cam0_mclk_off {
pins_cmd_dat {
pinmux = <PINMUX_GPIO99__FUNC_GPIO99>;
drive-strength = <1>;
};
};
camera_pins_cam0_mclk_2ma: camera_pins_cam0_mclk_2ma {
pins_cmd_dat {
pinmux = <PINMUX_GPIO99__FUNC_CMMCLK0>;
drive-strength = <0>;
};
};
camera_pins_cam0_mclk_4ma: camera_pins_cam0_mclk_4ma {
pins_cmd_dat {
pinmux = <PINMUX_GPIO99__FUNC_CMMCLK0>;
drive-strength = <1>;
};
};
camera_pins_cam0_mclk_6ma: camera_pins_cam0_mclk_6ma {
pins_cmd_dat {
pinmux = <PINMUX_GPIO99__FUNC_CMMCLK0>;
drive-strength = <2>;
};
};
camera_pins_cam0_mclk_8ma: camera_pins_cam0_mclk_8ma {
pins_cmd_dat {
pinmux = <PINMUX_GPIO99__FUNC_CMMCLK0>;
drive-strength = <3>;
};
};
硬件引脚关联配置
引脚配置的数量必须和上面配置的引脚一致,dws配置文件中相关GPIO模式设置正确;
&kd_camera_hw1 {
pinctrl-names = "default",
"cam0_rst0", "cam0_rst1",
"cam0_pnd0", "cam0_pnd1",
"cam1_rst0", "cam1_rst1",
"cam1_pnd0", "cam1_pnd1",
"cam2_rst0", "cam2_rst1",
"cam2_pnd0", "cam2_pnd1",
"cam0_ldo_vcama_0", "cam0_ldo_vcama_1",
"cam0_ldo_vcamd_0", "cam0_ldo_vcamd_1",
"cam2_ldo_vcamd_0", "cam2_ldo_vcamd_1",
"cam2_ldo_vcama_0", "cam2_ldo_vcama_1",
"cam0_mclk_off",
"cam0_mclk_2mA", "cam0_mclk_4mA",
"cam0_mclk_6mA", "cam0_mclk_8mA",
"cam1_mclk_off",
"cam1_mclk_2mA", "cam1_mclk_4mA",
"cam1_mclk_6mA", "cam1_mclk_8mA",
"cam2_mclk_off",
"cam2_mclk_2mA", "cam2_mclk_4mA",
"cam2_mclk_6mA", "cam2_mclk_8mA";
pinctrl-0 = <&camera_pins_default>;
pinctrl-1 = <&camera_pins_cam0_rst_0>;
pinctrl-2 = <&camera_pins_cam0_rst_1>;
pinctrl-3 = <&camera_pins_cam0_pnd_0>;
......
pinctrl-33 = <&camera_pins_cam2_mclk_4ma>;
pinctrl-34 = <&camera_pins_cam2_mclk_6ma>;
pinctrl-35 = <&camera_pins_cam2_mclk_8ma>;
cam0_vcamio-supply = <&mt_pmic_vcamio_ldo_reg>;
cam1_vcama-supply = <&mt_pmic_vcama2_ldo_reg>;
cam1_vcamd-supply = <&mt_pmic_vcamd_ldo_reg>;
cam1_vcamio-supply = <&mt_pmic_vcamio_ldo_reg>;
cam2_vcamio-supply = <&mt_pmic_vcamio_ldo_reg>;
status = "okay";
};
2.imgsensor_cfg_table.c文件配置
这个文件主要配置相机供电引脚(avdd,dvdd,dovdd)属性,根据硬件原理图判断:
GPIO控制的引脚使用宏:IMGSENSOR_HW_ID_GPIO
系统供电的引脚使用宏:IMGSENSOR_HW_ID_REGULATOR
其他引脚配置一般不变,cust_mt6771_camera.dtsi中的相机编号和这里的DEV_NO一一对应;
struct IMGSENSOR_HW_CFG imgsensor_custom_config[] = {
{
IMGSENSOR_SENSOR_IDX_MAIN,
IMGSENSOR_I2C_DEV_0,
{
{IMGSENSOR_HW_PIN_MCLK, IMGSENSOR_HW_ID_MCLK},
{IMGSENSOR_HW_PIN_AVDD, IMGSENSOR_HW_ID_GPIO},
{IMGSENSOR_HW_PIN_DOVDD, IMGSENSOR_HW_ID_REGULATOR},
{IMGSENSOR_HW_PIN_DVDD, IMGSENSOR_HW_ID_GPIO},
{IMGSENSOR_HW_PIN_PDN, IMGSENSOR_HW_ID_GPIO},
{IMGSENSOR_HW_PIN_RST, IMGSENSOR_HW_ID_GPIO},
{IMGSENSOR_HW_PIN_NONE, IMGSENSOR_HW_ID_NONE},
},
},
{
IMGSENSOR_SENSOR_IDX_SUB,
IMGSENSOR_I2C_DEV_1,
{
{IMGSENSOR_HW_PIN_MCLK, IMGSENSOR_HW_ID_MCLK},
{IMGSENSOR_HW_PIN_AVDD, IMGSENSOR_HW_ID_REGULATOR},
{IMGSENSOR_HW_PIN_DOVDD, IMGSENSOR_HW_ID_REGULATOR},
{IMGSENSOR_HW_PIN_DVDD, IMGSENSOR_HW_ID_REGULATOR},
{IMGSENSOR_HW_PIN_PDN, IMGSENSOR_HW_ID_GPIO},
{IMGSENSOR_HW_PIN_RST, IMGSENSOR_HW_ID_GPIO},
{IMGSENSOR_HW_PIN_NONE, IMGSENSOR_HW_ID_NONE},
},
},
{
IMGSENSOR_SENSOR_IDX_MAIN2,
IMGSENSOR_I2C_DEV_1,
{
......
},
},
{
IMGSENSOR_SENSOR_IDX_SUB2,
IMGSENSOR_I2C_DEV_1,
{
......
},
},
{
IMGSENSOR_SENSOR_IDX_MAIN3,
IMGSENSOR_I2C_DEV_1,
{
......
},
},
{IMGSENSOR_SENSOR_IDX_NONE}
};
|