xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/pwm/pwm.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSpecifying PWM information for devices
2*4882a593Smuzhiyun======================================
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun1) PWM user nodes
5*4882a593Smuzhiyun-----------------
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunPWM users should specify a list of PWM devices that they want to use
8*4882a593Smuzhiyunwith a property containing a 'pwm-list':
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun	pwm-list ::= <single-pwm> [pwm-list]
11*4882a593Smuzhiyun	single-pwm ::= <pwm-phandle> <pwm-specifier>
12*4882a593Smuzhiyun	pwm-phandle : phandle to PWM controller node
13*4882a593Smuzhiyun	pwm-specifier : array of #pwm-cells specifying the given PWM
14*4882a593Smuzhiyun			(controller specific)
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunPWM properties should be named "pwms". The exact meaning of each pwms
17*4882a593Smuzhiyunproperty must be documented in the device tree binding for each device.
18*4882a593SmuzhiyunAn optional property "pwm-names" may contain a list of strings to label
19*4882a593Smuzhiyuneach of the PWM devices listed in the "pwms" property. If no "pwm-names"
20*4882a593Smuzhiyunproperty is given, the name of the user node will be used as fallback.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunDrivers for devices that use more than a single PWM device can use the
23*4882a593Smuzhiyun"pwm-names" property to map the name of the PWM device requested by the
24*4882a593Smuzhiyunpwm_get() call to an index into the list given by the "pwms" property.
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunThe following example could be used to describe a PWM-based backlight
27*4882a593Smuzhiyundevice:
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun	pwm: pwm {
30*4882a593Smuzhiyun		#pwm-cells = <2>;
31*4882a593Smuzhiyun	};
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun	[...]
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun	bl: backlight {
36*4882a593Smuzhiyun		pwms = <&pwm 0 5000000>;
37*4882a593Smuzhiyun		pwm-names = "backlight";
38*4882a593Smuzhiyun	};
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunNote that in the example above, specifying the "pwm-names" is redundant
41*4882a593Smuzhiyunbecause the name "backlight" would be used as fallback anyway.
42*4882a593Smuzhiyun
43*4882a593Smuzhiyunpwm-specifier typically encodes the chip-relative PWM number and the PWM
44*4882a593Smuzhiyunperiod in nanoseconds.
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunOptionally, the pwm-specifier can encode a number of flags (defined in
47*4882a593Smuzhiyun<dt-bindings/pwm/pwm.h>) in a third cell:
48*4882a593Smuzhiyun- PWM_POLARITY_INVERTED: invert the PWM signal polarity
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunExample with optional PWM specifier for inverse polarity
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun	bl: backlight {
53*4882a593Smuzhiyun		pwms = <&pwm 0 5000000 PWM_POLARITY_INVERTED>;
54*4882a593Smuzhiyun		pwm-names = "backlight";
55*4882a593Smuzhiyun	};
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun2) PWM controller nodes
58*4882a593Smuzhiyun-----------------------
59*4882a593Smuzhiyun
60*4882a593SmuzhiyunSee pwm.yaml.
61