Skip to content

Commit aeb1529

Browse files
committed
Merge tag 'pwm/for-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux
Pull pwm updates from Uwe Kleine-König: "This contains the usual amount of driver and device tree changes. Additionally there is a big rework of how pwm lowlevel drivers are registered to prepare adding character device support. Thanks to Dharma Balasubiramani, Dong Aisheng, Duje Mihanović, Jerome Brunet, Raag Jadav and Rafał Miłecki for their contributions. And sorry for those who still need some patience because I didn't manage to empty my review queue" * tag 'pwm/for-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: (185 commits) pwm: imx-tpm: fix probe crash due to access registers without clock pwm: meson: generalize 4 inputs clock on meson8 pwm type dt-bindings: pwm: amlogic: Add a new binding for meson8 pwm types dt-bindings: pwm: amlogic: fix s4 bindings pwm: dwc: simplify error handling pwm: dwc: Add 16 channel support for Intel Elkhart Lake pwm: dwc: drop redundant error check staging: greybus: pwm: Make use of devm_pwmchip_alloc() function staging: greybus: pwm: Rework how the number of PWM lines is determined staging: greybus: pwm: Drop unused gb_connection_set_data() staging: greybus: pwm: Rely on pwm framework to pass a valid hwpwm staging: greybus: pwm: Make use of pwmchip_parent() accessor staging: greybus: pwm: Change prototype of helpers to prepare further changes leds: qcom-lpg: Make use of devm_pwmchip_alloc() function drm/bridge: ti-sn65dsi86: Make use of devm_pwmchip_alloc() function drm/bridge: ti-sn65dsi86: Make use of pwmchip_parent() accessor gpio: mvebu: Make use of devm_pwmchip_alloc() function pwm: xilinx: Make use of devm_pwmchip_alloc() function pwm: xilinx: Prepare removing pwm_chip from driver data pwm: vt8500: Make use of devm_pwmchip_alloc() function ...
2 parents aa7d651 + dd6c6d5 commit aeb1529

Some content is hidden

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

85 files changed

+2096
-1926
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pwm/atmel,hlcdc-pwm.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Atmel's HLCDC's PWM controller
8+
9+
maintainers:
10+
- Nicolas Ferre <[email protected]>
11+
- Alexandre Belloni <[email protected]>
12+
- Claudiu Beznea <[email protected]>
13+
14+
description:
15+
The LCDC integrates a Pulse Width Modulation (PWM) Controller. This block
16+
generates the LCD contrast control signal (LCD_PWM) that controls the
17+
display's contrast by software. LCDC_PWM is an 8-bit PWM signal that can be
18+
converted to an analog voltage with a simple passive filter. LCD display
19+
panels have different backlight specifications in terms of minimum/maximum
20+
values for PWM frequency. If the LCDC PWM frequency range does not match the
21+
LCD display panel, it is possible to use the standalone PWM Controller to
22+
drive the backlight.
23+
24+
properties:
25+
compatible:
26+
const: atmel,hlcdc-pwm
27+
28+
"#pwm-cells":
29+
const: 3
30+
31+
required:
32+
- compatible
33+
- "#pwm-cells"
34+
35+
additionalProperties: false

Documentation/devicetree/bindings/pwm/atmel-hlcdc-pwm.txt

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pwm/marvell,pxa-pwm.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Marvell PXA PWM
8+
9+
maintainers:
10+
- Duje Mihanović <[email protected]>
11+
12+
allOf:
13+
- $ref: pwm.yaml#
14+
15+
properties:
16+
compatible:
17+
enum:
18+
- marvell,pxa250-pwm
19+
- marvell,pxa270-pwm
20+
- marvell,pxa168-pwm
21+
- marvell,pxa910-pwm
22+
23+
reg:
24+
# Length should be 0x10
25+
maxItems: 1
26+
27+
"#pwm-cells":
28+
# Used for specifying the period length in nanoseconds
29+
const: 1
30+
31+
clocks:
32+
maxItems: 1
33+
34+
required:
35+
- compatible
36+
- reg
37+
- "#pwm-cells"
38+
- clocks
39+
40+
additionalProperties: false
41+
42+
examples:
43+
- |
44+
#include <dt-bindings/clock/pxa-clock.h>
45+
46+
pwm0: pwm@40b00000 {
47+
compatible = "marvell,pxa250-pwm";
48+
reg = <0x40b00000 0x10>;
49+
#pwm-cells = <1>;
50+
clocks = <&clks CLK_PWM0>;
51+
};

