Skip to content

Commit

Permalink
Merge tag 'pwm/for-5.14-rc1' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/thierry.reding/linux-pwm

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()
  ...
  • Loading branch information
torvalds committed Jul 8, 2021
2 parents b0dfd9a + bebedf2 commit 8c1bfd7
Show file tree
Hide file tree
Showing 50 changed files with 710 additions and 642 deletions.
51 changes: 0 additions & 51 deletions Documentation/devicetree/bindings/pwm/pwm-tiecap.txt

This file was deleted.

64 changes: 64 additions & 0 deletions Documentation/devicetree/bindings/pwm/pwm-tiecap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/pwm/pwm-tiecap.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: TI SOC ECAP based APWM controller

maintainers:
- Vignesh R <[email protected]>

allOf:
- $ref: pwm.yaml#

properties:
compatible:
oneOf:
- const: ti,am3352-ecap
- items:
- enum:
- ti,da850-ecap
- ti,am4372-ecap
- ti,dra746-ecap
- ti,k2g-ecap
- ti,am654-ecap
- ti,am64-ecap
- const: ti,am3352-ecap

reg:
maxItems: 1

"#pwm-cells":
const: 3
description: |
See pwm.yaml in this directory for a description of the cells format.
The only third cell flag supported by this binding is PWM_POLARITY_INVERTED.
clock-names:
const: fck

clocks:
maxItems: 1

power-domains:
maxItems: 1

required:
- compatible
- reg
- "#pwm-cells"
- clocks
- clock-names

additionalProperties: false

examples:
- |
ecap0: pwm@48300100 { /* ECAP on am33xx */
compatible = "ti,am3352-ecap";
#pwm-cells = <3>;
reg = <0x48300100 0x80>;
clocks = <&l4ls_gclk>;
clock-names = "fck";
};
50 changes: 0 additions & 50 deletions Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt

This file was deleted.

65 changes: 65 additions & 0 deletions Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/pwm/pwm-tiehrpwm.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: TI SOC EHRPWM based PWM controller

maintainers:
- Vignesh R <[email protected]>

allOf:
- $ref: pwm.yaml#

properties:
compatible:
oneOf:
- const: ti,am3352-ehrpwm
- items:
- enum:
- ti,da850-ehrpwm
- ti,am4372-ehrpwm
- ti,dra746-ehrpwm
- ti,am654-ehrpwm
- ti,am64-epwm
- const: ti,am3352-ehrpwm

reg:
maxItems: 1

"#pwm-cells":
const: 3
description: |
See pwm.yaml in this directory for a description of the cells format.
The only third cell flag supported by this binding is PWM_POLARITY_INVERTED.
clock-names:
items:
- const: tbclk
- const: fck

clocks:
maxItems: 2

power-domains:
maxItems: 1

required:
- compatible
- reg
- "#pwm-cells"
- clocks
- clock-names

additionalProperties: false

examples:
- |
ehrpwm0: pwm@48300200 { /* EHRPWM on am33xx */
compatible = "ti,am3352-ehrpwm";
#pwm-cells = <3>;
reg = <0x48300200 0x100>;
clocks = <&ehrpwm0_tbclk>, <&l4ls_gclk>;
clock-names = "tbclk", "fck";
};
3 changes: 2 additions & 1 deletion Documentation/driver-api/driver-model/devres.rst
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ POWER

PWM
devm_pwm_get()
devm_pwm_put()
devm_of_pwm_get()
devm_fwnode_pwm_get()

REGULATOR
devm_regulator_bulk_get()
Expand Down
7 changes: 6 additions & 1 deletion Documentation/driver-api/pwm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,19 @@ after usage with pwm_free().

New users should use the pwm_get() function and pass to it the consumer
device or a consumer name. pwm_put() is used to free the PWM device. Managed
variants of these functions, devm_pwm_get() and devm_pwm_put(), also exist.
variants of the getter, devm_pwm_get(), devm_of_pwm_get(),
devm_fwnode_pwm_get(), also exist.

After being requested, a PWM has to be configured using::

int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state);

This API controls both the PWM period/duty_cycle config and the
enable/disable state.
There is also a usage_power setting: If set, the PWM driver is only required to
maintain the power output but has more freedom regarding signal form.
If supported by the driver, the signal can be optimized, for example to improve
EMI by phase shifting the individual channels of a chip.

The pwm_config(), pwm_enable() and pwm_disable() functions are just wrappers
around pwm_apply_state() and should not be used if the user wants to change
Expand Down
32 changes: 32 additions & 0 deletions Documentation/firmware-guide/acpi/enumeration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +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
============

Expand Down
Loading

0 comments on commit 8c1bfd7

Please sign in to comment.