leds: qpnp-flash-v2: Add support for qpnp-flash-v2 driver

QPNP Flash v2 LED driver supports the flash LED peripheral on
QTI PMICs like PMI8998, PM8150L and their derivatives to support
camera flash operation.

This is taken as a snapshot from msm-4.19 kernel
'commit 0873aa6e66d4 (" Merge "msm: ADSPRPC: Size check before
allocating memory from DMA")'.

Change-Id: If18cd60ba0e2ca2c463996e65216f02d21e6fd76
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
This commit is contained in:
Kiran Gunda 2020-07-24 20:48:58 +05:30
parent 6c24075f63
commit 40ccd6775f
5 changed files with 3289 additions and 0 deletions

View File

@ -247,6 +247,17 @@ config LEDS_QTI_FLASH
To compile this driver as a module, choose M here: the
module will be called leds-qti-flash.
config LEDS_QPNP_FLASH_V2
tristate "Support for QPNP V2 Flash LEDs"
depends on LEDS_CLASS && MFD_SPMI_PMIC
select LEDS_TRIGGERS
help
This driver supports the flash V2 LED functionality of Qualcomm
Technologies, Inc. QPNP PMICs. This driver supports PMICs starting
from PMI8998, PM8150L and their derivatives. It can configure the
flash LED target current for several independent channels. It also
supports various over current and over temperature mitigation features.
config LEDS_FSG
tristate "LED Support for the Freecom FSG-3"
depends on LEDS_CLASS

View File

@ -87,6 +87,7 @@ obj-$(CONFIG_LEDS_TI_LMU_COMMON) += leds-ti-lmu-common.o
obj-$(CONFIG_LEDS_LM3697) += leds-lm3697.o
obj-$(CONFIG_LEDS_LM36274) += leds-lm36274.o
obj-$(CONFIG_LEDS_QTI_TRI_LED) += leds-qti-tri-led.o
obj-$(CONFIG_LEDS_QPNP_FLASH_V2) += leds-qpnp-flash-v2.o
obj-$(CONFIG_LEDS_QPNP_VIBRATOR_LDO) += leds-qpnp-vibrator-ldo.o
# LED SPI Drivers

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016, 2020, The Linux Foundation. All rights reserved.
*/
#ifndef __LEDS_QPNP_FLASH_V2_H
#define __LEDS_QPNP_FLASH_V2_H
#include <linux/leds.h>
#include <linux/notifier.h>
enum flash_led_irq_type {
LED_FAULT_IRQ = BIT(0),
MITIGATION_IRQ = BIT(1),
FLASH_TIMER_EXP_IRQ = BIT(2),
ALL_RAMP_DOWN_DONE_IRQ = BIT(3),
ALL_RAMP_UP_DONE_IRQ = BIT(4),
LED3_RAMP_UP_DONE_IRQ = BIT(5),
LED2_RAMP_UP_DONE_IRQ = BIT(6),
LED1_RAMP_UP_DONE_IRQ = BIT(7),
INVALID_IRQ = BIT(8),
};
int qpnp_flash_led_register_irq_notifier(struct notifier_block *nb);
int qpnp_flash_led_unregister_irq_notifier(struct notifier_block *nb);
#endif

View File

@ -0,0 +1,42 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* 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 IS_ENABLED(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