leds: leds-qti-flash: Add support for qcom,secure-vm

Currently, to calculate max_avail_current, parameters from battery power
supply are needed. These parameters are provided by battery_charger driver,
which on some platforms need to be obtained from charger FW. Add a new
property "qcom,secure-vm" which if specified for a secure VM would provide
a fixed max_avail_current to support camera SW requirements.

Change-Id: I7ac19765470406edf693a5ce92c499f2d7f81511
Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
This commit is contained in:
Anjelique Melendez 2021-11-22 11:41:28 -08:00 committed by David Collins
parent 5d3ac1aac3
commit 749dacbb8b

View File

@ -174,6 +174,8 @@ struct flash_switch_data {
* @module_en: Flag used to enable/disable flash LED module
* @trigger_lmh: Flag to enable lmh mitigation
* @non_all_mask_switch_present: Used in handling symmetry for all_mask switch
* @secure_vm: Flag indicating whether flash LED is used by
* secure VM
*/
struct qti_flash_led {
struct platform_device *pdev;
@ -198,6 +200,7 @@ struct qti_flash_led {
bool module_en;
bool trigger_lmh;
bool non_all_mask_switch_present;
bool secure_vm;
};
struct flash_current_headroom {
@ -1043,6 +1046,11 @@ static int qti_flash_led_get_max_avail_current(
{
int thermal_current_limit = 0, rc;
if (led->secure_vm) {
led->max_current = MAX_FLASH_CURRENT_MA;
return 0;
}
led->trigger_lmh = false;
rc = qti_flash_led_calc_max_avail_current(led, max_current_ma);
if (rc < 0) {
@ -1702,6 +1710,8 @@ static int qti_flash_led_register_device(struct qti_flash_led *led,
}
led->secure_vm = of_property_read_bool(node, "qcom,secure-vm");
led->all_ramp_up_done_irq = of_irq_get_byname(node,
"all-ramp-up-done-irq");
if (led->all_ramp_up_done_irq < 0)