Skip to content

Commit 9d81e2d

Browse files
committed
Merge tag 'pwm/for-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux
Pull pwm updates from Uwe Kleine-König: "Apart for the normal updates for dt bindings, cleanups and support for new device variants to existing drivers this completes the conversion to pwmchip_alloc() which was started in the v6.9 development cycle. Using pwmchip_alloc() is a precondition to the character device support which allows easier and faster access to PWM devices. However there are some issues I want to clean up before including it in mainline, so this isn't contained here despite it was in next for some time. Thanks to Alexandre Mergnat, Binbin Zhou, Dmitry Rokosov, George Stark, Jerome Brunet and Varshini Rajendran for their contributions. Further thanks go to AngeloGioacchino Del Regno, Conor Dooley, David Lechner, Fabrice Gasnier, Florian Fainelli, Guenter Roeck, Gustavo A. R. Silva, Krzysztof Kozlowski and Rob Herring for valuable patch review" * tag 'pwm/for-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: (34 commits) pwm: pca9685: Drop explicit initialization of struct i2c_device_id::driver_data to 0 dt-bindings: pwm: snps,dw-apb-timers: Do not require pwm-cells twice dt-bindings: pwm: mediatek,pwm-disp: Do not require pwm-cells twice dt-bindings: pwm: mediatek,mt2712: Do not require pwm-cells twice dt-bindings: pwm: marvell,pxa: Do not require pwm-cells twice dt-bindings: pwm: google,cros-ec: Do not require pwm-cells twice dt-bindings: pwm: bcm2835: Do not require pwm-cells twice pwm: meson: Use mul_u64_u64_div_u64() for frequency calculating pwm: meson: Add check for error from clk_round_rate() pwm: meson: Drop unneeded check in .get_state() dt-bindings: pwm: mediatek,pwm-disp: add compatible for mt8365 SoC pwm: meson: Add generic compatible for meson8 to sm1 pwm: bcm2835: Drop open coded variant of devm_clk_rate_exclusive_get() pwm: bcm2835: Introduce a local variable for &pdev->dev pwm: stm32: Calculate prescaler with a division instead of a loop pwm: stm32: Fix for settings using period > UINT32_MAX pwm: stm32: Improve precision of calculation in .apply() pwm: stm32: Add error messages in .probe()'s error paths pwm: Make pwmchip_[sg]et_drvdata() a wrapper around dev_set_drvdata() pwm: Don't check pointer for being non-NULL after use ...
2 parents 00fddaf + 4817118 commit 9d81e2d

18 files changed

+830
-857
lines changed

Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ properties:
2525
- items:
2626
- const: microchip,sama7g5-pwm
2727
- const: atmel,sama5d2-pwm
28+
- items:
29+
- const: microchip,sam9x7-pwm
30+
- const: microchip,sam9x60-pwm
2831

2932
reg:
3033
maxItems: 1

Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ properties:
3535

3636
required:
3737
- compatible
38-
- '#pwm-cells'
3938

4039
additionalProperties: false
4140

Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ properties:
3434
required:
3535
- compatible
3636
- reg
37-
- "#pwm-cells"
3837
- clocks
3938

4039
additionalProperties: false

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ properties:
6666
required:
6767
- compatible
6868
- reg
69-
- "#pwm-cells"
7069
- clocks
7170
- clock-names
7271

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ properties:
3131
- mediatek,mt8188-disp-pwm
3232
- mediatek,mt8192-disp-pwm
3333
- mediatek,mt8195-disp-pwm
34+
- mediatek,mt8365-disp-pwm
3435
- const: mediatek,mt8183-disp-pwm
3536

3637
reg:
@@ -58,7 +59,6 @@ properties:
5859
required:
5960
- compatible
6061
- reg
61-
- "#pwm-cells"
6262
- clocks
6363
- clock-names
6464

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ required:
2929
- compatible
3030
- reg
3131
- clocks
32-
- "#pwm-cells"
3332

3433
additionalProperties: false
3534

Documentation/devicetree/bindings/pwm/snps,dw-apb-timers-pwm2.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ properties:
5151
required:
5252
- compatible
5353
- reg
54-
- "#pwm-cells"
5554
- clocks
5655
- clock-names
5756

