blob: 06e67247859aa7eef3bc253d11cf6f18ca810680 [file] [log] [blame]
Thierry Reding7299ab72011-12-14 11:10:32 +01001Specifying PWM information for devices
2======================================
3
41) PWM user nodes
5-----------------
6
7PWM users should specify a list of PWM devices that they want to use
8with a property containing a 'pwm-list':
9
10 pwm-list ::= <single-pwm> [pwm-list]
11 single-pwm ::= <pwm-phandle> <pwm-specifier>
12 pwm-phandle : phandle to PWM controller node
13 pwm-specifier : array of #pwm-cells specifying the given PWM
14 (controller specific)
15
16PWM properties should be named "pwms". The exact meaning of each pwms
17property must be documented in the device tree binding for each device.
18An optional property "pwm-names" may contain a list of strings to label
19each of the PWM devices listed in the "pwms" property. If no "pwm-names"
20property is given, the name of the user node will be used as fallback.
21
22Drivers for devices that use more than a single PWM device can use the
23"pwm-names" property to map the name of the PWM device requested by the
24pwm_get() call to an index into the list given by the "pwms" property.
25
26The following example could be used to describe a PWM-based backlight
27device:
28
29 pwm: pwm {
30 #pwm-cells = <2>;
31 };
32
33 [...]
34
35 bl: backlight {
36 pwms = <&pwm 0 5000000>;
37 pwm-names = "backlight";
38 };
39
Philip, Avinash83af2402012-11-21 13:10:44 +053040Note that in the example above, specifying the "pwm-names" is redundant
41because the name "backlight" would be used as fallback anyway.
42
Thierry Reding7299ab72011-12-14 11:10:32 +010043pwm-specifier typically encodes the chip-relative PWM number and the PWM
Philip, Avinash83af2402012-11-21 13:10:44 +053044period in nanoseconds.
45
46Optionally, the pwm-specifier can encode a number of flags in a third cell:
47- bit 0: PWM signal polarity (0: normal polarity, 1: inverse polarity)
48
49Example with optional PWM specifier for inverse polarity
50
51 bl: backlight {
52 pwms = <&pwm 0 5000000 1>;
53 pwm-names = "backlight";
54 };
Thierry Reding7299ab72011-12-14 11:10:32 +010055
562) PWM controller nodes
57-----------------------
58
59PWM controller nodes must specify the number of cells used for the
60specifier using the '#pwm-cells' property.
61
62An example PWM controller might look like this:
63
64 pwm: pwm@7000a000 {
65 compatible = "nvidia,tegra20-pwm";
66 reg = <0x7000a000 0x100>;
67 #pwm-cells = <2>;
68 };