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 <kgunda@codeaurora.org>
This commit is contained in:
Kiran Gunda 2020-03-30 21:02:32 +05:30
parent 50fddb39ba
commit 9d40c7c2d9
2 changed files with 14 additions and 1 deletions

View file

@ -601,10 +601,20 @@ 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;
}
*max_current = snode->led->max_current;
return 0;
}
if (options & ENABLE_REGULATOR)
return 0;
if (options & DISABLE_REGULATOR)
return 0;
return -EINVAL;
}
EXPORT_SYMBOL(qti_flash_led_prepare);

View file

@ -8,7 +8,10 @@
#include <linux/leds.h>
#define QUERY_MAX_AVAIL_CURRENT BIT(0)
#define ENABLE_REGULATOR BIT(0)
#define DISABLE_REGULATOR BIT(1)
#define QUERY_MAX_AVAIL_CURRENT BIT(2)
#define QUERY_MAX_CURRENT BIT(3)
int qpnp_flash_register_led_prepare(struct device *dev, void *data);