Skip to content

Commit a5d51e0

Browse files
author
Uwe Kleine-König
committed
Merge branch 'pwm/th1520' into pwm/for-next
2 parents 0a47e5e + 9075cee commit a5d51e0

13 files changed

Lines changed: 1244 additions & 1 deletion

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pwm/thead,th1520-pwm.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: T-HEAD TH1520 PWM controller
8+
9+
maintainers:
10+
- Michal Wilczynski <m.wilczynski@samsung.com>
11+
12+
allOf:
13+
- $ref: pwm.yaml#
14+
15+
properties:
16+
compatible:
17+
const: thead,th1520-pwm
18+
19+
reg:
20+
maxItems: 1
21+
22+
clocks:
23+
items:
24+
- description: SoC PWM clock
25+
26+
"#pwm-cells":
27+
const: 3
28+
29+
required:
30+
- compatible
31+
- reg
32+
- clocks
33+
34+
unevaluatedProperties: false
35+
36+
examples:
37+
- |
38+
#include <dt-bindings/clock/thead,th1520-clk-ap.h>
39+
soc {
40+
#address-cells = <2>;
41+
#size-cells = <2>;
42+
pwm@ffec01c000 {
43+
compatible = "thead,th1520-pwm";
44+
reg = <0xff 0xec01c000 0x0 0x4000>;
45+
clocks = <&clk CLK_PWM>;
46+
#pwm-cells = <3>;
47+
};
48+
};

MAINTAINERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20763,6 +20763,14 @@ F: include/linux/pwm.h
2076320763
F: include/linux/pwm_backlight.h
2076420764
K: pwm_(config|apply_might_sleep|apply_atomic|ops)
2076520765

20766+
PWM SUBSYSTEM BINDINGS [RUST]
20767+
M: Michal Wilczynski <m.wilczynski@samsung.com>
20768+
L: linux-pwm@vger.kernel.org
20769+
L: rust-for-linux@vger.kernel.org
20770+
S: Maintained
20771+
F: rust/helpers/pwm.c
20772+
F: rust/kernel/pwm.rs
20773+
2076620774
PXA GPIO DRIVER
2076720775
M: Robert Jarzmik <robert.jarzmik@free.fr>
2076820776
L: linux-gpio@vger.kernel.org
@@ -22171,6 +22179,7 @@ F: Documentation/devicetree/bindings/firmware/thead,th1520-aon.yaml
2217122179
F: Documentation/devicetree/bindings/mailbox/thead,th1520-mbox.yaml
2217222180
F: Documentation/devicetree/bindings/net/thead,th1520-gmac.yaml
2217322181
F: Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml
22182+
F: Documentation/devicetree/bindings/pwm/thead,th1520-pwm.yaml
2217422183
F: Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml
2217522184
F: arch/riscv/boot/dts/thead/
2217622185
F: drivers/clk/thead/clk-th1520-ap.c
@@ -22181,6 +22190,7 @@ F: drivers/pinctrl/pinctrl-th1520.c
2218122190
F: drivers/pmdomain/thead/
2218222191
F: drivers/power/reset/th1520-aon-reboot.c
2218322192
F: drivers/power/sequencing/pwrseq-thead-gpu.c
22193+
F: drivers/pwm/pwm_th1520.rs
2218422194
F: drivers/reset/reset-th1520.c
2218522195
F: include/dt-bindings/clock/thead,th1520-clk-ap.h
2218622196
F: include/dt-bindings/power/thead,th1520-power.h

drivers/pwm/Kconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,17 @@ config PWM_TEGRA
758758
To compile this driver as a module, choose M here: the module
759759
will be called pwm-tegra.
760760

761+
config PWM_TH1520
762+
tristate "TH1520 PWM support"
763+
depends on RUST
764+
select RUST_PWM_ABSTRACTIONS
765+
help
766+
This option enables the driver for the PWM controller found on the
767+
T-HEAD TH1520 SoC.
768+
769+
To compile this driver as a module, choose M here; the module
770+
will be called pwm-th1520. If you are unsure, say N.
771+
761772
config PWM_TIECAP
762773
tristate "ECAP PWM support"
763774
depends on ARCH_OMAP2PLUS || ARCH_DAVINCI_DA8XX || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
@@ -829,4 +840,16 @@ config PWM_XILINX
829840
To compile this driver as a module, choose M here: the module
830841
will be called pwm-xilinx.
831842

843+
config RUST_PWM_ABSTRACTIONS
844+
bool
845+
depends on RUST
846+
help
847+
This option enables the safe Rust abstraction layer for the PWM
848+
subsystem. It provides idiomatic wrappers and traits necessary for
849+
writing PWM controller drivers in Rust.
850+
851+
The abstractions handle resource management (like memory and reference
852+
counting) and provide safe interfaces to the underlying C core,
853+
allowing driver logic to be written in safe Rust.
854+
832855
endif

drivers/pwm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ obj-$(CONFIG_PWM_STMPE) += pwm-stmpe.o
6969
obj-$(CONFIG_PWM_SUN4I) += pwm-sun4i.o
7070
obj-$(CONFIG_PWM_SUNPLUS) += pwm-sunplus.o
7171
obj-$(CONFIG_PWM_TEGRA) += pwm-tegra.o
72+
obj-$(CONFIG_PWM_TH1520) += pwm_th1520.o
7273
obj-$(CONFIG_PWM_TIECAP) += pwm-tiecap.o
7374
obj-$(CONFIG_PWM_TIEHRPWM) += pwm-tiehrpwm.o
7475
obj-$(CONFIG_PWM_TWL) += pwm-twl.o

drivers/pwm/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1608,12 +1608,13 @@ void pwmchip_put(struct pwm_chip *chip)
16081608
}
16091609
EXPORT_SYMBOL_GPL(pwmchip_put);
16101610

1611-
static void pwmchip_release(struct device *pwmchip_dev)
1611+
void pwmchip_release(struct device *pwmchip_dev)
16121612
{
16131613
struct pwm_chip *chip = pwmchip_from_dev(pwmchip_dev);
16141614

16151615
kfree(chip);
16161616
}
1617+
EXPORT_SYMBOL_GPL(pwmchip_release);
16171618

16181619
struct pwm_chip *pwmchip_alloc(struct device *parent, unsigned int npwm, size_t sizeof_priv)
16191620
{

0 commit comments

Comments
 (0)