8765平台如何区分前后摄电压不一致(以DVDD为例)可以参考思路
首先,8765pmu使用的是MT6357,camera电压dvdd,iovdd,avdd,af都是pmu供电,找到其pmu规格书,查到dvdd控制的电压pin对应的寄存器为
RG_VCAMD_VOSEL(一般是大写,直接搜vcamd),
搜索kernel/drivers/misc/mediatek/pmic/mt6357/v1/pmic_api.c (8765平台是在这,其他平台以此类推out编译中的pmic目录)
./kernel-4.4/drivers/misc/mediatek/pmic/mt6357/v1/pmic_api.c:49733:unsigned int mt6357_upmu_set_rg_vcamd_vosel(unsigned int val)
定义如下:
4’b0100: 1.0V
4’b0101: 1.1V
4’b0110: 1.2V
4’b0111: 1.3V
4’b1001: 1.5V
4’b1100: 1.8V
然后开始修改前后摄电压,轮询不同摄像头pin脚的时候去写pmic寄存器的方法:
ppwr_info->pin = 4的时候刚好是dvdd的电,enum枚举在:
enum IMGSENSOR_HW_PIN {
IMGSENSOR_HW_PIN_NONE = 0,
IMGSENSOR_HW_PIN_PDN,
IMGSENSOR_HW_PIN_RST,
IMGSENSOR_HW_PIN_AVDD,
IMGSENSOR_HW_PIN_DVDD,
IMGSENSOR_HW_PIN_DOVDD,
IMGSENSOR_HW_PIN_AFVDD,
#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
};
修改如下:
+++ b/kernel-4.4/drivers/misc/mediatek/imgsensor/src/common/v1/imgsensor_hw.c
@@ -20,6 +20,10 @@
#include “imgsensor_sensor.h”
#include “imgsensor_hw.h”
+extern unsigned int mt6357_upmu_set_rg_vcamd_vosel(unsigned int val);
+
+char curr_sensor_name_kzh[64];
+
char *imgsensor_sensor_idx_name[IMGSENSOR_SENSOR_IDX_MAX_NUM] = {
IMGSENSOR_SENSOR_IDX_NAME_MAIN,
@@ -108,14 +112,31 @@ static enum IMGSENSOR_RETURN imgsensor_hw_power_sequence(
if (pwr_status == IMGSENSOR_HW_POWER_STATUS_ON &&
ppwr_info->pin != IMGSENSOR_HW_PIN_UNDEF) {
pdev = phw->pdev[psensor_pwr->id[ppwr_info->pin]];
if (pdev->set != NULL){
pdev->set(pdev->pinstance,
sensor_idx,
ppwr_info->pin,
ppwr_info->pin_state_on);
}
if(((0 == sensor_idx )&& (ppwr_info->pin == 4))&& (0 == strcmp(“gc5025_mipi_raw”,curr_sensor_name_kzh))){
mt6357_upmu_set_rg_vcamd_vosel(0x09);
printk(“curr_sensor_name_kzh:%s 5025 kzhkzhkzh**********\n”,curr_sensor_name_kzh);
//return IMGSENSOR_RETURN_SUCCESS;
}else if(((1 == sensor_idx )&& (ppwr_info->pin == 4))&& (0 == strcmp(“gc2385_mipi_raw”,curr_sensor_name_kzh))){
mt6357_upmu_set_rg_vcamd_vosel(0x06);
printk(“curr_sensor_name_kzh:%s 2385 kzhkzhkzh**********\n”,curr_sensor_name_kzh);
//return IMGSENSOR_RETURN_SUCCESS;
}
mdelay(ppwr_info->pin_on_delay);
}
@@ -148,6 +169,8 @@ static enum IMGSENSOR_RETURN imgsensor_hw_power_sequence(
return IMGSENSOR_RETURN_SUCCESS;
}
enum IMGSENSOR_RETURN imgsensor_hw_power(
struct IMGSENSOR_HW *phw,
struct IMGSENSOR_SENSOR *psensor,
@@ -189,7 +212,8 @@ enum IMGSENSOR_RETURN imgsensor_hw_power(
#endif*/
imgsensor_hw_power_sequence(phw,
sensor_idx,
diff --git a/kernel-4.4/drivers/misc/mediatek/imgsensor/src/mt6739/camera_hw/imgsensor_cfg_table.c b/kernel-4.4/drivers/misc/mediatek/imgsensor/src/mt6739/camera_hw/imgsensor_cfg_table.c
index 1f20e0a…6268a7b 100755
— a/kernel-4.4/drivers/misc/mediatek/imgsensor/src/mt6739/camera_hw/imgsensor_cfg_table.c
+++ b/kernel-4.4/drivers/misc/mediatek/imgsensor/src/mt6739/camera_hw/imgsensor_cfg_table.c
@@ -134,7 +134,7 @@ struct IMGSENSOR_HW_POWER_SEQ sensor_power_sequence[] = {
{PDN, Vol_Low, 1},
{RST, Vol_Low, 10},
{AVDD, Vol_2800, 5},