Merge tag 'pwm/for-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 8 Jul 2021 19:18:04 +0000 (12:18 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 8 Jul 2021 19:18:04 +0000 (12:18 -0700)
Pull pwm updates from Thierry Reding:
 "This contains mostly various fixes, cleanups and some conversions to
  the atomic API. One noteworthy change is that PWM consumers can now
  pass a hint to the PWM core about the PWM usage, enabling PWM
  providers to implement various optimizations.

  There's also a fair bit of simplification here with the addition of
  some device-managed helpers as well as unification between the DT and
  ACPI firmware interfaces"

* tag 'pwm/for-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: (50 commits)
  pwm: Remove redundant assignment to pointer pwm
  pwm: ep93xx: Fix read of uninitialized variable ret
  pwm: ep93xx: Prepare clock before using it
  pwm: ep93xx: Unfold legacy callbacks into ep93xx_pwm_apply()
  pwm: ep93xx: Implement .apply callback
  pwm: vt8500: Only unprepare the clock after the pwmchip was removed
  pwm: vt8500: Drop if with an always false condition
  pwm: tegra: Assert reset only after the PWM was unregistered
  pwm: tegra: Don't needlessly enable and disable the clock in .remove()
  pwm: tegra: Don't modify HW state in .remove callback
  pwm: tegra: Drop an if block with an always false condition
  pwm: core: Simplify some devm_*pwm*() functions
  pwm: core: Remove unused devm_pwm_put()
  pwm: core: Unify fwnode checks in the module
  pwm: core: Reuse fwnode_to_pwmchip() in ACPI case
  pwm: core: Convert to use fwnode for matching
  docs: firmware-guide: ACPI: Add a PWM example
  dt-bindings: pwm: pwm-tiecap: Add compatible string for AM64 SoC
  dt-bindings: pwm: pwm-tiecap: Convert to json schema
  pwm: sprd: Don't check the return code of pwmchip_remove()
  ...

1  2 
Documentation/driver-api/driver-model/devres.rst
Documentation/firmware-guide/acpi/enumeration.rst

@@@ -314,6 -314,7 +314,6 @@@ IOMA
    devm_ioremap_resource() : checks resource, requests memory region, ioremaps
    devm_ioremap_resource_wc()
    devm_platform_ioremap_resource() : calls devm_ioremap_resource() for platform device
 -  devm_platform_ioremap_resource_wc()
    devm_platform_ioremap_resource_byname()
    devm_platform_get_and_ioremap_resource()
    devm_iounmap()
@@@ -400,7 -401,8 +400,8 @@@ POWE
  
  PWM
    devm_pwm_get()
-   devm_pwm_put()
+   devm_of_pwm_get()
+   devm_fwnode_pwm_get()
  
  REGULATOR
    devm_regulator_bulk_get()
@@@ -258,6 -258,38 +258,38 @@@ input driver:
                .id_table       = mpu3050_ids,
        };
  
+ Reference to PWM device
+ =======================
+ Sometimes a device can be a consumer of PWM channel. Obviously OS would like
+ to know which one. To provide this mapping the special property has been
+ introduced, i.e.::
+     Device (DEV)
+     {
+         Name (_DSD, Package ()
+         {
+             ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+             Package () {
+                 Package () { "compatible", Package () { "pwm-leds" } },
+                 Package () { "label", "alarm-led" },
+                 Package () { "pwms",
+                     Package () {
+                         "\\_SB.PCI0.PWM",  // <PWM device reference>
+                         0,                 // <PWM index>
+                         600000000,         // <PWM period>
+                         0,                 // <PWM flags>
+                     }
+                 }
+             }
+         })
+         ...
+ In the above example the PWM-based LED driver references to the PWM channel 0
+ of \_SB.PCI0.PWM device with initial period setting equal to 600 ms (note that
+ value is given in nanoseconds).
  GPIO support
  ============
  
@@@ -339,8 -371,8 +371,8 @@@ a code like this:
  There are also devm_* versions of these functions which release the
  descriptors once the device is released.
  
 -See Documentation/firmware-guide/acpi/gpio-properties.rst for more information about the
 -_DSD binding related to GPIOs.
 +See Documentation/firmware-guide/acpi/gpio-properties.rst for more information
 +about the _DSD binding related to GPIOs.
  
  MFD devices
  ===========
@@@ -460,8 -492,7 +492,8 @@@ the _DSD of the device object itself o
  Otherwise, the _DSD itself is regarded as invalid and therefore the "compatible"
  property returned by it is meaningless.
  
 -Refer to :doc:`DSD-properties-rules` for more information.
 +Refer to Documentation/firmware-guide/acpi/DSD-properties-rules.rst for more
 +information.
  
  PCI hierarchy representation
  ============================