Skip to content

Commit

Permalink
docs: leds: convert to ReST
Browse files Browse the repository at this point in the history
Rename the leds documentation files to ReST, add an
index for them and adjust in order to produce a nice html
output via the Sphinx build system.

At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
  • Loading branch information
mchehab authored and jacek-anaszewski committed Jun 28, 2019
1 parent 25529ed commit 8dab919
Show file tree
Hide file tree
Showing 25 changed files with 997 additions and 779 deletions.
4 changes: 2 additions & 2 deletions Documentation/laptops/thinkpad-acpi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ status as "unknown". The available commands are:
sysfs notes:

The ThinkLight sysfs interface is documented by the LED class
documentation, in Documentation/leds/leds-class.txt. The ThinkLight LED name
documentation, in Documentation/leds/leds-class.rst. The ThinkLight LED name
is "tpacpi::thinklight".

Due to limitations in the sysfs LED class, if the status of the ThinkLight
Expand Down Expand Up @@ -779,7 +779,7 @@ All of the above can be turned on and off and can be made to blink.
sysfs notes:

The ThinkPad LED sysfs interface is described in detail by the LED class
documentation, in Documentation/leds/leds-class.txt.
documentation, in Documentation/leds/leds-class.rst.

The LEDs are named (in LED ID order, from 0 to 12):
"tpacpi::power", "tpacpi:orange:batt", "tpacpi:green:batt",
Expand Down
25 changes: 25 additions & 0 deletions Documentation/leds/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
:orphan:

====
LEDs
====

.. toctree::
:maxdepth: 1

leds-class
leds-class-flash
ledtrig-oneshot
ledtrig-transient
ledtrig-usbport

uleds

leds-blinkm
leds-lm3556
leds-lp3944
leds-lp5521
leds-lp5523
leds-lp5562
leds-lp55xx
leds-mlxcpld
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
==================
Leds BlinkM driver
==================

The leds-blinkm driver supports the devices of the BlinkM family.

They are RGB-LED modules driven by a (AT)tiny microcontroller and
Expand All @@ -14,35 +18,36 @@ The interface this driver provides is 2-fold:
a) LED class interface for use with triggers
############################################

The registration follows the scheme:
blinkm-<i2c-bus-nr>-<i2c-device-nr>-<color>
The registration follows the scheme::

blinkm-<i2c-bus-nr>-<i2c-device-nr>-<color>

$ ls -h /sys/class/leds/blinkm-6-*
/sys/class/leds/blinkm-6-9-blue:
brightness device max_brightness power subsystem trigger uevent
$ ls -h /sys/class/leds/blinkm-6-*
/sys/class/leds/blinkm-6-9-blue:
brightness device max_brightness power subsystem trigger uevent

/sys/class/leds/blinkm-6-9-green:
brightness device max_brightness power subsystem trigger uevent
/sys/class/leds/blinkm-6-9-green:
brightness device max_brightness power subsystem trigger uevent

/sys/class/leds/blinkm-6-9-red:
brightness device max_brightness power subsystem trigger uevent
/sys/class/leds/blinkm-6-9-red:
brightness device max_brightness power subsystem trigger uevent

(same is /sys/bus/i2c/devices/6-0009/leds)

We can control the colors separated into red, green and blue and
assign triggers on each color.

E.g.:
E.g.::

$ cat blinkm-6-9-blue/brightness
05
$ cat blinkm-6-9-blue/brightness
05

$ echo 200 > blinkm-6-9-blue/brightness
$
$ echo 200 > blinkm-6-9-blue/brightness
$

$ modprobe ledtrig-heartbeat
$ echo heartbeat > blinkm-6-9-green/trigger
$
$ modprobe ledtrig-heartbeat
$ echo heartbeat > blinkm-6-9-green/trigger
$


b) Sysfs group to control rgb, fade, hsb, scripts ...
Expand All @@ -52,29 +57,28 @@ This extended interface is available as folder blinkm
in the sysfs folder of the I2C device.
E.g. below /sys/bus/i2c/devices/6-0009/blinkm

$ ls -h /sys/bus/i2c/devices/6-0009/blinkm/
blue green red test
$ ls -h /sys/bus/i2c/devices/6-0009/blinkm/
blue green red test

