Back to home page

OSCL-LXR

 
 

    


0001 Specifying PWM information for devices
0002 ======================================
0003 
0004 1) PWM user nodes
0005 -----------------
0006 
0007 PWM users should specify a list of PWM devices that they want to use
0008 with a property containing a 'pwm-list':
0009 
0010         pwm-list ::= <single-pwm> [pwm-list]
0011         single-pwm ::= <pwm-phandle> <pwm-specifier>
0012         pwm-phandle : phandle to PWM controller node
0013         pwm-specifier : array of #pwm-cells specifying the given PWM
0014                         (controller specific)
0015 
0016 PWM properties should be named "pwms". The exact meaning of each pwms
0017 property must be documented in the device tree binding for each device.
0018 An optional property "pwm-names" may contain a list of strings to label
0019 each of the PWM devices listed in the "pwms" property. If no "pwm-names"
0020 property is given, the name of the user node will be used as fallback.
0021 
0022 Drivers for devices that use more than a single PWM device can use the
0023 "pwm-names" property to map the name of the PWM device requested by the
0024 pwm_get() call to an index into the list given by the "pwms" property.
0025 
0026 The following example could be used to describe a PWM-based backlight
0027 device:
0028 
0029         pwm: pwm {
0030                 #pwm-cells = <2>;
0031         };
0032 
0033         [...]
0034 
0035         bl: backlight {
0036                 pwms = <&pwm 0 5000000>;
0037                 pwm-names = "backlight";
0038         };
0039 
0040 Note that in the example above, specifying the "pwm-names" is redundant
0041 because the name "backlight" would be used as fallback anyway.
0042 
0043 pwm-specifier typically encodes the chip-relative PWM number and the PWM
0044 period in nanoseconds.
0045 
0046 Optionally, the pwm-specifier can encode a number of flags (defined in
0047 <dt-bindings/pwm/pwm.h>) in a third cell:
0048 - PWM_POLARITY_INVERTED: invert the PWM signal polarity
0049 
0050 Example with optional PWM specifier for inverse polarity
0051 
0052         bl: backlight {
0053                 pwms = <&pwm 0 5000000 PWM_POLARITY_INVERTED>;
0054                 pwm-names = "backlight";
0055         };
0056 
0057 2) PWM controller nodes
0058 -----------------------
0059 
0060 See pwm.yaml.