android_kernel_motorola_sm6225/include/linux/leds-qpnp-flash.h
Kiran Gunda ca4866d756 leds: qpnp-flash: Introduce a "qpnp_flash_register_led_prepare"
Currently legacy "qpnp-flash-v2" and "qti-flash" drivers exposes an API
which needs to be called by the client drivers. The name of the APIs
are different in both flash drivers and both the drivers need to be
enabled in a single defconfig. To keep the client interface un-changed
introduce a function to which the individual flash drivers can register
their exposed APIs. Using this mechanism clients can use a common API
irrespective of the flash driver in use for that specific hardware.

Change-Id: I1ded3d4d9013c6f7f56e0a8952f4b45d20b07326
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2020-02-26 02:03:42 -08:00

42 lines
1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#ifndef __LEDS_QPNP_FLASH_H
#define __LEDS_QPNP_FLASH_H
#include <linux/leds.h>
#define ENABLE_REGULATOR BIT(0)
#define DISABLE_REGULATOR BIT(1)
#define QUERY_MAX_AVAIL_CURRENT BIT(2)
#define QUERY_MAX_CURRENT BIT(3)
#define FLASH_LED_PREPARE_OPTIONS_MASK GENMASK(3, 0)
int qpnp_flash_register_led_prepare(struct device *dev, void *data);
#if (defined CONFIG_LEDS_QTI_FLASH || defined CONFIG_LEDS_QPNP_FLASH_V2)
int qpnp_flash_led_prepare(struct led_trigger *trig, int options,
int *max_current);
#else
static inline int qpnp_flash_led_prepare(struct led_trigger *trig, int options,
int *max_current)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_BACKLIGHT_QCOM_SPMI_WLED
int wled_flash_led_prepare(struct led_trigger *trig, int options,
int *max_current);
#else
static inline int wled_flash_led_prepare(struct led_trigger *trig, int options,
int *max_current)
{
return -EINVAL;
}
#endif
#endif