summaryrefslogtreecommitdiffstats
path: root/include/linux/leds.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/leds.h')
-rw-r--r--include/linux/leds.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 2bbe8a38fe39..d101fd13e18e 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -8,6 +8,7 @@
8#ifndef __LINUX_LEDS_H_INCLUDED 8#ifndef __LINUX_LEDS_H_INCLUDED
9#define __LINUX_LEDS_H_INCLUDED 9#define __LINUX_LEDS_H_INCLUDED
10 10
11#include <dt-bindings/leds/common.h>
11#include <linux/device.h> 12#include <linux/device.h>
12#include <linux/kernfs.h> 13#include <linux/kernfs.h>
13#include <linux/list.h> 14#include <linux/list.h>
@@ -33,6 +34,25 @@ enum led_brightness {
33struct led_init_data { 34struct led_init_data {
34 /* device fwnode handle */ 35 /* device fwnode handle */
35 struct fwnode_handle *fwnode; 36 struct fwnode_handle *fwnode;
37 /*
38 * default <color:function> tuple, for backward compatibility
39 * with in-driver hard-coded LED names used as a fallback when
40 * DT "label" property is absent; it should be set to NULL
41 * in new LED class drivers.
42 */
43 const char *default_label;
44 /*
45 * string to be used for devicename section of LED class device
46 * either for label based LED name composition path or for fwnode
47 * based when devname_mandatory is true
48 */
49 const char *devicename;
50 /*
51 * indicates if LED name should always comprise devicename section;
52 * only LEDs exposed by drivers of hot-pluggable devices should
53 * set it to true
54 */
55 bool devname_mandatory;
36}; 56};
37 57
38struct led_classdev { 58struct led_classdev {
@@ -258,6 +278,22 @@ extern void led_sysfs_disable(struct led_classdev *led_cdev);
258extern void led_sysfs_enable(struct led_classdev *led_cdev); 278extern void led_sysfs_enable(struct led_classdev *led_cdev);
259 279
260/** 280/**
281 * led_compose_name - compose LED class device name
282 * @dev: LED controller device object
283 * @child: child fwnode_handle describing a LED or a group of synchronized LEDs;
284 * it must be provided only for fwnode based LEDs
285 * @led_classdev_name: composed LED class device name
286 *
287 * Create LED class device name basing on the provided init_data argument.
288 * The name can have <devicename:color:function> or <color:function>.
289 * form, depending on the init_data configuration.
290 *
291 * Returns: 0 on success or negative error value on failure
292 */
293extern int led_compose_name(struct device *dev, struct led_init_data *init_data,
294 char *led_classdev_name);
295
296/**
261 * led_sysfs_is_disabled - check if LED sysfs interface is disabled 297 * led_sysfs_is_disabled - check if LED sysfs interface is disabled
262 * @led_cdev: the LED to query 298 * @led_cdev: the LED to query
263 * 299 *
@@ -434,6 +470,15 @@ struct led_platform_data {
434 struct led_info *leds; 470 struct led_info *leds;
435}; 471};
436 472
473struct led_properties {
474 u32 color;
475 bool color_present;
476 const char *function;
477 u32 func_enum;
478 bool func_enum_present;
479 const char *label;
480};
481
437struct gpio_desc; 482struct gpio_desc;
438typedef int (*gpio_blink_set_t)(struct gpio_desc *desc, int state, 483typedef int (*gpio_blink_set_t)(struct gpio_desc *desc, int state,
439 unsigned long *delay_on, 484 unsigned long *delay_on,