forked from torvalds/linux
-
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.
leds: leds-pwm: Add device tree bindings
The DT binding for the pwm-leds devices are similar to the gpio-leds type. LEDs are represented as sub-nodes of the pwm-leds device. The code for handling the DT boot is based on the code found in the leds-gpio driver and adapted to use PWMs instead of GPIOs. To avoid having custom cleanup code in case of DT boot the newly created devm_of_pwm_get() API is used to get the correct PWM instance. For usage see: Documentation/devicetree/bindings/leds/leds-pwm.txt Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Bryan Wu <cooloney@gmail.com>
- Loading branch information
Showing
2 changed files
with
140 additions
and
20 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