Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02e86bbf authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "leds: qpnp-flash: Introduce a function pointer for qpnp_flash_led_prepare"

parents 3c6f4dc7 bf1e6c0a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -73,8 +73,8 @@ obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o
obj-$(CONFIG_LEDS_PM8058)		+= leds-pm8058.o
obj-$(CONFIG_LEDS_MLXCPLD)		+= leds-mlxcpld.o
obj-$(CONFIG_LEDS_QPNP)			+= leds-qpnp.o
obj-$(CONFIG_LEDS_QPNP_FLASH)		+= leds-qpnp-flash.o
obj-$(CONFIG_LEDS_QPNP_FLASH_V2)	+= leds-qpnp-flash-v2.o
obj-$(CONFIG_LEDS_QPNP_FLASH)		+= leds-qpnp-flash.o leds-qpnp-flash-common.o
obj-$(CONFIG_LEDS_QPNP_FLASH_V2)	+= leds-qpnp-flash-v2.o leds-qpnp-flash-common.o
obj-$(CONFIG_LEDS_QPNP_WLED)		+= leds-qpnp-wled.o
obj-$(CONFIG_LEDS_QPNP_HAPTICS)	+= leds-qpnp-haptics.o
obj-$(CONFIG_LEDS_QPNP_VIBRATOR_LDO)	+= leds-qpnp-vibrator-ldo.o
+16 −0
Original line number Diff line number Diff line
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/leds-qpnp-flash.h>

int (*qpnp_flash_led_prepare)(struct led_trigger *trig, int options,
					int *max_current);
+2 −1
Original line number Diff line number Diff line
@@ -1216,7 +1216,7 @@ static int qpnp_flash_led_switch_set(struct flash_switch_data *snode, bool on)
	return 0;
}

int qpnp_flash_led_prepare(struct led_trigger *trig, int options,
static int qpnp_flash_led_prepare_v2(struct led_trigger *trig, int options,
					int *max_current)
{
	struct led_classdev *led_cdev;
@@ -2217,6 +2217,7 @@ static int qpnp_flash_led_probe(struct platform_device *pdev)
	if (!led->pdata)
		return -ENOMEM;

	qpnp_flash_led_prepare = qpnp_flash_led_prepare_v2;
	rc = qpnp_flash_led_parse_common_dt(led, node);
	if (rc < 0) {
		pr_err("Failed to parse common flash LED device tree\n");
+3 −2
Original line number Diff line number Diff line
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1207,7 +1207,7 @@ static int flash_regulator_enable(struct qpnp_flash_led *led,
	return rc;
}

int qpnp_flash_led_prepare(struct led_trigger *trig, int options,
static int qpnp_flash_led_prepare_v1(struct led_trigger *trig, int options,
					int *max_current)
{
	struct led_classdev *led_cdev = trigger_to_lcdev(trig);
@@ -2468,6 +2468,7 @@ static int qpnp_flash_led_probe(struct platform_device *pdev)
	led->pdev = pdev;
	led->current_addr = FLASH_LED0_CURRENT(led->base);
	led->current2_addr = FLASH_LED1_CURRENT(led->base);
	qpnp_flash_led_prepare = qpnp_flash_led_prepare_v1;

	led->pdata = devm_kzalloc(&pdev->dev, sizeof(*led->pdata), GFP_KERNEL);
	if (!led->pdata)
+10 −3
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -21,7 +21,14 @@

#define FLASH_LED_PREPARE_OPTIONS_MASK	GENMASK(3, 0)

int qpnp_flash_led_prepare(struct led_trigger *trig, int options,
#if (defined CONFIG_LEDS_QPNP_FLASH || defined CONFIG_LEDS_QPNP_FLASH_V2)
extern 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
#endif