[MTK] Android Q 新增一组Regulator的方法
文摘 MediaTek 2020-05-7 阅读:8119[DESCRIPTION]
平台默认写了三组regulator的pin,假设需要更多的regulator电源,请按照Solution修改code.
31 struct REGULATOR_CTRL regulator_control[REGULATOR_TYPE_MAX_NUM] = {
32 {"vcama"},
33 {"vcamd"},
34 {"vcamio"},
35 };
[SOLUTION]
以需要新增一个vcamio_1p8为例.
注意:
1、新添加的内容一定要放在中间的位置,不要在最前面也不要在最后面添加。
2、所有添加的位置切记顺序要保持一致。
3、即使只需要添加一组regulator,也要同步修改到gpio.c和gpio.h
kernel-4.*\drivers\misc\mediatek\imgsensor\src\mt6***\camera_hw\gpio\gpio.c
struct GPIO_PINCTRL gpio_pinctrl_list_cam[
GPIO_CTRL_STATE_MAX_NUM_CAM] = {
/* Main */
{"pnd1"},
{"pnd0"},
{"rst1"},
{"rst0"},
{"ldo_vcama_1"},
{"ldo_vcama_0"},
+{"ldo_vcamio_1p8_1"}, //add
+{"ldo_vcamio_1p8_0"}, //add
{"ldo_vcamd_1"},
{"ldo_vcamd_0"},
{"ldo_vcamio_1"},
{"ldo_vcamio_0"},
};
kernel-4.*\drivers\misc\mediatek\imgsensor\src\mt6***camera_hw\gpio\gpio.h
enum GPIO_CTRL_STATE_CAM {
/* Main */
GPIO_CTRL_STATE_PDN_H,
GPIO_CTRL_STATE_PDN_L,
GPIO_CTRL_STATE_RST_H,
GPIO_CTRL_STATE_RST_L,
GPIO_CTRL_STATE_LDO_VCAMA_H,
GPIO_CTRL_STATE_LDO_VCAMA_L,
+GPIO_CTRL_STATE_LDO_VCAMIO_1P8_H, //add
+GPIO_CTRL_STATE_LDO_VCAMIO_1P8_L, //add
GPIO_CTRL_STATE_LDO_VCAMD_H,
GPIO_CTRL_STATE_LDO_VCAMD_L,
GPIO_CTRL_STATE_LDO_VCAMIO_H,
GPIO_CTRL_STATE_LDO_VCAMIO_L,
GPIO_CTRL_STATE_MAX_NUM_CAM,
};
kernel-4.**\drivers\misc\mediatek\imgsensor\src\mt6***\camera_hw\imgsensor_cfg_table.c
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_1P8, IMGSENSOR_HW_ID_REGULATOR}, //add
{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},
},
},
#if defined(*****_MIPI_RAW)
{
SENSOR_DRVNAME_*****_MIPI_RAW,
{
{RST, Vol_Low, 1},
{AVDD, Vol_2900, 0},
{DVDD, Vol_1100, 0},
+{DOVDD_1P8, Vol_1800, 1}, //add
{SensorMCLK, Vol_High, 1},
{RST, Vol_High, 1}
},
},
kernel-4.**\drivers\misc\mediatek\imgsensor\src\mt6***\camera_hw\imgsensor_cfg_table.h
enum IMGSENSOR_HW_PIN {
IMGSENSOR_HW_PIN_NONE = 0,
IMGSENSOR_HW_PIN_PDN,
IMGSENSOR_HW_PIN_RST,
IMGSENSOR_HW_PIN_AVDD,
+IMGSENSOR_HW_PIN_DOVDD_1P8, //add
IMGSENSOR_HW_PIN_DVDD,
IMGSENSOR_HW_PIN_DOVDD,
#ifdef MIPI_SWITCH
IMGSENSOR_HW_PIN_MIPI_SWITCH_EN,
IMGSENSOR_HW_PIN_MIPI_SWITCH_SEL,
#endif
IMGSENSOR_HW_PIN_MCLK,
IMGSENSOR_HW_PIN_MAX_NUM,
IMGSENSOR_HW_PIN_UNDEF = -1
};
kernel-4.**\drivers\misc\mediatek\imgsensor\src\mt6*\camera_hw\regulator\regulator.c
struct REGULATOR_CTRL regulator_control[REGULATOR_TYPE_MAX_NUM] = {
{"vcama"},
+{"vcamio_1p8"}, //add
{"vcamd"},
{"vcamio"},
};
kernel-4.**\drivers\misc\mediatek\imgsensor\src\mt6***\camera_hw\regulator\regulator.h
enum REGULATOR_TYPE {
REGULATOR_TYPE_VCAMA,
+REGULATOR_TYPE_VCAMIO_1P8, //add
REGULATOR_TYPE_VCAMD,
REGULATOR_TYPE_VCAMIO,
REGULATOR_TYPE_MAX_NUM
};
kernel-4.14\arch\arm64\boot\dts\mediatek\cust_mt6***_camera.dtsi
+cam0_vcamio_1p8-supply = <&mt_pmic_vcamio_ldo_reg>; //add