Currently supported is just setting red, green, blue
and a test sequence.

E.g.:
E.g.::

$ cat *
00
00
00
#Write into test to start test sequence!#
$ cat *
00
00
00
#Write into test to start test sequence!#

$ echo 1 > test
$
$ echo 1 > test
$

$ echo 255 > red
$
$ echo 255 > red
$



as of 6/2012

dl9pf <at> gmx <dot> de

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

==============================
Flash LED handling under Linux
==============================

Some LED devices provide two modes - torch and flash. In the LED subsystem
those modes are supported by LED class (see Documentation/leds/leds-class.txt)
those modes are supported by LED class (see Documentation/leds/leds-class.rst)
and LED Flash class respectively. The torch mode related features are enabled
by default and the flash ones only if a driver declares it by setting
LED_DEV_CAP_FLASH flag.
Expand All @@ -14,6 +14,7 @@ registered in the LED subsystem with led_classdev_flash_register function.

Following sysfs attributes are exposed for controlling flash LED devices:
(see Documentation/ABI/testing/sysfs-class-led-flash)

- flash_brightness
- max_flash_brightness
- flash_timeout
Expand All @@ -31,30 +32,46 @@ be defined in the kernel config.

The driver must call the v4l2_flash_init function to get registered in the
V4L2 subsystem. The function takes six arguments:
- dev : flash device, e.g. an I2C device
- of_node : of_node of the LED, may be NULL if the same as device's
- fled_cdev : LED flash class device to wrap
- iled_cdev : LED flash class device representing indicator LED associated with
fled_cdev, may be NULL
- ops : V4L2 specific ops
* external_strobe_set - defines the source of the flash LED strobe -

- dev:
flash device, e.g. an I2C device
- of_node:
of_node of the LED, may be NULL if the same as device's
- fled_cdev:
LED flash class device to wrap
- iled_cdev:
LED flash class device representing indicator LED associated with
fled_cdev, may be NULL
- ops:
V4L2 specific ops

* external_strobe_set
defines the source of the flash LED strobe -
V4L2_CID_FLASH_STROBE control or external source, typically
a sensor, which makes it possible to synchronise the flash
strobe start with exposure start,
* intensity_to_led_brightness and led_brightness_to_intensity - perform
* intensity_to_led_brightness and led_brightness_to_intensity
perform
enum led_brightness <-> V4L2 intensity conversion in a device
specific manner - they can be used for devices with non-linear
LED current scale.
- config : configuration for V4L2 Flash sub-device
* dev_name - the name of the media entity, unique in the system,
* flash_faults - bitmask of flash faults that the LED flash class
- config:
configuration for V4L2 Flash sub-device

* dev_name
the name of the media entity, unique in the system,
* flash_faults
bitmask of flash faults that the LED flash class
device can report; corresponding LED_FAULT* bit definitions are
available in <linux/led-class-flash.h>,
* torch_intensity - constraints for the LED in TORCH mode
* torch_intensity
constraints for the LED in TORCH mode
in microamperes,
* indicator_intensity - constraints for the indicator LED
* indicator_intensity
constraints for the indicator LED
in microamperes,
* has_external_strobe - determines whether the flash strobe source
* has_external_strobe
determines whether the flash strobe source
can be switched to external,

On remove the v4l2_flash_release function has to be called, which takes one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

========================
LED handling under Linux
========================

Expand Down Expand Up @@ -43,7 +43,7 @@ LED Device Naming

Is currently of the form:

"devicename:colour:function"
"devicename:colour:function"

There have been calls for LED properties such as colour to be exported as
individual led class attributes. As a solution which doesn't incur as much
Expand All @@ -57,9 +57,12 @@ Brightness setting API

LED subsystem core exposes following API for setting brightness:

- led_set_brightness : it is guaranteed not to sleep, passing LED_OFF stops
- 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 -

- 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.
Expand All @@ -70,7 +73,7 @@ LED registration API

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
`[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.

Expand All @@ -94,7 +97,7 @@ with brightness value LED_OFF, which should stop any software
timers that may have been required for blinking.

The blink_set() function should choose a user friendly blinking value
if it is called with *delay_on==0 && *delay_off==0 parameters. In this
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.

Expand Down
Loading

0 comments on commit 8dab919

Please sign in to comment.