History log of /linux/rust/kernel/pwm.rs (Results 1 – 8 of 8)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 77956cf3 04-Dec-2025 Linus Torvalds <torvalds@linux-foundation.org>

Merge tag 'pwm/for-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux

Pull pwm updates from Uwe Kleine-König:
"In addition to the usual mix of core cleanups, driver changes,

Merge tag 'pwm/for-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux

Pull pwm updates from Uwe Kleine-König:
"In addition to the usual mix of core cleanups, driver changes, minor
fixes and device tree updates the highlight this cycle is Rust support
for the core and a first Rust driver both provided by Michal
Wilczynski.

Michal wrote about these changes on

https://mwilczynski.dev/posts/bringing-rust-to-the-pwm-subsystem/

which is a nice read"

* tag 'pwm/for-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: (22 commits)
pwm: rzg2l-gpt: Allow checking period_tick cache value only if sibling channel is enabled
pwm: bcm2835: Make sure the channel is enabled after pwm_request()
pwm: mediatek: Make use of struct_size macro
pwm: mediatek: Remove unneeded semicolon
pwm: airoha: Add support for EN7581 SoC
pwm: mediatek: Convert to waveform API
pwm: max7360: Clean MAX7360 code
pwm: Drop unused function pwm_apply_args()
pwm: Use %u to printf unsigned int pwm_chip::npwm and pwm_chip::id
pwm: Simplify printf to emit chip->npwm in $debugfs/pwm
pwm: th1520: Use module_pwm_platform_driver! macro
pwm: th1520: Fix clippy warning for redundant struct field init
pwm: Fix Rust formatting
dt-bindings: pwm: thead: Add T-HEAD TH1520 PWM controller
pwm: Add Rust driver for T-HEAD TH1520 SoC
rust: pwm: Fix broken intra-doc link
rust: pwm: Drop wrapping of PWM polarity and state
rust: pwm: Add module_pwm_platform_driver! macro
rust: pwm: Add complete abstraction layer
rust: pwm: Add Kconfig and basic data structures
...

show more ...


Revision tags: v6.18, v6.18-rc7, v6.18-rc6, v6.18-rc5
# a5d51e02 07-Nov-2025 Uwe Kleine-König <ukleinek@kernel.org>

Merge branch 'pwm/th1520' into pwm/for-next


Revision tags: v6.18-rc4
# 6fe9e919 29-Oct-2025 Miguel Ojeda <ojeda@kernel.org>

pwm: Fix Rust formatting

We do our best to keep the repository `rustfmt`-clean [1], thus run the
tool to fix the formatting issue.

A trailing empty comment [2] is added in order to preserve the wan

pwm: Fix Rust formatting

We do our best to keep the repository `rustfmt`-clean [1], thus run the
tool to fix the formatting issue.

A trailing empty comment [2] is added in order to preserve the wanted
style for imports (otherwise the tool will compact the first two items).

Link: https://rust-for-linux.com/contributing#submit-checklist-addendum [1]
Link: https://docs.kernel.org/rust/coding-guidelines.html#style-formatting [2]
Fixes: d8046cd50879 ("rust: pwm: Add complete abstraction layer")
Fixes: 7b3dce814a15 ("rust: pwm: Add Kconfig and basic data structures")
Fixes: e03724aac758 ("pwm: Add Rust driver for T-HEAD TH1520 SoC")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://patch.msgid.link/20251029182502.783392-1-ojeda@kernel.org
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

show more ...


# 51b4c0f9 29-Oct-2025 Miguel Ojeda <ojeda@kernel.org>

rust: pwm: Fix broken intra-doc link

`rustdoc` reports a broken intra-doc link:

error: unresolved link to `Devres::register`
--> rust/kernel/pwm.rs:722:11
|
722 | /// via [`D

rust: pwm: Fix broken intra-doc link

`rustdoc` reports a broken intra-doc link:

