summaryrefslogtreecommitdiff
path: root/include/linux/leds.h
diff options
context:
space:
mode:
authorMarek Behún <marek.behun@nic.cz>2020-07-16 20:17:28 +0300
committerPavel Machek <pavel@ucw.cz>2020-07-22 15:42:07 +0300
commit93690cdf3060c61dfce813121d0bfc055e7fa30d (patch)
treea5c79c9c4173a8b027d4a24a34100c91a0affb99 /include/linux/leds.h
parent00253ec2c9849c2a1101818565c7f4c09dbef327 (diff)
downloadlinux-93690cdf3060c61dfce813121d0bfc055e7fa30d.tar.xz
leds: trigger: add support for LED-private device triggers
Some LED controllers may come with an internal HW triggering mechanism for the LED and the ability to switch between SW control and the internal HW control. This includes most PHYs, various ethernet switches, the Turris Omnia LED controller or AXP20X PMIC. This adds support for registering such triggers. This code is based on work by Pavel Machek <pavel@ucw.cz> and Ondřej Jirman <megous@megous.com>. Signed-off-by: Marek Behún <marek.behun@nic.cz> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'include/linux/leds.h')
-rw-r--r--include/linux/leds.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 2451962d1ec5..6a8d6409c993 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -57,6 +57,10 @@ struct led_init_data {
bool devname_mandatory;
};
+struct led_hw_trigger_type {
+ int dummy;
+};
+
struct led_classdev {
const char *name;
enum led_brightness brightness;
@@ -141,6 +145,9 @@ struct led_classdev {
void *trigger_data;
/* true if activated - deactivate routine uses it to do cleanup */
bool activated;
+
+ /* LEDs that have private triggers have this set */
+ struct led_hw_trigger_type *trigger_type;
#endif
#ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED
@@ -345,6 +352,9 @@ struct led_trigger {
int (*activate)(struct led_classdev *led_cdev);
void (*deactivate)(struct led_classdev *led_cdev);
+ /* LED-private triggers have this set */
+ struct led_hw_trigger_type *trigger_type;
+
/* LEDs under control by this trigger (for simple triggers) */
rwlock_t leddev_list_lock;
struct list_head led_cdevs;