leds: qti-flash:Show MAX_FLASH_CURRENT_MA for no battery use case
Show max_avail_current to MAX_FLASH_CURRENT_MA when there is no battery power supply device available. Change-Id: I6a854509d0432cf4b234bbb39422ce0d3031913b Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
This commit is contained in:
parent
f852a8b67d
commit
a12988b252
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user