|
|
Log in / Subscribe / Register

rust: Add basic clock abstractions

From:  Viresh Kumar <viresh.kumar-AT-linaro.org>
To:  Alex Gaynor <alex.gaynor-AT-gmail.com>, Alice Ryhl <aliceryhl-AT-google.com>, Andreas Hindborg <a.hindborg-AT-kernel.org>, Benno Lossin <benno.lossin-AT-proton.me>, Björn Roy Baron <bjorn3_gh-AT-protonmail.com>, Boqun Feng <boqun.feng-AT-gmail.com>, Gary Guo <gary-AT-garyguo.net>, Michael Turquette <mturquette-AT-baylibre.com>, Miguel Ojeda <ojeda-AT-kernel.org>, Stephen Boyd <sboyd-AT-kernel.org>, Trevor Gross <tmgross-AT-umich.edu>
Subject:  [PATCH V3 0/2] rust: Add basic clock abstractions
Date:  Mon, 03 Mar 2025 15:28:08 +0530
Message-ID:  <cover.1740995194.git.viresh.kumar@linaro.org>
Cc:  Viresh Kumar <viresh.kumar-AT-linaro.org>, Russell King <linux-AT-armlinux.org.uk>, linux-clk-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org, rust-for-linux-AT-vger.kernel.org, Vincent Guittot <vincent.guittot-AT-linaro.org>, Daniel Almeida <daniel.almeida-AT-collabora.com>
Archive-link:  Article

Hello,

This adds initial abstractions for the clk APIs. These provide the minimal
functionality needed for common use cases, making them straightforward to
introduce in the first iteration.

These will be used by Rust based cpufreq / OPP layers to begin with.

For now I have added them under the maintainership umbrella of the common clk
framework, please let me know if I should do it differently.

If possible, I would like to get these merged via the PM tree along with
cpufreq/OPP abstractions, but its okay otherwise too.

Danilo: I haven't done anything about MaybeNull<T> yet, as we can not access
fields of the C clk pointer from Rust code. Not sure if that is still required
or not.

--
Viresh

V2->V3:
- Add type Hertz (Daniel Almeida).
- Improved comments in helpers.rs (Daniel Almeida).
- s/Clk::new/Clk::get/ (Daniel Almeida).
- Implement OptionalClk as well (Rob Herring).
- Fix Safety comments (Danilo Krummrich).
- Add tags from Daniel Almeida.

V1->V2:
- Post this as an independent series.
- Include more APIs, apart from clk_get() and clk_put().

Viresh Kumar (2):
  rust: Add clk helpers
  rust: Add initial clk abstractions

 MAINTAINERS                     |   2 +
 rust/bindings/bindings_helper.h |   1 +
 rust/helpers/clk.c              |  66 ++++++++++++++++
 rust/helpers/helpers.c          |   1 +
 rust/kernel/clk.rs              | 134 ++++++++++++++++++++++++++++++++
 rust/kernel/lib.rs              |   1 +
 6 files changed, 205 insertions(+)
 create mode 100644 rust/helpers/clk.c
 create mode 100644 rust/kernel/clk.rs

-- 
2.31.1.272.g89b43f80a514




Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds