1*1df7ee57SKever YangSpecifying PWM information for devices 2*1df7ee57SKever Yang====================================== 3*1df7ee57SKever Yang 4*1df7ee57SKever Yang1) PWM user nodes 5*1df7ee57SKever Yang----------------- 6*1df7ee57SKever Yang 7*1df7ee57SKever YangPWM users should specify a list of PWM devices that they want to use 8*1df7ee57SKever Yangwith a property containing a 'pwm-list': 9*1df7ee57SKever Yang 10*1df7ee57SKever Yang pwm-list ::= <single-pwm> [pwm-list] 11*1df7ee57SKever Yang single-pwm ::= <pwm-phandle> <pwm-specifier> 12*1df7ee57SKever Yang pwm-phandle : phandle to PWM controller node 13*1df7ee57SKever Yang pwm-specifier : array of #pwm-cells specifying the given PWM 14*1df7ee57SKever Yang (controller specific) 15*1df7ee57SKever Yang 16*1df7ee57SKever YangPWM properties should be named "pwms". The exact meaning of each pwms 17*1df7ee57SKever Yangproperty must be documented in the device tree binding for each device. 18*1df7ee57SKever YangAn optional property "pwm-names" may contain a list of strings to label 19*1df7ee57SKever Yangeach of the PWM devices listed in the "pwms" property. If no "pwm-names" 20*1df7ee57SKever Yangproperty is given, the name of the user node will be used as fallback. 21*1df7ee57SKever Yang 22*1df7ee57SKever YangDrivers for devices that use more than a single PWM device can use the 23*1df7ee57SKever Yang"pwm-names" property to map the name of the PWM device requested by the 24*1df7ee57SKever Yangpwm_get() call to an index into the list given by the "pwms" property. 25*1df7ee57SKever Yang 26*1df7ee57SKever YangThe following example could be used to describe a PWM-based backlight 27*1df7ee57SKever Yangdevice: 28*1df7ee57SKever Yang 29*1df7ee57SKever Yang pwm: pwm { 30*1df7ee57SKever Yang #pwm-cells = <2>; 31*1df7ee57SKever Yang }; 32*1df7ee57SKever Yang 33*1df7ee57SKever Yang [...] 34*1df7ee57SKever Yang 35*1df7ee57SKever Yang bl: backlight { 36*1df7ee57SKever Yang pwms = <&pwm 0 5000000>; 37*1df7ee57SKever Yang pwm-names = "backlight"; 38*1df7ee57SKever Yang }; 39*1df7ee57SKever Yang 40*1df7ee57SKever YangNote that in the example above, specifying the "pwm-names" is redundant 41*1df7ee57SKever Yangbecause the name "backlight" would be used as fallback anyway. 42*1df7ee57SKever Yang 43*1df7ee57SKever Yangpwm-specifier typically encodes the chip-relative PWM number and the PWM 44*1df7ee57SKever Yangperiod in nanoseconds. 45*1df7ee57SKever Yang 46*1df7ee57SKever YangOptionally, the pwm-specifier can encode a number of flags (defined in 47*1df7ee57SKever Yang<dt-bindings/pwm/pwm.h>) in a third cell: 48*1df7ee57SKever Yang- PWM_POLARITY_INVERTED: invert the PWM signal polarity 49*1df7ee57SKever Yang 50*1df7ee57SKever YangExample with optional PWM specifier for inverse polarity 51*1df7ee57SKever Yang 52*1df7ee57SKever Yang bl: backlight { 53*1df7ee57SKever Yang pwms = <&pwm 0 5000000 PWM_POLARITY_INVERTED>; 54*1df7ee57SKever Yang pwm-names = "backlight"; 55*1df7ee57SKever Yang }; 56*1df7ee57SKever Yang 57*1df7ee57SKever Yang2) PWM controller nodes 58*1df7ee57SKever Yang----------------------- 59*1df7ee57SKever Yang 60*1df7ee57SKever YangPWM controller nodes must specify the number of cells used for the 61*1df7ee57SKever Yangspecifier using the '#pwm-cells' property. 62*1df7ee57SKever Yang 63*1df7ee57SKever YangAn example PWM controller might look like this: 64*1df7ee57SKever Yang 65*1df7ee57SKever Yang pwm: pwm@7000a000 { 66*1df7ee57SKever Yang compatible = "nvidia,tegra20-pwm"; 67*1df7ee57SKever Yang reg = <0x7000a000 0x100>; 68*1df7ee57SKever Yang #pwm-cells = <2>; 69*1df7ee57SKever Yang }; 70