pwm.txt 2.0 KB

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