include/linux/leds.h
Source file repositories/reference/linux-study-clean/include/linux/leds.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/leds.h- Extension
.h- Size
- 23988 bytes
- Lines
- 754
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dt-bindings/leds/common.hlinux/device.hlinux/mutex.hlinux/rwsem.hlinux/spinlock.hlinux/timer.hlinux/types.hlinux/workqueue.h
Detected Declarations
struct attribute_groupstruct device_nodestruct fwnode_handlestruct gpio_descstruct kernfs_nodestruct led_patternstruct platform_devicestruct led_lookup_datastruct led_init_datastruct led_hw_trigger_typestruct led_classdevstruct led_triggerstruct led_triggerstruct led_infostruct led_platform_datastruct led_propertiesstruct gpio_ledstruct gpio_led_platform_datastruct led_patternenum led_brightnessenum led_default_stateenum led_trigger_netdev_modesenum cpu_led_eventenum led_audiofunction led_classdev_registerfunction devm_led_classdev_registerfunction led_sysfs_is_disabledfunction led_set_trigger_datafunction led_trigger_get_brightnessfunction led_trigger_register_simplefunction led_trigger_removefunction led_trigger_get_brightnessfunction ledtrig_disk_activityfunction ledtrig_mtd_activityfunction ledtrig_flash_ctrlfunction ledtrig_backlight_blankfunction ledtrig_cpufunction led_classdev_notify_brightness_hw_changed
Annotated Snippet
struct led_lookup_data {
struct list_head list;
const char *provider;
const char *dev_id;
const char *con_id;
};
struct led_init_data {
/* device fwnode handle */
struct fwnode_handle *fwnode;
/*
* default <color:function> tuple, for backward compatibility
* with in-driver hard-coded LED names used as a fallback when
* DT "label" property is absent; it should be set to NULL
* in new LED class drivers.
*/
const char *default_label;
/*
* string to be used for devicename section of LED class device
* either for label based LED name composition path or for fwnode
* based when devname_mandatory is true
*/
const char *devicename;
/*
* indicates if LED name should always comprise devicename section;
* only LEDs exposed by drivers of hot-pluggable devices should
* set it to true
*/
bool devname_mandatory;
};
enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode);
struct led_hw_trigger_type {
int dummy;
};
struct led_classdev {
const char *name;
unsigned int brightness;
unsigned int max_brightness;
unsigned int color;
int flags;
/* Lower 16 bits reflect status */
#define LED_SUSPENDED BIT(0)
#define LED_UNREGISTERING BIT(1)
/* Upper 16 bits reflect control information */
#define LED_CORE_SUSPENDRESUME BIT(16)
#define LED_SYSFS_DISABLE BIT(17)
#define LED_DEV_CAP_FLASH BIT(18)
#define LED_HW_PLUGGABLE BIT(19)
#define LED_PANIC_INDICATOR BIT(20)
#define LED_BRIGHT_HW_CHANGED BIT(21)
#define LED_RETAIN_AT_SHUTDOWN BIT(22)
#define LED_INIT_DEFAULT_TRIGGER BIT(23)
#define LED_REJECT_NAME_CONFLICT BIT(24)
#define LED_MULTI_COLOR BIT(25)
/* set_brightness_work / blink_timer flags, atomic, private. */
unsigned long work_flags;
#define LED_BLINK_SW 0
#define LED_BLINK_ONESHOT 1
#define LED_BLINK_ONESHOT_STOP 2
#define LED_BLINK_INVERT 3
#define LED_BLINK_BRIGHTNESS_CHANGE 4
#define LED_BLINK_DISABLE 5
/* Brightness off also disables hw-blinking so it is a separate action */
#define LED_SET_BRIGHTNESS_OFF 6
#define LED_SET_BRIGHTNESS 7
#define LED_SET_BLINK 8
/* Set LED brightness level
* Must not sleep. Use brightness_set_blocking for drivers
* that can sleep while setting brightness.
*/
void (*brightness_set)(struct led_classdev *led_cdev,
enum led_brightness brightness);
/*
* Set LED brightness level immediately - it can block the caller for
* the time required for accessing a LED device register.
*/
int (*brightness_set_blocking)(struct led_classdev *led_cdev,
enum led_brightness brightness);
/* Get LED brightness level */
enum led_brightness (*brightness_get)(struct led_classdev *led_cdev);
/*
* Activate hardware accelerated blink, delays are in milliseconds
Annotation
- Immediate include surface: `dt-bindings/leds/common.h`, `linux/device.h`, `linux/mutex.h`, `linux/rwsem.h`, `linux/spinlock.h`, `linux/timer.h`, `linux/types.h`, `linux/workqueue.h`.
- Detected declarations: `struct attribute_group`, `struct device_node`, `struct fwnode_handle`, `struct gpio_desc`, `struct kernfs_node`, `struct led_pattern`, `struct platform_device`, `struct led_lookup_data`, `struct led_init_data`, `struct led_hw_trigger_type`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.