Skip to content

Commit 5e0c2cc

Browse files
committed
Merge tag 'pwm/for-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux
Pull pwm updates from Uwe Kleine-König: "Here comes the usual mix of cleanups, new dt-bindings for existing drivers and nexus nodes; and a new driver for the pwm subsystem. Patches were contributed by Andy Shevchenko, Chen Wang, Chukun Pan, Frank Li, Herve Codina, Kever Yang, and Nam Cao. Patch feedback was provided by Andy Shevchenko, Conor Dooley, Daniel Mack, Duje Mihanović, Heiko Stuebner, Herve Codina, Krzysztof Kozlowski, Neil Armstrong, Rob Herring, and Zack Rusin. Thanks to all of them" * tag 'pwm/for-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: dt-bindings: pwm: imx: Add i.MX93, i.MX94 and i.MX95 support dt-bindings: pwm: rockchip: Add rockchip,rk3528-pwm pwm: stmpe: Allow to compile as a module pwm: Check for CONFIG_PWM using IS_REACHABLE() in main header dt-bindings: pwm: rockchip: Add rockchip,rk3562-pwm pwm: Strengthen dependency for PWM_SIFIVE pwm: clps711x: Drop of_match_ptr() usage for .of_match_table pwm: pca9685: Drop ACPI_PTR() and of_match_ptr() pwm: Add support for pwm nexus dt bindings dt-bindings: pwm: Add support for PWM nexus node pwm: Add upgrade path to #pwm-cells = <3> for users of of_pwm_single_xlate() pwm: gpio: Switch to use hrtimer_setup() pwm: sophgo: add driver for Sophgo SG2042 PWM dt-bindings: pwm: sophgo: add PWM controller for SG2042 pwm: lpss: Only include <linux/pwm.h> where needed
2 parents 47618bc + 6df320a commit 5e0c2cc

File tree

15 files changed

+390
-23
lines changed

15 files changed

+390
-23
lines changed

Documentation/devicetree/bindings/pwm/imx-tpm-pwm.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,15 @@ properties:
2323
const: 3
2424

2525
compatible:
26-
enum:
27-
- fsl,imx7ulp-pwm
26+
oneOf:
27+
- enum:
28+
- fsl,imx7ulp-pwm
29+
- items:
30+
- enum:
31+
- fsl,imx93-pwm
32+
- fsl,imx94-pwm
33+
- fsl,imx95-pwm
34+
- const: fsl,imx7ulp-pwm
2835

2936
reg:
3037
maxItems: 1
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-nexus-node.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: PWM Nexus node properties
8+
9+
description: >
10+
Platforms can have a standardized connector/expansion slot that exposes PWMs
11+
signals to expansion boards.
12+
13+
A nexus node allows to remap a phandle list in a consumer node through a
14+
connector node in a generic way. With this remapping, the consumer node needs
15+
to know only about the nexus node. Resources behind the nexus node are
16+
decoupled by the nexus node itself.
17+
18+
maintainers:
19+
- Herve Codina <herve.codina@bootlin.com>
20+
21+
select: true
22+
23+
properties:
24+
'#pwm-cells': true
25+
26+
pwm-map:
27+
$ref: /schemas/types.yaml#/definitions/uint32-matrix
28+
29+
pwm-map-mask:
30+
$ref: /schemas/types.yaml#/definitions/uint32-array
31+
32+
pwm-map-pass-thru:
33+
$ref: /schemas/types.yaml#/definitions/uint32-array
34+
35+
dependentRequired:
36+
pwm-map: ['#pwm-cells']
37+
pwm-map-mask: [ pwm-map ]
38+
pwm-map-pass-thru: [ pwm-map ]
39+
40+
additionalProperties: true
41+
42+
examples:
43+
- |
44+
pwm1: pwm@100 {
45+
reg = <0x100 0x10>;
46+
#pwm-cells = <3>;
47+
};
48+
49+
pwm2: pwm@200 {
50+
reg = <0x200 0x10>;
51+
#pwm-cells = <3>;
52+
};
53+
54+
connector: connector {
55+
#pwm-cells = <3>;
56+
pwm-map = <0 0 0 &pwm1 1 0 0>,
57+
<1 0 0 &pwm2 4 0 0>,
58+
<2 0 0 &pwm1 3 0 0>;
59+
pwm-map-mask = <0xffffffff 0x0 0x0>;
60+
pwm-map-pass-thru = <0x0 0xffffffff 0xffffffff>;
61+
};
62+
63+
device {
64+
pwms = <&connector 1 57000 0>;
65+
};

