1 Specifying PWM information for devices 1 Specifying PWM information for devices 2 ====================================== 2 ====================================== 3 3 4 1) PWM user nodes 4 1) PWM user nodes 5 ----------------- 5 ----------------- 6 6 7 PWM users should specify a list of PWM devices 7 PWM users should specify a list of PWM devices that they want to use 8 with a property containing a 'pwm-list': 8 with a property containing a 'pwm-list': 9 9 10 pwm-list ::= <single-pwm> [pwm-list] 10 pwm-list ::= <single-pwm> [pwm-list] 11 single-pwm ::= <pwm-phandle> <pwm-spec 11 single-pwm ::= <pwm-phandle> <pwm-specifier> 12 pwm-phandle : phandle to PWM controlle 12 pwm-phandle : phandle to PWM controller node 13 pwm-specifier : array of #pwm-cells sp 13 pwm-specifier : array of #pwm-cells specifying the given PWM 14 (controller specific) 14 (controller specific) 15 15 16 PWM properties should be named "pwms". The exa 16 PWM properties should be named "pwms". The exact meaning of each pwms 17 property must be documented in the device tree 17 property must be documented in the device tree binding for each device. 18 An optional property "pwm-names" may contain a 18 An optional property "pwm-names" may contain a list of strings to label 19 each of the PWM devices listed in the "pwms" p 19 each of the PWM devices listed in the "pwms" property. If no "pwm-names" 20 property is given, the name of the user node w 20 property is given, the name of the user node will be used as fallback. 21 21 22 Drivers for devices that use more than a singl 22 Drivers for devices that use more than a single PWM device can use the 23 "pwm-names" property to map the name of the PW 23 "pwm-names" property to map the name of the PWM device requested by the 24 pwm_get() call to an index into the list given 24 pwm_get() call to an index into the list given by the "pwms" property. 25 25 26 The following example could be used to describ 26 The following example could be used to describe a PWM-based backlight 27 device: 27 device: 28 28 29 pwm: pwm { 29 pwm: pwm { 30 #pwm-cells = <2>; 30 #pwm-cells = <2>; 31 }; 31 }; 32 32 33 [...] 33 [...] 34 34 35 bl: backlight { 35 bl: backlight { 36 pwms = <&pwm 0 5000000>; 36 pwms = <&pwm 0 5000000>; 37 pwm-names = "backlight"; 37 pwm-names = "backlight"; 38 }; 38 }; 39 39 40 Note that in the example above, specifying the 40 Note that in the example above, specifying the "pwm-names" is redundant 41 because the name "backlight" would be used as 41 because the name "backlight" would be used as fallback anyway. 42 42 43 pwm-specifier typically encodes the chip-relat 43 pwm-specifier typically encodes the chip-relative PWM number and the PWM 44 period in nanoseconds. 44 period in nanoseconds. 45 45 46 Optionally, the pwm-specifier can encode a num !! 46 Optionally, the pwm-specifier can encode a number of flags in a third cell: 47 <dt-bindings/pwm/pwm.h>) in a third cell: !! 47 - bit 0: PWM signal polarity (0: normal polarity, 1: inverse polarity) 48 - PWM_POLARITY_INVERTED: invert the PWM signal << 49 48 50 Example with optional PWM specifier for invers 49 Example with optional PWM specifier for inverse polarity 51 50 52 bl: backlight { 51 bl: backlight { 53 pwms = <&pwm 0 5000000 PWM_POL !! 52 pwms = <&pwm 0 5000000 1>; 54 pwm-names = "backlight"; 53 pwm-names = "backlight"; 55 }; 54 }; 56 55 57 2) PWM controller nodes 56 2) PWM controller nodes 58 ----------------------- 57 ----------------------- 59 58 60 See pwm.yaml. !! 59 PWM controller nodes must specify the number of cells used for the >> 60 specifier using the '#pwm-cells' property. >> 61 >> 62 An 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 };
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.