Skip to content

Commit 8c1bfd7

Browse files
committed
Merge tag 'pwm/for-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/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() ...
2 parents b0dfd9a + bebedf2 commit 8c1bfd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+710
-642
lines changed

Documentation/devicetree/bindings/pwm/pwm-tiecap.txt

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pwm/pwm-tiecap.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: TI SOC ECAP based APWM controller
8+
9+
maintainers:
10+
- Vignesh R <[email protected]>
11+
12+
allOf:
13+
- $ref: pwm.yaml#
14+
15+
properties:
16+
compatible:
17+
oneOf:
18+
- const: ti,am3352-ecap
19+
- items:
20+
- enum:
21+
- ti,da850-ecap
22+
- ti,am4372-ecap
23+
- ti,dra746-ecap
24+
- ti,k2g-ecap
25+
- ti,am654-ecap
26+
- ti,am64-ecap
27+
- const: ti,am3352-ecap
28+
29+
reg:
30+
maxItems: 1
31+
32+
"#pwm-cells":
33+
const: 3
34+
description: |
35+
See pwm.yaml in this directory for a description of the cells format.
36+
The only third cell flag supported by this binding is PWM_POLARITY_INVERTED.
37+
38+
clock-names:
39+
const: fck
40+
41+
clocks:
42+
maxItems: 1
43+
44+
power-domains:
45+
maxItems: 1
46+
47+
required:
48+
- compatible
49+
- reg
50+
- "#pwm-cells"
51+
- clocks
52+
- clock-names
53+
54+
additionalProperties: false
55+
56+
examples:
57+
- |
58+
ecap0: pwm@48300100 { /* ECAP on am33xx */
59+
compatible = "ti,am3352-ecap";
60+
#pwm-cells = <3>;
61+
reg = <0x48300100 0x80>;
62+
clocks = <&l4ls_gclk>;
63+
clock-names = "fck";
64+
};

Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pwm/pwm-tiehrpwm.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: TI SOC EHRPWM based PWM controller
8+
9+
maintainers:
10+
- Vignesh R <[email protected]>
11+
12+
allOf:
13+
- $ref: pwm.yaml#
14+
15+
properties:
16+
compatible:
17+
oneOf:
18+
- const: ti,am3352-ehrpwm
19+
- items:
20+
- enum:
21+
- ti,da850-ehrpwm
22+
- ti,am4372-ehrpwm
23+
- ti,dra746-ehrpwm
24+
- ti,am654-ehrpwm
25+
- ti,am64-epwm
26+
- const: ti,am3352-ehrpwm
27+
28+
reg:
29+
maxItems: 1
30+
31+
"#pwm-cells":
32+
const: 3
33+
description: |
34+
See pwm.yaml in this directory for a description of the cells format.
35+
The only third cell flag supported by this binding is PWM_POLARITY_INVERTED.
36+
37+
clock-names:
38+
items:
39+
- const: tbclk
40+
- const: fck
41+
42+
clocks:
43+
maxItems: 2
44+
45+
power-domains:
46+
maxItems: 1
47+
48+
required:
49+
- compatible
50+
- reg
51+
- "#pwm-cells"
52+
- clocks
53+
- clock-names
54+
55+
additionalProperties: false
56+
57+
examples:
58+
- |
59+
ehrpwm0: pwm@48300200 { /* EHRPWM on am33xx */
60+
compatible = "ti,am3352-ehrpwm";
61+
#pwm-cells = <3>;
62+
reg = <0x48300200 0x100>;
63+
clocks = <&ehrpwm0_tbclk>, <&l4ls_gclk>;
64+
clock-names = "tbclk", "fck";
65+
};

Documentation/driver-api/driver-model/devres.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ POWER
400400

401401
PWM
402402
devm_pwm_get()
403-
devm_pwm_put()
403+
devm_of_pwm_get()
404+
devm_fwnode_pwm_get()
404405

405406
REGULATOR
406407
devm_regulator_bulk_get()

Documentation/driver-api/pwm.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,19 @@ after usage with pwm_free().
4040

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

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

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

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

5257
The pwm_config(), pwm_enable() and pwm_disable() functions are just wrappers
5358
around pwm_apply_state() and should not be used if the user wants to change

Documentation/firmware-guide/acpi/enumeration.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,38 @@ input driver::
258258
.id_table = mpu3050_ids,
259259
};
260260

261+
Reference to PWM device
262+
=======================
263+
264+
Sometimes a device can be a consumer of PWM channel. Obviously OS would like
265+
to know which one. To provide this mapping the special property has been
266+
introduced, i.e.::
267+
268+
Device (DEV)
269+
{
270+
Name (_DSD, Package ()
271+
{
272+
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
273+
Package () {
274+
Package () { "compatible", Package () { "pwm-leds" } },
275+
Package () { "label", "alarm-led" },
276+
Package () { "pwms",
277+
Package () {
278+
"\\_SB.PCI0.PWM", // <PWM device reference>
279+
0, // <PWM index>
280+
600000000, // <PWM period>
281+
0, // <PWM flags>
282+
}
283+
}
284+
}
285+
286+
})
287+
...
288+
289+
In the above example the PWM-based LED driver references to the PWM channel 0
290+
of \_SB.PCI0.PWM device with initial period setting equal to 600 ms (note that
291+
value is given in nanoseconds).
292+
261293
GPIO support
262294
============
263295

0 commit comments

Comments
 (0)