Documentation/devicetree/bindings/pwm/pwm-rockchip.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ properties:
3030
- enum:
3131
- rockchip,px30-pwm
3232
- rockchip,rk3308-pwm
33+
- rockchip,rk3528-pwm
34+
- rockchip,rk3562-pwm
3335
- rockchip,rk3568-pwm
3436
- rockchip,rk3588-pwm
3537
- rockchip,rv1126-pwm
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pwm/sophgo,sg2042-pwm.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Sophgo SG2042 PWM controller
8+
9+
maintainers:
10+
- Chen Wang <unicorn_wang@outlook.com>
11+
12+
description:
13+
This controller contains 4 channels which can generate PWM waveforms.
14+
15+
allOf:
16+
- $ref: pwm.yaml#
17+
18+
properties:
19+
compatible:
20+
const: sophgo,sg2042-pwm
21+
22+
reg:
23+
maxItems: 1
24+
25+
clocks:
26+
maxItems: 1
27+
28+
clock-names:
29+
items:
30+
- const: apb
31+
32+
resets:
33+
maxItems: 1
34+
35+
"#pwm-cells":
36+
const: 3
37+
38+
required:
39+
- compatible
40+
- reg
41+
- clocks
42+
- clock-names
43+
- resets
44+
45+
unevaluatedProperties: false
46+
47+
examples:
48+
- |
49+
#include <dt-bindings/reset/sophgo,sg2042-reset.h>
50+
51+
pwm@7f006000 {
52+
compatible = "sophgo,sg2042-pwm";
53+
reg = <0x7f006000 0x1000>;
54+
#pwm-cells = <3>;
55+
clocks = <&clock 67>;
56+
clock-names = "apb";
57+
resets = <&rstgen RST_PWM>;
58+
};

drivers/pwm/Kconfig

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ config PWM_SIFIVE
567567
tristate "SiFive PWM support"
568568
depends on OF
569569
depends on COMMON_CLK && HAS_IOMEM
570-
depends on RISCV || COMPILE_TEST
570+
depends on ARCH_SIFIVE || COMPILE_TEST
571571
help
572572
Generic PWM framework driver for SiFive SoCs.
573573

@@ -584,6 +584,16 @@ config PWM_SL28CPLD
584584
To compile this driver as a module, choose M here: the module
585585
will be called pwm-sl28cpld.
586586

587+
config PWM_SOPHGO_SG2042
588+
tristate "Sophgo SG2042 PWM support"
589+
depends on ARCH_SOPHGO || COMPILE_TEST
590+
help
591+
PWM driver for the PWM controller on Sophgo SG2042 SoC. The PWM
592+
controller supports outputing 4 channels of PWM waveforms.
593+
594+
To compile this driver as a module, choose M here: the module
595+
will be called pwm_sophgo_sg2042.
596+
587597
config PWM_SPEAR
588598
tristate "STMicroelectronics SPEAr PWM support"
589599
depends on PLAT_SPEAR || COMPILE_TEST
@@ -636,7 +646,7 @@ config PWM_STM32_LP
636646
will be called pwm-stm32-lp.
637647

638648
config PWM_STMPE
639-
bool "STMPE expander PWM export"
649+
tristate "STMPE expander PWM export"
640650
depends on MFD_STMPE
641651
help
642652
This enables support for the PWMs found in the STMPE I/O

drivers/pwm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ obj-$(CONFIG_PWM_RZ_MTU3) += pwm-rz-mtu3.o
5353
obj-$(CONFIG_PWM_SAMSUNG) += pwm-samsung.o
5454
obj-$(CONFIG_PWM_SIFIVE) += pwm-sifive.o
5555
obj-$(CONFIG_PWM_SL28CPLD) += pwm-sl28cpld.o
56+
obj-$(CONFIG_PWM_SOPHGO_SG2042) += pwm-sophgo-sg2042.o
5657
obj-$(CONFIG_PWM_SPEAR) += pwm-spear.o
5758
obj-$(CONFIG_PWM_SPRD) += pwm-sprd.o
5859
obj-$(CONFIG_PWM_STI) += pwm-sti.o

