Merge "leds: qti-flash:Show MAX_FLASH_CURRENT_MA for no battery use case"

This commit is contained in:
qctecmdr 2022-11-21 10:54:05 -08:00 committed by Gerrit - the friendly Code Review server
commit 1230185c62

View File

@ -938,6 +938,14 @@ static int qti_flash_led_calc_max_avail_current(
vph_flash_uv, vin_flash_uv, p_flash_fw;
union power_supply_propval prop = {};
if (!led->batt_psy)
led->batt_psy = power_supply_get_by_name("battery");
if (!led->batt_psy) {
*max_current_ma = MAX_FLASH_CURRENT_MA;
return 0;
}
rc = qti_battery_charger_get_prop("battery", BATTERY_RESISTANCE,
&rbatt_uohm);
if (rc < 0) {
@ -951,14 +959,6 @@ static int qti_flash_led_calc_max_avail_current(
return 0;
}
if (!led->batt_psy)
led->batt_psy = power_supply_get_by_name("battery");
if (!led->batt_psy) {
pr_err("Failed to get battery power supply, rc=%d\n", rc);
return -EINVAL;
}
rc = power_supply_get_property(led->batt_psy,
POWER_SUPPLY_PROP_VOLTAGE_OCV, &prop);
if (rc < 0) {