1
0
Fork 0

Charger-init: Ignore CHG device com error, indicate with warning

Change charger-init sequence from returning/aborting on first error,
to continue trying complete sequence with warnings for each failed
config attempt.
zero-sugar
Steinar Bakkemo 2019-11-12 13:46:51 +01:00 committed by steinarbakkemo
parent a78cf97a13
commit 34504e436d
2 changed files with 17 additions and 11 deletions

View File

@ -141,6 +141,8 @@ int max77818_init_device()
ret = uclass_get_device_by_seq(UCLASS_I2C, MAX77818_I2C_BUS, &bus);
if (ret) {
printf("%s: Can't find I2C bus %d (expected for MAX77818)\n",
__func__, MAX77818_I2C_BUS);
return -1;
}
@ -155,7 +157,6 @@ int max77818_init_device()
if (ret) {
printf("%s: Can't find device id=0x%x, on bus %d\n",
__func__, MAX77818_CHARGER_I2C_ADDR, MAX77818_I2C_BUS);
return -1;
}
ret = dm_i2c_probe(bus, MAX77818_FG_I2C_ADDR, 0, &fgDev);

View File

@ -82,31 +82,36 @@ static int init_charger(void)
if (ret != 0)
return ret;
printf("Enabling SAFEOUT1\n");
ret = max77818_enable_safeout1();
if (ret != 0) {
printf("failed to enable SAFEOUT1 regulator: %d\n", ret);
return ret;
printf("%s: Failed to enable SAFEOUT1 regulator: %d\n",
__func__, ret);
}
printf("Setting fast charge current: 1.5A\n");
printf("Trying to set fast charge current: 1.5A\n");
ret = max77818_set_fast_charge_current(NULL, FASTCHARGE_1P5_A);
if (ret != 0)
return ret;
printf("%s Failed to set fast charger current\n",
__func__);
printf("Setting pogo input current limit: 1.5A\n");
printf("Trying to set pogo input current limit: 1.5A\n");
ret = max77818_set_pogo_input_current_limit(NULL, ILIM_1P5_A);
if (ret != 0)
return ret;
printf("%s: Failed to set pogo input current limit\n",
__func__);
printf("Setting USB-C input current limit: 1.2A\n");
printf("Trying to set USB-C input current limit: 1.2A\n");
ret = max77818_set_usbc_input_current_limit(NULL);
if (ret != 0)
return ret;
printf("%s: Failed to set USB-C input current limit\n",
__func__);
printf("Setting normal charge mode\n");
printf("Tryint to set normal charge mode (turn off OTG mode if set)\n");
ret = max77818_set_otg_pwr(NULL, false);
if (ret != 0)
return ret;
printf("%s: Failed to set normal charge mode\n",
__func__);
return 0;
}