#ifndef __LINUX_LEDS_H_INCLUDED
#define __LINUX_LEDS_H_INCLUDED
#include <dt-bindings/leds/common.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/rwsem.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/types.h>
#include <linux/workqueue.h>
struct attribute_group;
struct device_node;
struct fwnode_handle;
struct gpio_desc;
struct kernfs_node;
struct led_pattern;
struct platform_device;
enum led_brightness { … };
enum led_default_state { … };
struct led_lookup_data { … };
struct led_init_data { … };
enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode);
struct led_hw_trigger_type { … };
struct led_classdev { … };
int led_classdev_register_ext(struct device *parent,
struct led_classdev *led_cdev,
struct led_init_data *init_data);
static inline int led_classdev_register(struct device *parent,
struct led_classdev *led_cdev)
{ … }
int devm_led_classdev_register_ext(struct device *parent,
struct led_classdev *led_cdev,
struct led_init_data *init_data);
static inline int devm_led_classdev_register(struct device *parent,
struct led_classdev *led_cdev)
{ … }
void led_classdev_unregister(struct led_classdev *led_cdev);
void devm_led_classdev_unregister(struct device *parent,
struct led_classdev *led_cdev);
void led_classdev_suspend(struct led_classdev *led_cdev);
void led_classdev_resume(struct led_classdev *led_cdev);
void led_add_lookup(struct led_lookup_data *led_lookup);
void led_remove_lookup(struct led_lookup_data *led_lookup);
struct led_classdev *__must_check led_get(struct device *dev, char *con_id);
struct led_classdev *__must_check devm_led_get(struct device *dev, char *con_id);
extern struct led_classdev *of_led_get(struct device_node *np, int index);
extern void led_put(struct led_classdev *led_cdev);
struct led_classdev *__must_check devm_of_led_get(struct device *dev,
int index);
struct led_classdev *__must_check devm_of_led_get_optional(struct device *dev,
int index);
void led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on,
unsigned long *delay_off);
void led_blink_set_nosleep(struct led_classdev *led_cdev, unsigned long delay_on,
unsigned long delay_off);
void led_blink_set_oneshot(struct led_classdev *led_cdev,
unsigned long *delay_on, unsigned long *delay_off,
int invert);
void led_set_brightness(struct led_classdev *led_cdev, unsigned int brightness);
int led_set_brightness_sync(struct led_classdev *led_cdev, unsigned int value);
void led_mc_set_brightness(struct led_classdev *led_cdev,
unsigned int *intensity_value, unsigned int num_colors,
unsigned int brightness);
int led_update_brightness(struct led_classdev *led_cdev);
u32 *led_get_default_pattern(struct led_classdev *led_cdev, unsigned int *size);
void led_sysfs_disable(struct led_classdev *led_cdev);
void led_sysfs_enable(struct led_classdev *led_cdev);
int led_compose_name(struct device *dev, struct led_init_data *init_data,
char *led_classdev_name);
const char *led_get_color_name(u8 color_id);
static inline bool led_sysfs_is_disabled(struct led_classdev *led_cdev)
{ … }
#define DEFINE_LED_TRIGGER(x) …
#define DEFINE_LED_TRIGGER_GLOBAL(x) …
#ifdef CONFIG_LEDS_TRIGGERS
#define TRIG_NAME_MAX …
struct led_trigger { … };
#define led_trigger_get_led(dev) …
#define led_trigger_get_drvdata(dev) …
int led_trigger_register(struct led_trigger *trigger);
void led_trigger_unregister(struct led_trigger *trigger);
int devm_led_trigger_register(struct device *dev,
struct led_trigger *trigger);
void led_trigger_register_simple(const char *name,
struct led_trigger **trigger);
void led_trigger_unregister_simple(struct led_trigger *trigger);
void led_trigger_event(struct led_trigger *trigger, enum led_brightness event);
void led_mc_trigger_event(struct led_trigger *trig,
unsigned int *intensity_value, unsigned int num_colors,
enum led_brightness brightness);
void led_trigger_blink(struct led_trigger *trigger, unsigned long delay_on,
unsigned long delay_off);
void led_trigger_blink_oneshot(struct led_trigger *trigger,
unsigned long delay_on,
unsigned long delay_off,
int invert);
void led_trigger_set_default(struct led_classdev *led_cdev);
int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger);
void led_trigger_remove(struct led_classdev *led_cdev);
static inline void led_set_trigger_data(struct led_classdev *led_cdev,
void *trigger_data)
{ … }
static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
{ … }
static inline enum led_brightness
led_trigger_get_brightness(const struct led_trigger *trigger)
{ … }
#define module_led_trigger(__led_trigger) …
#else
struct led_trigger {};
static inline void led_trigger_register_simple(const char *name,
struct led_trigger **trigger) {}
static inline void led_trigger_unregister_simple(struct led_trigger *trigger) {}
static inline void led_trigger_event(struct led_trigger *trigger,
enum led_brightness event) {}
static inline void led_mc_trigger_event(struct led_trigger *trig,
unsigned int *intensity_value, unsigned int num_colors,
enum led_brightness brightness) {}
static inline void led_trigger_blink(struct led_trigger *trigger,
unsigned long delay_on,
unsigned long delay_off) {}
static inline void led_trigger_blink_oneshot(struct led_trigger *trigger,
unsigned long delay_on,
unsigned long delay_off,
int invert) {}
static inline void led_trigger_set_default(struct led_classdev *led_cdev) {}
static inline int led_trigger_set(struct led_classdev *led_cdev,
struct led_trigger *trigger)
{
return 0;
}
static inline void led_trigger_remove(struct led_classdev *led_cdev) {}
static inline void led_set_trigger_data(struct led_classdev *led_cdev) {}
static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
{
return NULL;
}
static inline enum led_brightness
led_trigger_get_brightness(const struct led_trigger *trigger)
{
return LED_OFF;
}
#endif
enum led_trigger_netdev_modes { … };
#ifdef CONFIG_LEDS_TRIGGER_DISK
void ledtrig_disk_activity(bool write);
#else
static inline void ledtrig_disk_activity(bool write) {}
#endif
#ifdef CONFIG_LEDS_TRIGGER_MTD
void ledtrig_mtd_activity(void);
#else
static inline void ledtrig_mtd_activity(void) {}
#endif
#if defined(CONFIG_LEDS_TRIGGER_CAMERA) || defined(CONFIG_LEDS_TRIGGER_CAMERA_MODULE)
void ledtrig_flash_ctrl(bool on);
void ledtrig_torch_ctrl(bool on);
#else
static inline void ledtrig_flash_ctrl(bool on) {}
static inline void ledtrig_torch_ctrl(bool on) {}
#endif
struct led_info { … };
struct led_platform_data { … };
struct led_properties { … };
gpio_blink_set_t;
struct gpio_led { … };
#define LEDS_GPIO_DEFSTATE_OFF …
#define LEDS_GPIO_DEFSTATE_ON …
#define LEDS_GPIO_DEFSTATE_KEEP …
struct gpio_led_platform_data { … };
#ifdef CONFIG_LEDS_GPIO_REGISTER
struct platform_device *gpio_led_register_device(
int id, const struct gpio_led_platform_data *pdata);
#else
static inline struct platform_device *gpio_led_register_device(
int id, const struct gpio_led_platform_data *pdata)
{ … }
#endif
enum cpu_led_event { … };
#ifdef CONFIG_LEDS_TRIGGER_CPU
void ledtrig_cpu(enum cpu_led_event evt);
#else
static inline void ledtrig_cpu(enum cpu_led_event evt)
{
return;
}
#endif
#ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED
void led_classdev_notify_brightness_hw_changed(
struct led_classdev *led_cdev, unsigned int brightness);
#else
static inline void led_classdev_notify_brightness_hw_changed(
struct led_classdev *led_cdev, enum led_brightness brightness) { }
#endif
struct led_pattern { … };
enum led_audio { … };
#endif