diff mbox series

[02/11] leds: add binding to check support for LED hw control

Message ID 20230427001541.18704-3-ansuelsmth@gmail.com
State New
Headers show
Series leds: introduce new LED hw control APIs | expand

Commit Message

Christian Marangi April 27, 2023, 12:15 a.m. UTC
Add 2 binding to facilitate checking support for LED hw control.

Add a mask for the LED driver to declare support for specific modes of
the defined hw control trigger.

Add hw_control_is_supported() to ask the LED driver if the requested
mode by the trigger are supported and the LED can be setup to follow
the requested modes.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 include/linux/leds.h | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/leds.h b/include/linux/leds.h
index b3bd1cc8ace8..06a67c62ed6e 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -157,6 +157,8 @@  struct led_classdev {
 
 	/* Unique trigger name supported by LED set in hw control mode */
 	const char		*hw_control_trigger;
+	/* Mask of the different supported trigger mode in hw control mode */
+	unsigned long		trigger_supported_flags_mask;
 	/*
 	 * Activate hardware control, LED driver will use the provided flags
 	 * from the supported trigger and setup the LED to be driven by hardware
@@ -174,6 +176,12 @@  struct led_classdev {
 	 */
 	int			(*hw_control_get)(struct led_classdev *led_cdev,
 						  unsigned long *flags);
+	/*
+	 * Check if the LED driver supports the requested mode provided by the
+	 * defined supported trigger to setup the LED to hw control mode.
+	 */
+	int			(*hw_control_is_supported)(struct led_classdev *led_cdev,
+							   unsigned long flags);
 #endif
 
 #ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED