The probability of sarsensor not being mounted
1.modify the problem of null pointer 2.PMIC supply 3.test result:pass the test results of 50 verifications of primary and secondary sar Change-Id: I94d4855ddcdb90ce9f8d2660f7d07f44b96aa14e Signed-off-by: tin_bingtai.zou_tmp <tinno60@motorola.com> Reviewed-on: https://gerrit.mot.com/2586600 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: <yangyi31@motorola.com> Reviewed-by: Yuchang Guo <guoyc1@lenovo.com> Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
1 parent
2a71b6e13c
commit
be0aa66192
1 file changed
+13
-14
@@ -18,6 +18,8 @@
|
|||||||
#define AW_SAR_CH_MAX (20)
|
#define AW_SAR_CH_MAX (20)
|
||||||
#define AW_POWER_ON_SYSFS_DELAY_MS (5000)
|
#define AW_POWER_ON_SYSFS_DELAY_MS (5000)
|
||||||
#define AW_SAR_OFFSET_LEN (15)
|
#define AW_SAR_OFFSET_LEN (15)
|
||||||
|
#define AW_SAR_VCC_MIN_UV (1700000)
|
||||||
|
#define AW_SAR_VCC_MAX_UV (3600000)
|
||||||
|
|
||||||
static struct mutex aw_sar_lock;
|
static struct mutex aw_sar_lock;
|
||||||
|
|
||||||
@@ -1569,12 +1571,10 @@ static int32_t aw_sar_regulator_power_init(struct aw_sar *p_sar)
|
|||||||
|
|
||||||
AWLOGD(p_sar->dev, "aw_sar power init enter");
|
AWLOGD(p_sar->dev, "aw_sar power init enter");
|
||||||
|
|
||||||
if (p_sar->p_sar_para->p_platform_config->p_regulator_config == NULL) {
|
// if (p_sar->p_sar_para->p_platform_config->p_regulator_config == NULL)
|
||||||
return AW_INVALID_PARA;
|
// return AW_INVALID_PARA;
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(vcc_name, sizeof(vcc_name), "%s%d",
|
snprintf(vcc_name, sizeof(vcc_name), "vcc%d",
|
||||||
p_sar->p_sar_para->p_platform_config->p_regulator_config->vcc_name,
|
|
||||||
p_sar->dts_info.sar_num);
|
p_sar->dts_info.sar_num);
|
||||||
AWLOGD(p_sar->dev, "vcc_name = %s", vcc_name);
|
AWLOGD(p_sar->dev, "vcc_name = %s", vcc_name);
|
||||||
|
|
||||||
@@ -1582,13 +1582,13 @@ static int32_t aw_sar_regulator_power_init(struct aw_sar *p_sar)
|
|||||||
if (IS_ERR(p_sar->vcc)) {
|
if (IS_ERR(p_sar->vcc)) {
|
||||||
rc = PTR_ERR(p_sar->vcc);
|
rc = PTR_ERR(p_sar->vcc);
|
||||||
AWLOGE(p_sar->dev, "regulator get failed vcc rc = %d", rc);
|
AWLOGE(p_sar->dev, "regulator get failed vcc rc = %d", rc);
|
||||||
return rc;
|
return AW_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regulator_count_voltages(p_sar->vcc) > 0) {
|
if (regulator_count_voltages(p_sar->vcc) > 0) {
|
||||||
rc = regulator_set_voltage(p_sar->vcc,
|
rc = regulator_set_voltage(p_sar->vcc,
|
||||||
p_sar->p_sar_para->p_platform_config->p_regulator_config->min_uV,
|
AW_SAR_VCC_MIN_UV,
|
||||||
p_sar->p_sar_para->p_platform_config->p_regulator_config->max_uV);
|
AW_SAR_VCC_MAX_UV);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
AWLOGE(p_sar->dev,
|
AWLOGE(p_sar->dev,
|
||||||
"regulator set vol failed rc = %d", rc);
|
"regulator set vol failed rc = %d", rc);
|
||||||
@@ -1596,11 +1596,11 @@ static int32_t aw_sar_regulator_power_init(struct aw_sar *p_sar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return AW_OK;
|
||||||
|
|
||||||
reg_vcc_put:
|
reg_vcc_put:
|
||||||
regulator_put(p_sar->vcc);
|
regulator_put(p_sar->vcc);
|
||||||
return rc;
|
return AW_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aw_sar_power_deinit(struct aw_sar *p_sar)
|
static void aw_sar_power_deinit(struct aw_sar *p_sar)
|
||||||
@@ -1650,7 +1650,7 @@ static int32_t regulator_is_get_voltage(struct aw_sar *p_sar)
|
|||||||
while(cnt--) {
|
while(cnt--) {
|
||||||
voltage_val = regulator_get_voltage(p_sar->vcc);
|
voltage_val = regulator_get_voltage(p_sar->vcc);
|
||||||
AWLOGD(p_sar->dev, "aw_sar voltage is : %d uv", voltage_val);
|
AWLOGD(p_sar->dev, "aw_sar voltage is : %d uv", voltage_val);
|
||||||
if (voltage_val >= p_sar->p_sar_para->p_platform_config->p_regulator_config->min_uV) {
|
if (voltage_val >= AW_SAR_VCC_MIN_UV){
|
||||||
return AW_OK;
|
return AW_OK;
|
||||||
}
|
}
|
||||||
mdelay(1);
|
mdelay(1);
|
||||||
@@ -1936,11 +1936,10 @@ static int32_t aw_sar_regulator_power(struct aw_sar *p_sar)
|
|||||||
//Configure the use of regulator power supply in DTS
|
//Configure the use of regulator power supply in DTS
|
||||||
if (p_sar->dts_info.use_regulator_flag == true) {
|
if (p_sar->dts_info.use_regulator_flag == true) {
|
||||||
ret = aw_sar_regulator_power_init(p_sar);
|
ret = aw_sar_regulator_power_init(p_sar);
|
||||||
if (ret) {
|
if (ret != AW_OK)
|
||||||
AWLOGE(p_sar->dev, "power init failed");
|
AWLOGE(p_sar->dev, "power init failed");
|
||||||
} else {
|
else
|
||||||
aw_sar_power_enable(p_sar, AW_TRUE);
|
aw_sar_power_enable(p_sar, AW_TRUE);
|
||||||
}
|
|
||||||
ret = regulator_is_get_voltage(p_sar);
|
ret = regulator_is_get_voltage(p_sar);
|
||||||
if (ret != AW_OK) {
|
if (ret != AW_OK) {
|
||||||
AWLOGE(p_sar->dev, "get_voltage failed");
|
AWLOGE(p_sar->dev, "get_voltage failed");
|
||||||
|
|||||||
Reference in new issue
Block a user