Documentation/devicetree/bindings/pwm/mediatek,mt2712-pwm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ properties:
2424
- mediatek,mt7629-pwm
2525
- mediatek,mt7981-pwm
2626
- mediatek,mt7986-pwm
27+
- mediatek,mt7988-pwm
2728
- mediatek,mt8183-pwm
2829
- mediatek,mt8365-pwm
2930
- mediatek,mt8516-pwm

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

Lines changed: 104 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ title: Amlogic PWM
99
maintainers:
1010
- Heiner Kallweit <[email protected]>
1111

12-
allOf:
13-
- $ref: pwm.yaml#
14-
1512
properties:
1613
compatible:
1714
oneOf:
@@ -24,31 +21,40 @@ properties:
2421
- amlogic,meson-g12a-ee-pwm
2522
- amlogic,meson-g12a-ao-pwm-ab
2623
- amlogic,meson-g12a-ao-pwm-cd
27-
- amlogic,meson-s4-pwm
24+
deprecated: true
2825
- items:
2926
- const: amlogic,meson-gx-pwm
3027
- const: amlogic,meson-gxbb-pwm
28+
deprecated: true
3129
- items:
3230
- const: amlogic,meson-gx-ao-pwm
3331
- const: amlogic,meson-gxbb-ao-pwm
32+
deprecated: true
3433
- items:
3534
- const: amlogic,meson8-pwm
3635
- const: amlogic,meson8b-pwm
36+
deprecated: true
37+
- enum:
38+
- amlogic,meson8-pwm-v2
39+
- amlogic,meson-s4-pwm
40+
- items:
41+
- enum:
42+
- amlogic,meson8b-pwm-v2
43+
- amlogic,meson-gxbb-pwm-v2
44+
- amlogic,meson-axg-pwm-v2
45+
- amlogic,meson-g12-pwm-v2
46+
- const: amlogic,meson8-pwm-v2
3747

3848
reg:
3949
maxItems: 1
4050

4151
clocks:
4252
minItems: 1
43-
maxItems: 2
53+
maxItems: 4
4454

4555
clock-names:
46-
oneOf:
47-
- items:
48-
- enum: [clkin0, clkin1]
49-
- items:
50-
- const: clkin0
51-
- const: clkin1
56+
minItems: 1
57+
maxItems: 2
5258

5359
"#pwm-cells":
5460
const: 3
@@ -57,6 +63,79 @@ required:
5763
- compatible
5864
- reg
5965

66+
allOf:
67+
- $ref: pwm.yaml#
68+
69+
- if:
70+
properties:
71+
compatible:
72+
contains:
73+
enum:
74+
- amlogic,meson8-pwm
75+
- amlogic,meson8b-pwm
76+
- amlogic,meson-gxbb-pwm
77+
- amlogic,meson-gxbb-ao-pwm
78+
- amlogic,meson-axg-ee-pwm
79+
- amlogic,meson-axg-ao-pwm
80+
- amlogic,meson-g12a-ee-pwm
81+
- amlogic,meson-g12a-ao-pwm-ab
82+
- amlogic,meson-g12a-ao-pwm-cd
83+
then:
84+
# Obsolete historic bindings tied to the driver implementation
85+
# The clocks provided here are meant to be matched with the input
86+
# known (hard-coded) in the driver and used to select pwm clock
87+
# source. Currently, the linux driver ignores this.
88+
# This is kept to maintain ABI backward compatibility.
89+
properties:
90+
clocks:
91+
maxItems: 2
92+
clock-names:
93+
oneOf:
94+
- items:
95+
- enum: [clkin0, clkin1]
96+
- items:
97+
- const: clkin0
98+
- const: clkin1
99+
100+
# Newer binding where clock describe the actual clock inputs of the pwm
101+
# block. These are necessary but some inputs may be grounded.
102+
- if:
103+
properties:
104+
compatible:
105+
contains:
106+
enum:
107+
- amlogic,meson8-pwm-v2
108+
then:
109+
properties:
110+
clocks:
111+
minItems: 1
112+
items:
113+
- description: input clock 0 of the pwm block
114+
- description: input clock 1 of the pwm block
115+
- description: input clock 2 of the pwm block
116+
- description: input clock 3 of the pwm block
117+
clock-names: false
118+
required:
119+
- clocks
120+
121+
# Newer IP block take a single input per channel, instead of 4 inputs
122+
# for both channels
123+
- if:
124+
properties:
125+
compatible:
126+
contains:
127+
enum:
128+
- amlogic,meson-s4-pwm
129+
then:
130+
properties:
131+
clocks:
132+
items:
133+
- description: input clock of PWM channel A
134+
- description: input clock of PWM channel B
135+
clock-names: false
136+
required:
137+
- clocks
138+
60139
additionalProperties: false
61140

