Skip to content

Commit

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

Pull pwm updates from Uwe Kleine-König:
 "This time there are very little changes for pwm. There is nothing new,
  just a few maintenance cleanups.

  The contributors this time around were Krzysztof Kozlowski, Mingwei
  Zheng, Philipp Stanner, and Stanislav Jakubek. Thanks!"

* tag 'pwm/for-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux:
  pwm: stm32: Add check for clk_enable()
  dt-bindings: pwm: Correct indentation and style in DTS example
  pwm: stm32-lp: Add check for clk_enable()
  dt-bindings: pwm: marvell,berlin-pwm: Convert from txt to yaml
  dt-bindings: pwm: sprd,ums512-pwm: convert to YAML
  pwm: Replace deprecated PCI functions
  • Loading branch information
Linus Torvalds committed Jan 22, 2025
2 parents 2bf717b + e8c5979 commit d12f68b
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 86 deletions.
8 changes: 4 additions & 4 deletions Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ unevaluatedProperties: false
examples:
- |
pwm@44b00000 {
compatible = "adi,axi-pwmgen-2.00.a";
reg = <0x44b00000 0x1000>;
clocks = <&spi_clk>;
#pwm-cells = <3>;
compatible = "adi,axi-pwmgen-2.00.a";
reg = <0x44b00000 0x1000>;
clocks = <&spi_clk>;
#pwm-cells = <3>;
};
8 changes: 4 additions & 4 deletions Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ additionalProperties: false
examples:
- |
pwm: pwm@f0408000 {
compatible = "brcm,bcm7038-pwm";
reg = <0xf0408000 0x28>;
#pwm-cells = <2>;
clocks = <&upg_fixed>;
compatible = "brcm,bcm7038-pwm";
reg = <0xf0408000 0x28>;
#pwm-cells = <2>;
clocks = <&upg_fixed>;
};
8 changes: 4 additions & 4 deletions Documentation/devicetree/bindings/pwm/brcm,kona-pwm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ examples:
#include <dt-bindings/clock/bcm281xx.h>
pwm@3e01a000 {
compatible = "brcm,bcm11351-pwm", "brcm,kona-pwm";
reg = <0x3e01a000 0xcc>;
clocks = <&slave_ccu BCM281XX_SLAVE_CCU_PWM>;
#pwm-cells = <3>;
compatible = "brcm,bcm11351-pwm", "brcm,kona-pwm";
reg = <0x3e01a000 0xcc>;
clocks = <&slave_ccu BCM281XX_SLAVE_CCU_PWM>;
#pwm-cells = <3>;
};
...
44 changes: 44 additions & 0 deletions Documentation/devicetree/bindings/pwm/marvell,berlin-pwm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/pwm/marvell,berlin-pwm.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Berlin PWM controller

maintainers:
- Jisheng Zhang <jszhang@kernel.org>
- Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

properties:
compatible:
const: marvell,berlin-pwm

reg:
maxItems: 1

"#pwm-cells":
const: 3

clocks:
maxItems: 1

required:
- compatible
- reg
- clocks

allOf:
- $ref: pwm.yaml#

unevaluatedProperties: false

examples:
- |
pwm@f7f20000 {
compatible = "marvell,berlin-pwm";
reg = <0xf7f20000 0x40>;
clocks = <&chip_clk 12>;
#pwm-cells = <3>;
};
17 changes: 0 additions & 17 deletions Documentation/devicetree/bindings/pwm/pwm-berlin.txt

This file was deleted.

40 changes: 0 additions & 40 deletions Documentation/devicetree/bindings/pwm/pwm-sprd.txt

This file was deleted.

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

title: Spreadtrum/Unisoc UMS512 PWM Controller

maintainers:
- Orson Zhai <orsonzhai@gmail.com>
- Baolin Wang <baolin.wang@linux.alibaba.com>
- Chunyan Zhang <zhang.lyra@gmail.com>

properties:
compatible:
const: sprd,ums512-pwm

reg:
maxItems: 1

clocks:
maxItems: 8

clock-names:
items:
- const: pwm0
- const: enable0
- const: pwm1
- const: enable1
- const: pwm2
- const: enable2
- const: pwm3
- const: enable3

'#pwm-cells':
const: 2

