From b2ea9ae60026bc569caaf552217eb4d19599b7f2 Mon Sep 17 00:00:00 2001 From: Kiran Gunda Date: Mon, 30 Mar 2020 21:02:32 +0530 Subject: [PATCH] leds: qti-flash: Update camera flash client interface options The value of "QUERY_MAX_AVAIL_CURRENT" option in the "leds-qti-flash" driver is different from the legacy "leds-qpnp-flash" driver. As a result, the led flash does not work. To fix this issue update the option values of "leds-qti-flash" to align with the legacy driver. Also add logic to handle other options "ENABLE_REGULATOR" and "DISABLE_REGULATOR" to have backward compatibility. Change-Id: I8213d53c6b19ccc8da74784e3b428b99fcebcbb7 Signed-off-by: Kiran Gunda --- drivers/leds/leds-qti-flash.c | 5 +++++ include/linux/leds-qti-flash.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-qti-flash.c b/drivers/leds/leds-qti-flash.c index 321f357ef378..551818fa2495 100644 --- a/drivers/leds/leds-qti-flash.c +++ b/drivers/leds/leds-qti-flash.c @@ -952,6 +952,11 @@ int qti_flash_led_prepare(struct led_trigger *trig, int options, snode = container_of(led_cdev, struct flash_switch_data, cdev); if (options & QUERY_MAX_AVAIL_CURRENT) { + if (!max_current) { + pr_err("Invalid max_current pointer\n"); + return -EINVAL; + } + rc = qti_flash_led_get_max_avail_current(snode->led, max_current); if (rc < 0) { diff --git a/include/linux/leds-qti-flash.h b/include/linux/leds-qti-flash.h index 898f30fde893..337ba0369f91 100644 --- a/include/linux/leds-qti-flash.h +++ b/include/linux/leds-qti-flash.h @@ -8,7 +8,9 @@ #include -#define QUERY_MAX_AVAIL_CURRENT BIT(0) +#define ENABLE_REGULATOR BIT(0) +#define DISABLE_REGULATOR BIT(1) +#define QUERY_MAX_AVAIL_CURRENT BIT(2) /** * struct flash_led_param: QTI flash LED parameter data