62141
examples:
@@ -68,3 +147,17 @@ examples:
68147
clock-names = "clkin0", "clkin1";
69148
#pwm-cells = <3>;
70149
};
150+
- |
151+
pwm@2000 {
152+
compatible = "amlogic,meson8-pwm-v2";
153+
reg = <0x1000 0x10>;
154+
clocks = <&xtal>, <0>, <&fdiv4>, <&fdiv5>;
155+
#pwm-cells = <3>;
156+
};
157+
- |
158+
pwm@1000 {
159+
compatible = "amlogic,meson-s4-pwm";
160+
reg = <0x1000 0x10>;
161+
clocks = <&pwm_src_a>, <&pwm_src_b>;
162+
#pwm-cells = <3>;
163+
};

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

Lines changed: 0 additions & 30 deletions
This file was deleted.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ POWER
420420
devm_reboot_mode_unregister()
421421

422422
PWM
423+
devm_pwmchip_alloc()
423424
devm_pwmchip_add()
424425
devm_pwm_get()
425426
devm_fwnode_pwm_get()

Documentation/driver-api/pwm.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,12 @@ to implement the pwm_*() functions itself. This means that it's impossible
143143
to have multiple PWM drivers in the system. For this reason it's mandatory
144144
for new drivers to use the generic PWM framework.
145145

146-
A new PWM controller/chip can be added using pwmchip_add() and removed
147-
again with pwmchip_remove(). pwmchip_add() takes a filled in struct
148-
pwm_chip as argument which provides a description of the PWM chip, the
149-
number of PWM devices provided by the chip and the chip-specific
150-
implementation of the supported PWM operations to the framework.
146+
A new PWM controller/chip can be allocated using pwmchip_alloc(), then
147+
registered using pwmchip_add() and removed again with pwmchip_remove(). To undo
148+
pwmchip_alloc() use pwmchip_put(). pwmchip_add() takes a filled in struct
149+
pwm_chip as argument which provides a description of the PWM chip, the number
150+
of PWM devices provided by the chip and the chip-specific implementation of the
151+
supported PWM operations to the framework.
151152

152153
When implementing polarity support in a PWM driver, make sure to respect the
153154
signal conventions in the PWM framework. By definition, normal polarity

drivers/gpio/gpio-mvebu.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ struct mvebu_pwm {
9999
u32 offset;
100100
unsigned long clk_rate;
101101
struct gpio_desc *gpiod;
102-
struct pwm_chip chip;
103102
spinlock_t lock;
104103
struct mvebu_gpio_chip *mvchip;
105104

@@ -615,7 +614,7 @@ static const struct regmap_config mvebu_gpio_regmap_config = {
615614
*/
616615
static struct mvebu_pwm *to_mvebu_pwm(struct pwm_chip *chip)
617616
{
618-
return container_of(chip, struct mvebu_pwm, chip);
617+
return pwmchip_get_drvdata(chip);
619618
}
620619

621620
static int mvebu_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
@@ -789,6 +788,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
789788
{
790789
struct device *dev = &pdev->dev;
791790
struct mvebu_pwm *mvpwm;
791+
struct pwm_chip *chip;
792792
void __iomem *base;
793793
u32 offset;
794794
u32 set;
@@ -813,9 +813,11 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
813813
if (IS_ERR(mvchip->clk))
814814
return PTR_ERR(mvchip->clk);
815815

816-
mvpwm = devm_kzalloc(dev, sizeof(struct mvebu_pwm), GFP_KERNEL);
817-
if (!mvpwm)
818-
return -ENOMEM;
816+
chip = devm_pwmchip_alloc(dev, mvchip->chip.ngpio, sizeof(*mvpwm));
817+
if (IS_ERR(chip))
818+
return PTR_ERR(chip);
819+
mvpwm = to_mvebu_pwm(chip);
820+
819821
mvchip->mvpwm = mvpwm;
820822
mvpwm->mvchip = mvchip;
821823
mvpwm->offset = offset;
@@ -868,13 +870,11 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
868870
return -EINVAL;
869871
}
870872

871-
mvpwm->chip.dev = dev;
872-
mvpwm->chip.ops = &mvebu_pwm_ops;
873-
mvpwm->chip.npwm = mvchip->chip.ngpio;
873+
chip->ops = &mvebu_pwm_ops;
874874

875875
spin_lock_init(&mvpwm->lock);
876876

877-
return devm_pwmchip_add(dev, &mvpwm->chip);
877+
return devm_pwmchip_add(dev, chip);
878878
}
879879

880880
#ifdef CONFIG_DEBUG_FS

0 commit comments

Comments
 (0)