Path :kernel-3.18/arch/arm64/boot/dts/amt6797_64_open.dts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | camera_pins_cam_ldo_vcamd_0: cam0@vcamd0 { pins_cmd_dat { pins = <PINMUX_GPIO63__FUNC_GPIO63>; slew-rate = <1>; output-low; }; }; camera_pins_cam_ldo_vcamd_1: cam1@vcamd1 { pins_cmd_dat { pins = <PINMUX_GPIO63__FUNC_GPIO63>; slew-rate = <1>; output-high; }; }; &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", "cam_ldo_vcama_0", "cam_ldo_vcama_1", "cam_ldo_vcamd_0", "cam_ldo_vcamd_1", "cam_ldo_vcamd2_0", "cam_ldo_vcamd2_1"; pinctrl-0 = <&camera_pins_default>; pinctrl-1 = <&camera_pins_cam0_rst0>; pinctrl-2 = <&camera_pins_cam0_rst1>; pinctrl-3 = <&camera_pins_cam0_pnd0>; pinctrl-4 = <&camera_pins_cam0_pnd1>; pinctrl-5 = <&camera_pins_cam1_rst0>; pinctrl-6 = <&camera_pins_cam1_rst1>; pinctrl-7 = <&camera_pins_cam1_pnd0>; pinctrl-8 = <&camera_pins_cam1_pnd1>; /* for main2 */ pinctrl-9 = <&camera_pins_cam2_rst0>; pinctrl-10 = <&camera_pins_cam2_rst1>; pinctrl-11 = <&camera_pins_cam2_pnd0>; pinctrl-12 = <&camera_pins_cam2_pnd1>; /* for ldo control by gpio */ pinctrl-13 = <&camera_pins_cam_ldo_vcama_0>; pinctrl-14 = <&camera_pins_cam_ldo_vcama_1>; pinctrl-15 = <&camera_pins_cam_ldo_vcamd_0>; pinctrl-16 = <&camera_pins_cam_ldo_vcamd_1>; pinctrl-17 = <&camera_pins_cam_ldo_e2_vcamd_0>; pinctrl-18 = <&camera_pins_cam_ldo_e2_vcamd_1>; status = "okay"; }; |
Path :\kernel-3.18\drivers\misc\mediatek\imgsensor\src\mt6797\camera_hw
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | cam_ldo_vcamd_l = pinctrl_lookup_state(camctrl, "cam_ldo_vcamd_0"); if (pinSetIdx == 2) { if (PowerCustList.PowerCustInfo[CUST_MAIN2_AVDD].Gpio_Pin == GPIO_UNSUPPORTED) { if (TRUE != _hwPowerOn(pwInfo.PowerType, pwInfo.Voltage)) { PK_ERR("[CAMERA SENSOR] Fail to enable digital power\n"); return FALSE; } } else { if (mtkcam_gpio_set(pinSetIdx, MAIN2_AVDD, PowerCustList.PowerCustInfo[CUST_MAIN2_AVDD].Voltage)) { PK_INFO("[CAMERA CUST_AVDD] set gpio failed!!\n"); } } } case AVDD: case MAIN2_AVDD: /*Main & Main2 use same cotrol GPIO */ PK_DBG("mAVDD_usercounter(%d)\n",mAVDD_usercounter); if (Val == 0 && !IS_ERR(cam_ldo_vcama_l)){ mAVDD_usercounter --; if(mAVDD_usercounter <= 0) { if(mAVDD_usercounter < 0) PK_ERR("Please check AVDD pin control\n"); mAVDD_usercounter = 0; pinctrl_select_state(camctrl, cam_ldo_vcama_l); } } else if (Val == 1 && !IS_ERR(cam_ldo_vcama_h)){ mAVDD_usercounter ++; pinctrl_select_state(camctrl, cam_ldo_vcama_h); } break; PowerUp PowerOnList = { { {SENSOR_DRVNAME_OV23850_MIPI_RAW, { {SensorMCLK, Vol_High, 0}, {DOVDD, Vol_1800, 0}, {AVDD, Vol_2800, 0}, {DVDD, Vol_1200, 0}, {AFVDD, Vol_2800, 2}, {PDN, Vol_Low, 0}, {PDN, Vol_High, 0}, {RST, Vol_Low, 0}, {RST, Vol_High, 5}, }, }, |
4.1 PMIC
4.1.1 Use dct tools for customized
4.1.2 cust.dtsi was generated during
Compiling out/target/product/amt6797_64_open/obj/KERNEL_OBJ/arch/arm64/boot/dts/cust.dtsi
4.1.3 Kernel standard
– Regulator
- regulator_get()
– Get instance of regulator
– Called @ probe in kd_sensorlist.c
- regulator_set_voltage() & regulator_enable()
– Set voltage and enable among different regulator
– Called @_hwPowerOn() in kd_sensorlist.c
- regulator_disable()
– Turn off regulator
– Called @_hwPowerDown() in kd_sensorlist.c
Path:out/target/product/amt6797_64_open/obj/KERNEL_OBJ/arch/arm64/boot/dts/cust.dtsi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | &kd_camera_hw1 { vcama-supply = <&mt_pmic_vcama_ldo_reg>; vcama_main2-supply = <&mt_pmic_vcama_ldo_reg>; vcama_sub-supply = <&mt_pmic_vcama_ldo_reg>; vcamaf-supply = <&mt_pmic_vldo28_ldo_reg>; vcamaf_main2-supply = <&mt_pmic_vldo28_ldo_reg>; vcamaf_sub-supply = <&mt_pmic_vldo28_ldo_reg>; vcamd-supply = <&mt_pmic_vcamd_ldo_reg>; vcamd_main2-supply = <&mt_pmic_vcamd_ldo_reg>; vcamd_sub-supply = <&mt_pmic_vcamd_ldo_reg>; vcamio-supply = <&mt_pmic_vcamio_ldo_reg>; vcamio_main2-supply = <&mt_pmic_vcamio_ldo_reg>; vcamio_sub-supply = <&mt_pmic_vcamio_ldo_reg>; status = "okay"; }; |