ksphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget#/translations/zh_CN/leds/leds-classmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/zh_TW/leds/leds-classmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/it_IT/leds/leds-classmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/ja_JP/leds/leds-classmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/ko_KR/leds/leds-classmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/pt_BR/leds/leds-classmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/sp_SP/leds/leds-classmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hLED handling under Linuxh]hLED handling under Linux}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhh=/var/lib/git/docbuild/linux/Documentation/leds/leds-class.rsthKubh paragraph)}(hX|In its simplest form, the LED class just allows control of LEDs from userspace. LEDs appear in /sys/class/leds/. The maximum brightness of the LED is defined in max_brightness file. The brightness file will set the brightness of the LED (taking a value 0-max_brightness). Most LEDs don't have hardware brightness support so will just be turned on for non-zero brightness settings.h]hX~In its simplest form, the LED class just allows control of LEDs from userspace. LEDs appear in /sys/class/leds/. The maximum brightness of the LED is defined in max_brightness file. The brightness file will set the brightness of the LED (taking a value 0-max_brightness). Most LEDs don’t have hardware brightness support so will just be turned on for non-zero brightness settings.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXThe class also introduces the optional concept of an LED trigger. A trigger is a kernel based source of led events. Triggers can either be simple or complex. A simple trigger isn't configurable and is designed to slot into existing subsystems with minimal additional code. Examples are the disk-activity, nand-disk and sharpsl-charge triggers. With led triggers disabled, the code optimises away.h]hXThe class also introduces the optional concept of an LED trigger. A trigger is a kernel based source of led events. Triggers can either be simple or complex. A simple trigger isn’t configurable and is designed to slot into existing subsystems with minimal additional code. Examples are the disk-activity, nand-disk and sharpsl-charge triggers. With led triggers disabled, the code optimises away.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hX Complex triggers while available to all LEDs have LED specific parameters and work on a per LED basis. The timer trigger is an example. The timer trigger will periodically change the LED brightness between LED_OFF and the current brightness setting. The "on" and "off" time can be specified via /sys/class/leds//delay_{on,off} in milliseconds. You can change the brightness value of a LED independently of the timer trigger. However, if you set the brightness value to LED_OFF it will also disable the timer trigger.h]hXComplex triggers while available to all LEDs have LED specific parameters and work on a per LED basis. The timer trigger is an example. The timer trigger will periodically change the LED brightness between LED_OFF and the current brightness setting. The “on” and “off” time can be specified via /sys/class/leds//delay_{on,off} in milliseconds. You can change the brightness value of a LED independently of the timer trigger. However, if you set the brightness value to LED_OFF it will also disable the timer trigger.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hYou can change triggers in a similar manner to the way an IO scheduler is chosen (via /sys/class/leds//trigger). Trigger specific parameters can appear in /sys/class/leds/ once a given trigger is selected.h]hYou can change triggers in a similar manner to the way an IO scheduler is chosen (via /sys/class/leds//trigger). Trigger specific parameters can appear in /sys/class/leds/ once a given trigger is selected.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hDesign Philosophyh]hDesign Philosophy}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK"ubh)}(hThe underlying design philosophy is simplicity. LEDs are simple devices and the aim is to keep a small amount of code giving as much functionality as possible. Please keep this in mind when suggesting enhancements.h]hThe underlying design philosophy is simplicity. LEDs are simple devices and the aim is to keep a small amount of code giving as much functionality as possible. Please keep this in mind when suggesting enhancements.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hjhhubeh}(h]design-philosophyah ]h"]design philosophyah$]h&]uh1hhhhhhhhK"ubh)}(hhh](h)}(hLED Device Namingh]hLED Device Naming}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj,hhhhhK*ubh)}(hIs currently of the form:h]hIs currently of the form:}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK,hj,hhubh block_quote)}(h"devicename:color:function" h]h)}(h"devicename:color:function"h]h“devicename:color:function”}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjMubah}(h]h ]h"]h$]h&]uh1jKhhhK.hj,hhubh bullet_list)}(hhh](h list_item)}(hXdevicename: it should refer to a unique identifier created by the kernel, like e.g. phyN for network devices or inputN for input devices, rather than to the hardware; the information related to the product and the bus to which given device is hooked is available in sysfs and can be retrieved using get_led_device_info.sh script from tools/leds; generally this section is expected mostly for LEDs that are somehow associated with other devices. h]hdefinition_list)}(hhh]hdefinition_list_item)}(hXdevicename: it should refer to a unique identifier created by the kernel, like e.g. phyN for network devices or inputN for input devices, rather than to the hardware; the information related to the product and the bus to which given device is hooked is available in sysfs and can be retrieved using get_led_device_info.sh script from tools/leds; generally this section is expected mostly for LEDs that are somehow associated with other devices. h](hterm)}(h devicename:h]h devicename:}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1j{hhhK7hjwubh definition)}(hhh]h)}(hXit should refer to a unique identifier created by the kernel, like e.g. phyN for network devices or inputN for input devices, rather than to the hardware; the information related to the product and the bus to which given device is hooked is available in sysfs and can be retrieved using get_led_device_info.sh script from tools/leds; generally this section is expected mostly for LEDs that are somehow associated with other devices.h]hXit should refer to a unique identifier created by the kernel, like e.g. phyN for network devices or inputN for input devices, rather than to the hardware; the information related to the product and the bus to which given device is hooked is available in sysfs and can be retrieved using get_led_device_info.sh script from tools/leds; generally this section is expected mostly for LEDs that are somehow associated with other devices.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hjubah}(h]h ]h"]h$]h&]uh1jhjwubeh}(h]h ]h"]h$]h&]uh1juhhhK7hjrubah}(h]h ]h"]h$]h&]uh1jphjlubah}(h]h ]h"]h$]h&]uh1jjhjghhhNhNubjk)}(hhcolor: one of LED_COLOR_ID_* definitions from the header include/dt-bindings/leds/common.h. h]jq)}(hhh]jv)}(h\color: one of LED_COLOR_ID_* definitions from the header include/dt-bindings/leds/common.h. h](j|)}(hcolor:h]hcolor:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j{hhhK;hjubj)}(hhh]h)}(hTone of LED_COLOR_ID_* definitions from the header include/dt-bindings/leds/common.h.h]hTone of LED_COLOR_ID_* definitions from the header include/dt-bindings/leds/common.h.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1juhhhK;hjubah}(h]h ]h"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]uh1jjhjghhhNhNubjk)}(hkfunction: one of LED_FUNCTION_* definitions from the header include/dt-bindings/leds/common.h. h]jq)}(hhh]jv)}(h_function: one of LED_FUNCTION_* definitions from the header include/dt-bindings/leds/common.h. h](j|)}(h function:h]h function:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j{hhhK?hjubj)}(hhh]h)}(hTone of LED_FUNCTION_* definitions from the header include/dt-bindings/leds/common.h.h]hTone of LED_FUNCTION_* definitions from the header include/dt-bindings/leds/common.h.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK>hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1juhhhK?hjubah}(h]h ]h"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]uh1jjhjghhhNhNubeh}(h]h ]h"]h$]h&]bullet-uh1jehhhK0hj,hhubh)}(h^If required color or function is missing, please submit a patch to linux-leds@vger.kernel.org.h](hCIf required color or function is missing, please submit a patch to }(hjBhhhNhNubh reference)}(hlinux-leds@vger.kernel.orgh]hlinux-leds@vger.kernel.org}(hjLhhhNhNubah}(h]h ]h"]h$]h&]refuri!mailto:linux-leds@vger.kernel.orguh1jJhjBubh.}(hjBhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKAhj,hhubh)}(hXIt is possible that more than one LED with the same color and function will be required for given platform, differing only with an ordinal number. In this case it is preferable to just concatenate the predefined LED_FUNCTION_* name with required "-N" suffix in the driver. fwnode based drivers can use function-enumerator property for that and then the concatenation will be handled automatically by the LED core upon LED class device registration.h]hXIt is possible that more than one LED with the same color and function will be required for given platform, differing only with an ordinal number. In this case it is preferable to just concatenate the predefined LED_FUNCTION_* name with required “-N” suffix in the driver. fwnode based drivers can use function-enumerator property for that and then the concatenation will be handled automatically by the LED core upon LED class device registration.}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhj,hhubh)}(hX)LED subsystem has also a protection against name clash, that may occur when LED class device is created by a driver of hot-pluggable device and it doesn't provide unique devicename section. In this case numerical suffix (e.g. "_1", "_2", "_3" etc.) is added to the requested LED class device name.h]hX7LED subsystem has also a protection against name clash, that may occur when LED class device is created by a driver of hot-pluggable device and it doesn’t provide unique devicename section. In this case numerical suffix (e.g. “_1”, “_2”, “_3” etc.) is added to the requested LED class device name.}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhj,hhubh)}(hXThere might be still LED class drivers around using vendor or product name for devicename, but this approach is now deprecated as it doesn't convey any added value. Product information can be found in other places in sysfs (see tools/leds/get_led_device_info.sh).h]hX There might be still LED class drivers around using vendor or product name for devicename, but this approach is now deprecated as it doesn’t convey any added value. Product information can be found in other places in sysfs (see tools/leds/get_led_device_info.sh).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKQhj,hhubh)}(hExamples of proper LED names:h]hExamples of proper LED names:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhj,hhubjL)}(h- "red:disk" - "white:flash" - "red:indicator" - "phy1:green:wlan" - "phy3::wlan" - ":kbd_backlight" - "input5::kbd_backlight" - "input3::numlock" - "input3::scrolllock" - "input3::capslock" - "mmc1::status" - "white:status" h]jf)}(hhh](jk)}(h "red:disk"h]h)}(hjh]h“red:disk”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKXhjubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h "white:flash"h]h)}(hjh]h“white:flash”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKYhjubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h"red:indicator"h]h)}(hjh]h“red:indicator”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKZhjubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h"phy1:green:wlan"h]h)}(hjh]h“phy1:green:wlan”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h "phy3::wlan"h]h)}(hjh]h“phy3::wlan”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hjubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h":kbd_backlight"h]h)}(hjh]h“:kbd_backlight”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK]hjubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h"input5::kbd_backlight"h]h)}(hj1h]h“input5::kbd_backlight”}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK^hj/ubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h"input3::numlock"h]h)}(hjHh]h“input3::numlock”}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK_hjFubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h"input3::scrolllock"h]h)}(hj_h]h“input3::scrolllock”}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK`hj]ubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h"input3::capslock"h]h)}(hjvh]h“input3::capslock”}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKahjtubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h"mmc1::status"h]h)}(hjh]h“mmc1::status”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhjubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h"white:status" h]h)}(h"white:status"h]h“white:status”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKchjubah}(h]h ]h"]h$]h&]uh1jjhjubeh}(h]h ]h"]h$]h&]j@jAuh1jehhhKXhjubah}(h]h ]h"]h$]h&]uh1jKhhhKXhj,hhubh)}(hXdget_led_device_info.sh script can be used for verifying if the LED name meets the requirements pointed out here. It performs validation of the LED class devicename sections and gives hints on expected value for a section in case the validation fails for it. So far the script supports validation of associations between LEDs and following types of devices:h]hXdget_led_device_info.sh script can be used for verifying if the LED name meets the requirements pointed out here. It performs validation of the LED class devicename sections and gives hints on expected value for a section in case the validation fails for it. So far the script supports validation of associations between LEDs and following types of devices:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKehj,hhubjL)}(h2- input devices - ieee80211 compliant USB devices h]jf)}(hhh](jk)}(h input devicesh]h)}(hjh]h input devices}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKkhjubah}(h]h ]h"]h$]h&]uh1jjhjubjk)}(h ieee80211 compliant USB devices h]h)}(hieee80211 compliant USB devicesh]hieee80211 compliant USB devices}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKlhjubah}(h]h ]h"]h$]h&]uh1jjhjubeh}(h]h ]h"]h$]h&]j@jAuh1jehhhKkhjubah}(h]h ]h"]h$]h&]uh1jKhhhKkhj,hhubh)}(h!The script is open to extensions.h]h!The script is open to extensions.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhj,hhubh)}(hXdThere have been calls for LED properties such as color to be exported as individual led class attributes. As a solution which doesn't incur as much overhead, I suggest these become part of the device name. The naming scheme above leaves scope for further attributes should they be needed. If sections of the name don't apply, just leave that section blank.h]hXhThere have been calls for LED properties such as color to be exported as individual led class attributes. As a solution which doesn’t incur as much overhead, I suggest these become part of the device name. The naming scheme above leaves scope for further attributes should they be needed. If sections of the name don’t apply, just leave that section blank.}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKphj,hhubeh}(h]led-device-namingah ]h"]led device namingah$]h&]uh1hhhhhhhhK*ubh)}(hhh](h)}(h,Keyboard backlight control LED Device Namingh]h,Keyboard backlight control LED Device Naming}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj:hhhhhKxubh)}(hXXFor backlit keyboards with a single brightness / color settings a single (multicolor) LED class device should be used to allow userspace to change the backlight brightness (and if possible the color). This LED class device must use "kbd_backlight" for the function part of the LED class device name. IOW the name must end with ":kbd_backlight".h]hX`For backlit keyboards with a single brightness / color settings a single (multicolor) LED class device should be used to allow userspace to change the backlight brightness (and if possible the color). This LED class device must use “kbd_backlight” for the function part of the LED class device name. IOW the name must end with “:kbd_backlight”.}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKzhj:hhubh)}(hFor backlit keyboards with multiple control zones, one (multicolor) LED class device should be used per zone. These LED class devices' name must follow:h]hFor backlit keyboards with multiple control zones, one (multicolor) LED class device should be used per zone. These LED class devices’ name must follow:}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubjL)}(h7"::kbd_zoned_backlight-" h]h)}(h6"::kbd_zoned_backlight-"h]h:“::kbd_zoned_backlight-”}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjgubah}(h]h ]h"]h$]h&]uh1jKhhhKhj:hhubh)}(hEand must be the same for all zones of the same keyboard.h]hEand must be the same for all zones of the same keyboard.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(h should be descriptive of which part of the keyboard backlight the zone covers and should be suitable for userspace to show to an end user in an UI for controlling the zones.h]h should be descriptive of which part of the keyboard backlight the zone covers and should be suitable for userspace to show to an end user in an UI for controlling the zones.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(hWhere possible should be a value already used by other zoned keyboards with a similar or identical zone layout, e.g.:h]hWhere possible should be a value already used by other zoned keyboards with a similar or identical zone layout, e.g.:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(h::kbd_zoned_backlight-right ::kbd_zoned_backlight-middle ::kbd_zoned_backlight-left ::kbd_zoned_backlight-corners ::kbd_zoned_backlight-wasdh]h::kbd_zoned_backlight-right ::kbd_zoned_backlight-middle ::kbd_zoned_backlight-left ::kbd_zoned_backlight-corners ::kbd_zoned_backlight-wasd}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(hor:h]hor:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(h::kbd_zoned_backlight-main ::kbd_zoned_backlight-cursor ::kbd_zoned_backlight-numpad ::kbd_zoned_backlight-corners ::kbd_zoned_backlight-wasdh]h::kbd_zoned_backlight-main ::kbd_zoned_backlight-cursor ::kbd_zoned_backlight-numpad ::kbd_zoned_backlight-corners ::kbd_zoned_backlight-wasd}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(hX2Note that this is intended for keyboards with a limited number of zones, keyboards with per key addressable backlighting must not use LED class devices since the sysfs API is not suitable for rapidly change multiple LEDs in one "commit" as is necessary to do animations / special effects on such keyboards.h]hX6Note that this is intended for keyboards with a limited number of zones, keyboards with per key addressable backlighting must not use LED class devices since the sysfs API is not suitable for rapidly change multiple LEDs in one “commit” as is necessary to do animations / special effects on such keyboards.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(h4An exception to the rule that all zones must follow:h]h4An exception to the rule that all zones must follow:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubjL)}(h7"::kbd_zoned_backlight-" h]h)}(h6"::kbd_zoned_backlight-"h]h:“::kbd_zoned_backlight-”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jKhhhKhj:hhubh)}(hXis made for the special case where there is a single big zone which controls the backlighting of almost all of the keyboard and there are some small areas with separate control, like just the 4 cursor keys, or the WASD keys. In this case the main zone should use 'kbd_backlight' for the function part of the name for compatibility with (older) userspace code which is not aware of the "kbd_zoned_backlight-" function naming scheme.h]hXis made for the special case where there is a single big zone which controls the backlighting of almost all of the keyboard and there are some small areas with separate control, like just the 4 cursor keys, or the WASD keys. In this case the main zone should use ‘kbd_backlight’ for the function part of the name for compatibility with (older) userspace code which is not aware of the “kbd_zoned_backlight-” function naming scheme.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(hbWhile the smaller zones should use the new zoned naming scheme. Such a setup would result in e.g.:h]hbWhile the smaller zones should use the new zoned naming scheme. Such a setup would result in e.g.:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(hP::kbd_backlight ::kbd_zoned_backlight-wasdh]hP::kbd_backlight ::kbd_zoned_backlight-wasd}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubh)}(h"kbd_zoned_backlight-" aware userspace should be aware of this exception and check for a main zone with a "kbd_backlight" function-name.h]h“kbd_zoned_backlight-” aware userspace should be aware of this exception and check for a main zone with a “kbd_backlight” function-name.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:hhubeh}(h],keyboard-backlight-control-led-device-namingah ]h"],keyboard backlight control led device namingah$]h&]uh1hhhhhhhhKxubh)}(hhh](h)}(hBrightness setting APIh]hBrightness setting API}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjGhhhhhKubh)}(h@LED subsystem core exposes following API for setting brightness:h]h@LED subsystem core exposes following API for setting brightness:}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjGhhubjL)}(hX- led_set_brightness: it is guaranteed not to sleep, passing LED_OFF stops blinking, - led_set_brightness_sync: for use cases when immediate effect is desired - it can block the caller for the time required for accessing device registers and can sleep, passing LED_OFF stops hardware blinking, returns -EBUSY if software blink fallback is enabled. h]jf)}(hhh](jk)}(hgled_set_brightness: it is guaranteed not to sleep, passing LED_OFF stops blinking, h]jq)}(hhh]jv)}(hSled_set_brightness: it is guaranteed not to sleep, passing LED_OFF stops blinking, h](j|)}(hled_set_brightness:h]hled_set_brightness:}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1j{hhhKhjtubj)}(hhh]h)}(h>it is guaranteed not to sleep, passing LED_OFF stops blinking,h]h>it is guaranteed not to sleep, passing LED_OFF stops blinking,}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjtubeh}(h]h ]h"]h$]h&]uh1juhhhKhjqubah}(h]h ]h"]h$]h&]uh1jphjmubah}(h]h ]h"]h$]h&]uh1jjhjjubjk)}(hX.led_set_brightness_sync: for use cases when immediate effect is desired - it can block the caller for the time required for accessing device registers and can sleep, passing LED_OFF stops hardware blinking, returns -EBUSY if software blink fallback is enabled. h]jq)}(hhh]jv)}(hXled_set_brightness_sync: for use cases when immediate effect is desired - it can block the caller for the time required for accessing device registers and can sleep, passing LED_OFF stops hardware blinking, returns -EBUSY if software blink fallback is enabled. h](j|)}(hled_set_brightness_sync:h]hled_set_brightness_sync:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j{hhhKhjubj)}(hhh]h)}(hfor use cases when immediate effect is desired - it can block the caller for the time required for accessing device registers and can sleep, passing LED_OFF stops hardware blinking, returns -EBUSY if software blink fallback is enabled.h]hfor use cases when immediate effect is desired - it can block the caller for the time required for accessing device registers and can sleep, passing LED_OFF stops hardware blinking, returns -EBUSY if software blink fallback is enabled.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1juhhhKhjubah}(h]h ]h"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]uh1jjhjjubeh}(h]h ]h"]h$]h&]j@jAuh1jehhhKhjfubah}(h]h ]h"]h$]h&]uh1jKhhhKhjGhhubeh}(h]brightness-setting-apiah ]h"]brightness setting apiah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hLED registration APIh]hLED registration API}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hX>A driver wanting to register a LED classdev for use by other drivers / userspace needs to allocate and fill a led_classdev struct and then call `[devm_]led_classdev_register`. If the non devm version is used the driver must call led_classdev_unregister from its remove function before free-ing the led_classdev struct.h](hA driver wanting to register a LED classdev for use by other drivers / userspace needs to allocate and fill a led_classdev struct and then call }(hjhhhNhNubhtitle_reference)}(h`[devm_]led_classdev_register`h]h[devm_]led_classdev_register}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh. If the non devm version is used the driver must call led_classdev_unregister from its remove function before free-ing the led_classdev struct.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hX\If the driver can detect hardware initiated brightness changes and thus wants to have a brightness_hw_changed attribute then the LED_BRIGHT_HW_CHANGED flag must be set in flags before registering. Calling led_classdev_notify_brightness_hw_changed on a classdev not registered with the LED_BRIGHT_HW_CHANGED flag is a bug and will trigger a WARN_ON.h]hX\If the driver can detect hardware initiated brightness changes and thus wants to have a brightness_hw_changed attribute then the LED_BRIGHT_HW_CHANGED flag must be set in flags before registering. Calling led_classdev_notify_brightness_hw_changed on a classdev not registered with the LED_BRIGHT_HW_CHANGED flag is a bug and will trigger a WARN_ON.}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]led-registration-apiah ]h"]led registration apiah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h"Hardware accelerated blink of LEDsh]h"Hardware accelerated blink of LEDs}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjNhhhhhKubh)}(hXHSome LEDs can be programmed to blink without any CPU interaction. To support this feature, a LED driver can optionally implement the blink_set() function (see ). To set an LED to blinking, however, it is better to use the API function led_blink_set(), as it will check and implement software fallback if necessary.h]hXHSome LEDs can be programmed to blink without any CPU interaction. To support this feature, a LED driver can optionally implement the blink_set() function (see ). To set an LED to blinking, however, it is better to use the API function led_blink_set(), as it will check and implement software fallback if necessary.}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjNhhubh)}(hTo turn off blinking, use the API function led_brightness_set() with brightness value LED_OFF, which should stop any software timers that may have been required for blinking.h]hTo turn off blinking, use the API function led_brightness_set() with brightness value LED_OFF, which should stop any software timers that may have been required for blinking.}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjNhhubh)}(hXThe blink_set() function should choose a user friendly blinking value if it is called with `*delay_on==0` && `*delay_off==0` parameters. In this case the driver should give back the chosen value through delay_on and delay_off parameters to the leds subsystem.h](h[The blink_set() function should choose a user friendly blinking value if it is called with }(hj{hhhNhNubj)}(h`*delay_on==0`h]h *delay_on==0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubh && }(hj{hhhNhNubj)}(h`*delay_off==0`h]h *delay_off==0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubh parameters. In this case the driver should give back the chosen value through delay_on and delay_off parameters to the leds subsystem.}(hj{hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjNhhubh)}(hSetting the brightness to zero with brightness_set() callback function should completely turn off the LED and cancel the previously programmed hardware blinking function, if any.h]hSetting the brightness to zero with brightness_set() callback function should completely turn off the LED and cancel the previously programmed hardware blinking function, if any.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjNhhubeh}(h]"hardware-accelerated-blink-of-ledsah ]h"]"hardware accelerated blink of ledsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hHardware driven LEDsh]hHardware driven LEDs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXSome LEDs can be programmed to be driven by hardware. This is not limited to blink but also to turn off or on autonomously. To support this feature, a LED needs to implement various additional ops and needs to declare specific support for the supported triggers.h]hXSome LEDs can be programmed to be driven by hardware. This is not limited to blink but also to turn off or on autonomously. To support this feature, a LED needs to implement various additional ops and needs to declare specific support for the supported triggers.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h7With hw control we refer to the LED driven by hardware.h]h7With hw control we refer to the LED driven by hardware.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hALED driver must define the following value to support hw control:h]hALED driver must define the following value to support hw control:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubjL)}(hi- hw_control_trigger: unique trigger name supported by the LED in hw control mode. h]jf)}(hhh]jk)}(hchw_control_trigger: unique trigger name supported by the LED in hw control mode. h]jq)}(hhh]jv)}(hQhw_control_trigger: unique trigger name supported by the LED in hw control mode. h](j|)}(hhw_control_trigger:h]hhw_control_trigger:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j{hhhKhj ubj)}(hhh]h)}(hubh)}(hThe LED Trigger core cannot be a module as the simple trigger functions would cause nightmare dependency issues. I see this as a minor issue compared to the benefits the simple trigger functionality brings. The rest of the LED subsystem can be modular.h]hThe LED Trigger core cannot be a module as the simple trigger functions would cause nightmare dependency issues. I see this as a minor issue compared to the benefits the simple trigger functionality brings. The rest of the LED subsystem can be modular.}(hj] hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM@hjL hhubeh}(h] known-issuesah ]h"] known issuesah$]h&]uh1hhhhhhhhM>ubeh}(h]led-handling-under-linuxah ]h"]led handling under linuxah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehʌ _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jx ju j)j&j7j4jDjAjjjKjHjjjI jF jp jm u nametypes}(jx j)j7jDjjKjjI jp uh}(ju hj&jj4j,jAj:jjGjHjjjNjF jjm jL u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.