required:
- compatible
- reg
- clocks
- clock-names

allOf:
- $ref: pwm.yaml#

unevaluatedProperties: false

examples:
- |
#include <dt-bindings/clock/sprd,ums512-clk.h>
pwm@32260000 {
compatible = "sprd,ums512-pwm";
reg = <0x32260000 0x10000>;
clocks = <&aon_clk CLK_PWM0>, <&aonapb_gate CLK_PWM0_EB>,
<&aon_clk CLK_PWM1>, <&aonapb_gate CLK_PWM1_EB>,
<&aon_clk CLK_PWM2>, <&aonapb_gate CLK_PWM2_EB>,
<&aon_clk CLK_PWM3>, <&aonapb_gate CLK_PWM3_EB>;
clock-names = "pwm0", "enable0",
"pwm1", "enable1",
"pwm2", "enable2",
"pwm3", "enable3";
#pwm-cells = <2>;
};
...
14 changes: 5 additions & 9 deletions drivers/pwm/pwm-dwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,16 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id)

pci_set_master(pci);

ret = pcim_iomap_regions(pci, BIT(0), pci_name(pci));
if (ret)
return dev_err_probe(dev, ret, "Failed to iomap PCI BAR\n");

info = (const struct dwc_pwm_info *)id->driver_data;
ddata = devm_kzalloc(dev, struct_size(ddata, chips, info->nr), GFP_KERNEL);
if (!ddata)
return -ENOMEM;

/*
* No need to check for pcim_iomap_table() failure,
* pcim_iomap_regions() already does it for us.
*/
ddata->io_base = pcim_iomap_table(pci)[0];
ddata->io_base = pcim_iomap_region(pci, 0, "pwm-dwc");
if (IS_ERR(ddata->io_base))
return dev_err_probe(dev, PTR_ERR(ddata->io_base),
"Failed to request / iomap PCI BAR\n");

ddata->info = info;

for (idx = 0; idx < ddata->info->nr; idx++) {
Expand Down
9 changes: 5 additions & 4 deletions drivers/pwm/pwm-lpss-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ static int pwm_lpss_probe_pci(struct pci_dev *pdev,
const struct pci_device_id *id)
{
const struct pwm_lpss_boardinfo *info;
void __iomem *io_base;
struct pwm_chip *chip;
int err;

err = pcim_enable_device(pdev);
if (err < 0)
return err;

err = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev));
if (err)
return err;
io_base = pcim_iomap_region(pdev, 0, "pwm-lpss");
if (IS_ERR(io_base))
return PTR_ERR(io_base);

info = (struct pwm_lpss_boardinfo *)id->driver_data;
chip = devm_pwm_lpss_probe(&pdev->dev, pcim_iomap_table(pdev)[0], info);
chip = devm_pwm_lpss_probe(&pdev->dev, io_base, info);
if (IS_ERR(chip))
return PTR_ERR(chip);

Expand Down
8 changes: 6 additions & 2 deletions drivers/pwm/pwm-stm32-lp.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,12 @@ static int stm32_pwm_lp_get_state(struct pwm_chip *chip,
regmap_read(priv->regmap, STM32_LPTIM_CR, &val);
state->enabled = !!FIELD_GET(STM32_LPTIM_ENABLE, val);
/* Keep PWM counter clock refcount in sync with PWM initial state */
if (state->enabled)
clk_enable(priv->clk);
if (state->enabled) {
int ret = clk_enable(priv->clk);

if (ret)
return ret;
}

regmap_read(priv->regmap, STM32_LPTIM_CFGR, &val);
presc = FIELD_GET(STM32_LPTIM_PRESC, val);
Expand Down
7 changes: 5 additions & 2 deletions drivers/pwm/pwm-stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,11 @@ static int stm32_pwm_probe(struct platform_device *pdev)
chip->ops = &stm32pwm_ops;

/* Initialize clock refcount to number of enabled PWM channels. */
for (i = 0; i < num_enabled; i++)
clk_enable(priv->clk);
for (i = 0; i < num_enabled; i++) {
ret = clk_enable(priv->clk);
if (ret)
return ret;
}

ret = devm_pwmchip_add(dev, chip);
if (ret < 0)
Expand Down

0 comments on commit d12f68b

Please sign in to comment.