[PATCH v3 0/2] rust: clk: Add ExclusiveClk and use it in pwm-th1520
From: Maurice Hieronymus
Date: Sun Jun 28 2026 - 16:18:19 EST
Add a Rust binding for clk_rate_exclusive_get() / clk_rate_exclusive_put()
and use it in pwm-th1520, which previously carried a TODO noting the
missing binding.
Based on clk/clk-next
Signed-off-by: Maurice Hieronymus <mhi@xxxxxxxxxxx>
---
Changes in v3:
- Add #[inline] to Clk::rate_exclusive_get() (Onur Özkan)
- Drop intra-doc links from the regular SAFETY comments (Onur Özkan)
- Rebase on Daniel Almeida's Clk type-state pattern
https://lore.kernel.org/rust-for-linux/20260618-clk-type-state-v4-0-8be082786080@xxxxxxxxxxxxx/
- Use vertical imports in pwm_th1520.rs
- Link to v2: https://lore.kernel.org/r/20260605-rate-exclusive-get-th1520-v2-0-695640bf7249@xxxxxxxxxxx
Changes in v2:
- Rebase on pwm/for-next
- Remove newline after [`clk_rate_exclusive_get`] comment
- Remove unused [`struct clk`] link
- Put semicolon outside of unsafe block
- Link to v1: https://lore.kernel.org/r/20260526-rate-exclusive-get-th1520-v1-0-34cf034e1764@xxxxxxxxxxx
---
Maurice Hieronymus (2):
rust: clk: Add `ExclusiveClk` wrapper for `clk_rate_exclusive_get`
pwm: th1520: Lock clock rate with clk_rate_exclusive_get
drivers/pwm/pwm_th1520.rs | 18 ++++++++-----
rust/kernel/clk.rs | 67 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 6 deletions(-)
---
base-commit: 8d03cc42a42b1a3f1535757f65bfb74a9753953f
change-id: 20260526-rate-exclusive-get-th1520-764a949de18e
prerequisite-change-id: 20250909-clk-type-state-c01aa7dd551d:v4
prerequisite-patch-id: 03177c5f8e355964643fc1eb78016c702a84f3d4
prerequisite-patch-id: a5c5ccd624964eda85aab9f425c6340ede7fcf5d
prerequisite-patch-id: 92bd8e4df3194eff330e1bc2fc3386d21c3c56d0
Best regards,
--
Maurice Hieronymus <mhi@xxxxxxxxxxx>