drivers/hwmon/aspeed-g6-pwm-tach.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,14 @@ struct aspeed_pwm_tach_data {
136136
struct clk *clk;
137137
struct reset_control *reset;
138138
unsigned long clk_rate;
139-
struct pwm_chip chip;
140139
bool tach_present[TACH_ASPEED_NR_TACHS];
141140
u32 tach_divisor;
142141
};
143142

144143
static inline struct aspeed_pwm_tach_data *
145144
aspeed_pwm_chip_to_data(struct pwm_chip *chip)
146145
{
147-
return container_of(chip, struct aspeed_pwm_tach_data, chip);
146+
return pwmchip_get_drvdata(chip);
148147
}
149148

150149
static int aspeed_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
@@ -195,7 +194,7 @@ static int aspeed_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
195194

196195
expect_period = div64_u64(ULLONG_MAX, (u64)priv->clk_rate);
197196
expect_period = min(expect_period, state->period);
198-
dev_dbg(chip->dev, "expect period: %lldns, duty_cycle: %lldns",
197+
dev_dbg(pwmchip_parent(chip), "expect period: %lldns, duty_cycle: %lldns",
199198
expect_period, state->duty_cycle);
200199
/*
201200
* Pick the smallest value for div_h so that div_l can be the biggest
@@ -218,12 +217,12 @@ static int aspeed_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
218217
if (div_l > 255)
219218
div_l = 255;
220219

221-
dev_dbg(chip->dev, "clk source: %ld div_h %lld, div_l : %lld\n",
220+
dev_dbg(pwmchip_parent(chip), "clk source: %ld div_h %lld, div_l : %lld\n",
222221
priv->clk_rate, div_h, div_l);
223222
/* duty_pt = duty_cycle * (PERIOD + 1) / period */
224223
duty_pt = div64_u64(state->duty_cycle * priv->clk_rate,
225224
(u64)NSEC_PER_SEC * (div_l + 1) << div_h);
226-
dev_dbg(chip->dev, "duty_cycle = %lld, duty_pt = %d\n",
225+
dev_dbg(pwmchip_parent(chip), "duty_cycle = %lld, duty_pt = %d\n",
227226
state->duty_cycle, duty_pt);
228227

229228
/*
@@ -459,6 +458,7 @@ static int aspeed_pwm_tach_probe(struct platform_device *pdev)
459458
int ret;
460459
struct device_node *child;
461460
struct aspeed_pwm_tach_data *priv;
461+
struct pwm_chip *chip;
462462

463463
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
464464
if (!priv)
@@ -487,11 +487,14 @@ static int aspeed_pwm_tach_probe(struct platform_device *pdev)
487487
if (ret)
488488
return ret;
489489

490-
priv->chip.dev = dev;
491-
priv->chip.ops = &aspeed_pwm_ops;
492-
priv->chip.npwm = PWM_ASPEED_NR_PWMS;
490+
chip = devm_pwmchip_alloc(dev, PWM_ASPEED_NR_PWMS, 0);
491+
if (IS_ERR(chip))
492+
return PTR_ERR(chip);
493493

494-
ret = devm_pwmchip_add(dev, &priv->chip);
494+
pwmchip_set_drvdata(chip, priv);
495+
chip->ops = &aspeed_pwm_ops;
496+
497+
ret = devm_pwmchip_add(dev, chip);
495498
if (ret)
496499
return dev_err_probe(dev, ret, "Failed to add PWM chip\n");
497500

drivers/pwm/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ menuconfig PWM
2929

3030
if PWM
3131

32-
config PWM_SYSFS
33-
bool
34-
default y if SYSFS
35-
3632
config PWM_DEBUG
3733
bool "PWM lowlevel drivers additional checks and debug messages"
3834
depends on DEBUG_KERNEL

drivers/pwm/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0
22
obj-$(CONFIG_PWM) += core.o
3-
obj-$(CONFIG_PWM_SYSFS) += sysfs.o
43
obj-$(CONFIG_PWM_AB8500) += pwm-ab8500.o
54
obj-$(CONFIG_PWM_APPLE) += pwm-apple.o
65
obj-$(CONFIG_PWM_ATMEL) += pwm-atmel.o

0 commit comments

Comments
 (0)