]> git.baikalelectronics.ru Git - kernel.git/commit
leds: class: Add new optional brightness_hw_changed attribute
authorHans de Goede <hdegoede@redhat.com>
Sun, 29 Jan 2017 13:42:52 +0000 (14:42 +0100)
committerDarren Hart <dvhart@linux.intel.com>
Sat, 25 Feb 2017 07:48:50 +0000 (23:48 -0800)
commitb8701947039cee98cdc2e856da1693329d30ad3a
tree08b7e9ce151ee23f444d2b3495b4021c73a79fcd
parent6a6abb8821acde33f1732248dedcf0145d8be84f
leds: class: Add new optional brightness_hw_changed attribute

Some LEDs may have their brightness level changed autonomously
(outside of kernel control) by hardware / firmware. This commit
adds support for an optional brightness_hw_changed attribute to
signal such changes to userspace (if a driver can detect them):

What: /sys/class/leds/<led>/brightness_hw_changed
Date: January 2017
KernelVersion: 4.11
Description:
Last hardware set brightness level for this LED. Some LEDs
may be changed autonomously by hardware/firmware. Only LEDs
where this happens and the driver can detect this, will
have this file.

This file supports poll() to detect when the hardware
changes the brightness.

Reading this file will return the last brightness level set
by the hardware, this may be different from the current
brightness.

Drivers which want to support this, simply add LED_BRIGHT_HW_CHANGED to
their flags field and call led_classdev_notify_brightness_hw_changed()
with the hardware set brightness when they detect a hardware / firmware
triggered brightness change.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Documentation/ABI/testing/sysfs-class-led
Documentation/leds/leds-class.txt
drivers/leds/Kconfig
drivers/leds/led-class.c
include/linux/leds.h