-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/…
…git/cooloney/linux-leds Pull LED subsystem update from Bryan Wu. * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (61 commits) leds: leds-sunfire: use dev_err()/pr_err() instead of printk() leds: 88pm860x: Add missing of_node_put() leds: tca6507: Use of_get_child_count() leds: leds-pwm: make it depend on PWM and not HAVE_PWM Documentation: leds: update LP55xx family devices leds-lp55xx: fix problem on removing LED attributes leds-lp5521/5523: add author and copyright description leds-lp5521/5523: use new lp55xx common header leds-lp55xx: clean up headers leds-lp55xx: clean up definitions leds-lp55xx: clean up unused data and functions leds-lp55xx: clean up _remove() leds-lp55xx: add new function for removing device attribtues leds-lp55xx: code refactoring on selftest function leds-lp55xx: use common device attribute driver function leds-lp55xx: support device specific attributes leds-lp5523: use generic firmware interface leds-lp5521: use generic firmware interface leds-lp55xx: support firmware interface leds-lp55xx: add new lp55xx_register_sysfs() for the firmware interface ...
- Loading branch information
Showing
32 changed files
with
1,803 additions
and
1,787 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
LED connected to PWM | ||
|
||
Required properties: | ||
- compatible : should be "pwm-leds". | ||
|
||
Each LED is represented as a sub-node of the pwm-leds device. Each | ||
node's name represents the name of the corresponding LED. | ||
|
||
LED sub-node properties: | ||
- pwms : PWM property to point to the PWM device (phandle)/port (id) and to | ||
specify the period time to be used: <&phandle id period_ns>; | ||
- pwm-names : (optional) Name to be used by the PWM subsystem for the PWM device | ||
For the pwms and pwm-names property please refer to: | ||
Documentation/devicetree/bindings/pwm/pwm.txt | ||
- max-brightness : Maximum brightness possible for the LED | ||
- label : (optional) | ||
see Documentation/devicetree/bindings/leds/common.txt | ||
- linux,default-trigger : (optional) | ||
see Documentation/devicetree/bindings/leds/common.txt | ||
|
||
Example: | ||
|
||
twl_pwm: pwm { | ||
/* provides two PWMs (id 0, 1 for PWM1 and PWM2) */ | ||
compatible = "ti,twl6030-pwm"; | ||
#pwm-cells = <2>; | ||
}; | ||
|
||
twl_pwmled: pwmled { | ||
/* provides one PWM (id 0 for Charing indicator LED) */ | ||
compatible = "ti,twl6030-pwmled"; | ||
#pwm-cells = <2>; | ||
}; | ||
|
||
pwmleds { | ||
compatible = "pwm-leds"; | ||
kpad { | ||
label = "omap4::keypad"; | ||
pwms = <&twl_pwm 0 7812500>; | ||
max-brightness = <127>; | ||
}; | ||
|
||
charging { | ||
label = "omap4:green:chrg"; | ||
pwms = <&twl_pwmled 0 7812500>; | ||
max-brightness = <255>; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
LEDs conected to tca6507 | ||
|
||
Required properties: | ||
- compatible : should be : "ti,tca6507". | ||
|
||
Each led is represented as a sub-node of the ti,tca6507 device. | ||
|
||
LED sub-node properties: | ||
- label : (optional) see Documentation/devicetree/bindings/leds/common.txt | ||
- reg : number of LED line (could be from 0 to 6) | ||
- linux,default-trigger : (optional) | ||
see Documentation/devicetree/bindings/leds/common.txt | ||
|
||
Examples: | ||
|
||
tca6507@45 { | ||
compatible = "ti,tca6507"; | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
reg = <0x45>; | ||
|
||
led0: red-aux@0 { | ||
label = "red:aux"; | ||
reg = <0x0>; | ||
}; | ||
|
||
led1: green-aux@1 { | ||
label = "green:aux"; | ||
reg = <0x5>; | ||
linux,default-trigger = "default-on"; | ||
}; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
LP5521/LP5523/LP55231 Common Driver | ||
=================================== | ||
|
||
Authors: Milo(Woogyom) Kim <milo.kim@ti.com> | ||
|
||
Description | ||
----------- | ||
LP5521, LP5523/55231 have common features as below. | ||
|
||
Register access via the I2C | ||
Device initialization/deinitialization | ||
Create LED class devices for multiple output channels | ||
Device attributes for user-space interface | ||
Program memory for running LED patterns | ||
|
||
The LP55xx common driver provides these features using exported functions. | ||
lp55xx_init_device() / lp55xx_deinit_device() | ||
lp55xx_register_leds() / lp55xx_unregister_leds() | ||
lp55xx_regsister_sysfs() / lp55xx_unregister_sysfs() | ||
|
||
( Driver Structure Data ) | ||
|
||
In lp55xx common driver, two different data structure is used. | ||
|
||
o lp55xx_led | ||
control multi output LED channels such as led current, channel index. | ||
o lp55xx_chip | ||
general chip control such like the I2C and platform data. | ||
|
||
For example, LP5521 has maximum 3 LED channels. | ||
LP5523/55231 has 9 output channels. | ||
|
||
lp55xx_chip for LP5521 ... lp55xx_led #1 | ||
lp55xx_led #2 | ||
lp55xx_led #3 | ||
|
||
lp55xx_chip for LP5523 ... lp55xx_led #1 | ||
lp55xx_led #2 | ||
. | ||
. | ||
lp55xx_led #9 | ||
|
||
( Chip Dependent Code ) | ||
|
||
To support device specific configurations, special structure | ||
'lpxx_device_config' is used. | ||
|
||
Maximum number of channels | ||
Reset command, chip enable command | ||
Chip specific initialization | ||
Brightness control register access | ||
Setting LED output current | ||
Program memory address access for running patterns | ||
Additional device specific attributes | ||
|
||
( Firmware Interface ) | ||
|
||
LP55xx family devices have the internal program memory for running | ||
various LED patterns. | ||
This pattern data is saved as a file in the user-land or | ||
hex byte string is written into the memory through the I2C. | ||
LP55xx common driver supports the firmware interface. | ||
|
||
LP55xx chips have three program engines. | ||
To load and run the pattern, the programming sequence is following. | ||
(1) Select an engine number (1/2/3) | ||
(2) Mode change to load | ||
(3) Write pattern data into selected area | ||
(4) Mode change to run | ||
|
||
The LP55xx common driver provides simple interfaces as below. | ||
select_engine : Select which engine is used for running program | ||
run_engine : Start program which is loaded via the firmware interface | ||
firmware : Load program data | ||
|
||
For example, run blinking pattern in engine #1 of LP5521 | ||
echo 1 > /sys/bus/i2c/devices/xxxx/select_engine | ||
echo 1 > /sys/class/firmware/lp5521/loading | ||
echo "4000600040FF6000" > /sys/class/firmware/lp5521/data | ||
echo 0 > /sys/class/firmware/lp5521/loading | ||
echo 1 > /sys/bus/i2c/devices/xxxx/run_engine | ||
|
||
For example, run blinking pattern in engine #3 of LP55231 | ||
echo 3 > /sys/bus/i2c/devices/xxxx/select_engine | ||
echo 1 > /sys/class/firmware/lp55231/loading | ||
echo "9d0740ff7e0040007e00a0010000" > /sys/class/firmware/lp55231/data | ||
echo 0 > /sys/class/firmware/lp55231/loading | ||
echo 1 > /sys/bus/i2c/devices/xxxx/run_engine | ||
|
||
To start blinking patterns in engine #2 and #3 simultaneously, | ||
for idx in 2 3 | ||
do | ||
echo $idx > /sys/class/leds/red/device/select_engine | ||
sleep 0.1 | ||
echo 1 > /sys/class/firmware/lp5521/loading | ||
echo "4000600040FF6000" > /sys/class/firmware/lp5521/data | ||
echo 0 > /sys/class/firmware/lp5521/loading | ||
done | ||
echo 1 > /sys/class/leds/red/device/run_engine | ||
|
||
Here is another example for LP5523. | ||
echo 2 > /sys/bus/i2c/devices/xxxx/select_engine | ||
echo 1 > /sys/class/firmware/lp5523/loading | ||
echo "9d80400004ff05ff437f0000" > /sys/class/firmware/lp5523/data | ||
echo 0 > /sys/class/firmware/lp5523/loading | ||
echo 1 > /sys/bus/i2c/devices/xxxx/run_engine | ||
|
||
As soon as 'loading' is set to 0, registered callback is called. | ||
Inside the callback, the selected engine is loaded and memory is updated. | ||
To run programmed pattern, 'run_engine' attribute should be enabled. | ||
|
||
( 'run_engine' and 'firmware_cb' ) | ||
The sequence of running the program data is common. | ||
But each device has own specific register addresses for commands. | ||
To support this, 'run_engine' and 'firmware_cb' are configurable in each driver. | ||
run_engine : Control the selected engine | ||
firmware_cb : The callback function after loading the firmware is done. | ||
Chip specific commands for loading and updating program memory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.