error: unresolved link to `Devres::register`
--> rust/kernel/pwm.rs:722:11
|
722 | /// via [`Devres::register`]. This ties the lifetime of the PWM chip registration
| ^^^^^^^^^^^^^^^^ no item named `Devres` in scope
|
= note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(rustdoc::broken_intra_doc_links)]`

Thus fix it.

Fixes: d8046cd50879 ("rust: pwm: Add complete abstraction layer")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://patch.msgid.link/20251029181940.780629-1-ojeda@kernel.org
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

show more ...


Revision tags: v6.18-rc3
# a69a54f8 25-Oct-2025 Uwe Kleine-König <u.kleine-koenig@baylibre.com>

rust: pwm: Drop wrapping of PWM polarity and state

These were introduced and used in an earlier revision of the patch that
became commit fb3957af9ec6 ("pwm: Add Rust driver for T-HEAD TH1520
SoC").

rust: pwm: Drop wrapping of PWM polarity and state

These were introduced and used in an earlier revision of the patch that
became commit fb3957af9ec6 ("pwm: Add Rust driver for T-HEAD TH1520
SoC"). The variant that was actually applied sticks to the modern
waveform abstraction only (and other drivers are supposed to do that,
too), so they can be dropped.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20251025122359.361372-2-u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

show more ...


# 264b501b 28-Oct-2025 Michal Wilczynski <m.wilczynski@samsung.com>

rust: pwm: Add module_pwm_platform_driver! macro

Rust PWM drivers using the abstractions in `kernel/pwm.rs` typically
call C functions (like `pwmchip_alloc`, `__pwmchip_add`, etc.) that are
exported

rust: pwm: Add module_pwm_platform_driver! macro

Rust PWM drivers using the abstractions in `kernel/pwm.rs` typically
call C functions (like `pwmchip_alloc`, `__pwmchip_add`, etc.) that are
exported to the `PWM` C symbol namespace.

With the introduction of `imports_ns` support in the `module!` macro,
every PWM driver would need to manually include `imports_ns: ["PWM"]` in
its module declaration.

To simplify this for driver authors and ensure consistency, introduce a
new helper macro `module_pwm_platform_driver!` in `pwm.rs`. This macro
wraps the standard `module_platform_driver!`, forwards all user provided
arguments using the `($($user_args:tt)*)` pattern, and automatically
injects the `imports_ns: ["PWM"]` declaration.

This follows the pattern used in other subsystems (e.g.,
`module_pci_driver!`) to provide specialized module registration
helpers. It makes writing PWM drivers slightly simpler and less error
prone regarding namespace imports.

Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
Reviewed-by: Elle Rhumsaa <elle@weathered-steel.dev>
Link: https://patch.msgid.link/20251028-pwm_fixes-v1-2-25a532d31998@samsung.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

show more ...


Revision tags: v6.18-rc2
# d8046cd5 16-Oct-2025 Michal Wilczynski <m.wilczynski@samsung.com>

rust: pwm: Add complete abstraction layer

Introduce a comprehensive abstraction layer for the PWM subsystem to
enable writing drivers in Rust.

Because `Device`, `Chip`, and `PwmOps` all refer to ea

rust: pwm: Add complete abstraction layer

Introduce a comprehensive abstraction layer for the PWM subsystem to
enable writing drivers in Rust.

Because `Device`, `Chip`, and `PwmOps` all refer to each other, they
form a single, indivisible unit with circular dependencies. They are
introduced together in this single commit to create a complete,
compilable abstraction layer.

The main components are:
- Data Wrappers: Safe, idiomatic wrappers for core C types like
`pwm_device`, and `pwm_chip`.

- PwmOps Trait: An interface that drivers can implement to provide
their hardware-specific logic, mirroring the C `pwm_ops` interface.

- FFI VTable and Adapter: A bridge to connect the high-level PwmOps trait
to the C kernel's pwm_ops vtable.

- Allocation and Lifetime Management: A high-level `Chip::new()`
API to safely allocate a chip and a `Registration` guard that integrates
with `devres` to manage the chip's registration with the PWM core.
An `AlwaysRefCounted` implementation and a custom release handler
prevent memory leaks by managing the chip's lifetime and freeing
driver data correctly.

Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Elle Rhumsaa <elle@weathered-steel.dev>
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://patch.msgid.link/20251016-rust-next-pwm-working-fan-for-sending-v16-3-a5df2405d2bd@samsung.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

show more ...


# 7b3dce81 16-Oct-2025 Michal Wilczynski <m.wilczynski@samsung.com>

rust: pwm: Add Kconfig and basic data structures

Introduce the foundational support for PWM abstractions in Rust.

This commit adds the `RUST_PWM_ABSTRACTIONS` Kconfig option to enable
the feature,

rust: pwm: Add Kconfig and basic data structures

Introduce the foundational support for PWM abstractions in Rust.

This commit adds the `RUST_PWM_ABSTRACTIONS` Kconfig option to enable
the feature, along with the necessary build-system support and C
helpers.

It also introduces the first set of safe wrappers for the PWM
subsystem, covering the basic data carrying C structs and enums:
- `Polarity`: A safe wrapper for `enum pwm_polarity`.
- `Waveform`: A wrapper for `struct pwm_waveform`.
- `State`: A wrapper for `struct pwm_state`.

These types provide memory safe, idiomatic Rust representations of the
core PWM data structures and form the building blocks for the
abstractions that will follow.

Tested-by: Drew Fustini <fustini@kernel.org>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Elle Rhumsaa <elle@weathered-steel.dev>
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://patch.msgid.link/20251016-rust-next-pwm-working-fan-for-sending-v16-2-a5df2405d2bd@samsung.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

show more ...