drivers/pwm/core.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,11 +1000,27 @@ of_pwm_xlate_with_flags(struct pwm_chip *chip, const struct of_phandle_args *arg
10001000
}
10011001
EXPORT_SYMBOL_GPL(of_pwm_xlate_with_flags);
10021002

1003+
/*
1004+
* This callback is used for PXA PWM chips that only have a single PWM line.
1005+
* For such chips you could argue that passing the line number (i.e. the first
1006+
* parameter in the common case) is useless as it's always zero. So compared to
1007+
* the default xlate function of_pwm_xlate_with_flags() the first parameter is
1008+
* the default period and the second are flags.
1009+
*
1010+
* Note that if #pwm-cells = <3>, the semantic is the same as for
1011+
* of_pwm_xlate_with_flags() to allow converting the affected driver to
1012+
* #pwm-cells = <3> without breaking the legacy binding.
1013+
*
1014+
* Don't use for new drivers.
1015+
*/
10031016
struct pwm_device *
10041017
of_pwm_single_xlate(struct pwm_chip *chip, const struct of_phandle_args *args)
10051018
{
10061019
struct pwm_device *pwm;
10071020

1021+
if (args->args_count >= 3)
1022+
return of_pwm_xlate_with_flags(chip, args);
1023+
10081024
pwm = pwm_request_from_chip(chip, 0, NULL);
10091025
if (IS_ERR(pwm))
10101026
return pwm;
@@ -1716,8 +1732,7 @@ static struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np,
17161732
return ERR_PTR(index);
17171733
}
17181734

1719-
err = of_parse_phandle_with_args(np, "pwms", "#pwm-cells", index,
1720-
&args);
1735+
err = of_parse_phandle_with_args_map(np, "pwms", "pwm", index, &args);
17211736
if (err) {
17221737
pr_err("%s(): can't parse \"pwms\" property\n", __func__);
17231738
return ERR_PTR(err);

drivers/pwm/pwm-clps711x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static int clps711x_pwm_probe(struct platform_device *pdev)
9898
return devm_pwmchip_add(&pdev->dev, chip);
9999
}
100100

101-
static const struct of_device_id __maybe_unused clps711x_pwm_dt_ids[] = {
101+
static const struct of_device_id clps711x_pwm_dt_ids[] = {
102102
{ .compatible = "cirrus,ep7209-pwm", },
103103
{ }
104104
};
@@ -107,7 +107,7 @@ MODULE_DEVICE_TABLE(of, clps711x_pwm_dt_ids);
107107
static struct platform_driver clps711x_pwm_driver = {
108108
.driver = {
109109
.name = "clps711x-pwm",
110-
.of_match_table = of_match_ptr(clps711x_pwm_dt_ids),
110+
.of_match_table = clps711x_pwm_dt_ids,
111111
},
112112
.probe = clps711x_pwm_probe,
113113
};

drivers/pwm/pwm-gpio.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,12 @@ static int pwm_gpio_probe(struct platform_device *pdev)
207207
chip->ops = &pwm_gpio_ops;
208208
chip->atomic = true;
209209

210-
hrtimer_init(&gpwm->gpio_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
210+
hrtimer_setup(&gpwm->gpio_timer, pwm_gpio_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
211+
211212
ret = devm_add_action_or_reset(dev, pwm_gpio_disable_hrtimer, gpwm);
212213
if (ret)
213214
return ret;
214215

215-
gpwm->gpio_timer.function = pwm_gpio_timer;
216-
217216
ret = pwmchip_add(chip);
218217
if (ret < 0)
219218
return dev_err_probe(dev, ret, "could not add pwmchip\n");

drivers/pwm/pwm-lpss.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/kernel.h>
1818
#include <linux/module.h>
1919
#include <linux/pm_runtime.h>
20+
#include <linux/pwm.h>
2021
#include <linux/time.h>
2122

2223
#define DEFAULT_SYMBOL_NAMESPACE "PWM_LPSS"

0 commit comments

Comments
 (0)