MAINTAINERS | 1 + rust/bindings/bindings_helper.h | 1 + rust/helpers/helpers.c | 1 + rust/helpers/regulator.c | 43 +++++ rust/kernel/lib.rs | 1 + rust/kernel/regulator.rs | 418 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 465 insertions(+)
Changes in v8:
- Added Alex's r-b
- Added helpers/regulator.c, since the stubs are declared as inline if
CONFIG_REGULATOR is not set (Intel bot)
- Removed unneeded "regulator.enable()" line from docs: it was not needed
and, ironically, it misused the API by choosing Regulator<Dynamic>
and then not keeping the enabled count count balenced (Alex)
- Clarified that the "Enabled" state decreases the enabled refcount when it
drops (Alex)
- Renamed "Microvolt" as "Voltage" and introduced
from_microvolts/as_microvolts (Alex)
- Fixed the spelling for MAINTAINERS in the second commit (Alex)
- Link to v7: https://lore.kernel.org/rust-for-linux/20250704-topics-tyr-regulator-v7-0-77bfca2e22dc@collabora.com/
Changes in v7:
- Add RegulatorState::DISABLE_ON_DROP (Alice)
- Remove #[cfg(CONFIG_REGULATOR)] in lib.rs (if this is N we will use
the stubs)
- Add the bound on 'static directly on RegulatorState to avoid
repetition
- Removed the `data` member on the example (Alice)
- Removed the `mut` token from try_into_enabled() and
try_into_disabled() (Miguel & Intel bot)
- Link to v6: https://lore.kernel.org/r/20250627-topics-tyr-regulator-v6-0-1d015219b454@collabora.com
Changes in v6:
- Use ManuallyDrop<T> to avoid running the destructor in
try_into_enabled() and try_into_disabled(). This is the same strategy
that was being used successfully in the pre-typestate version of this
patch
- Link to v5: https://lore.kernel.org/r/20250623-topics-tyr-regulator-v5-0-99069658cb54@collabora.com
Changes in v5:
- Remove TryIntoEnabled and TryIntoDisabled traits (they were only
implemented for a single type anyways)
- Added regulator.rs to VOLTAGE AND CURRENT REGULATOR FRAMEWORK
- Applied the diff from Miguel Ojeda to format the docs
- Link to v4: https://lore.kernel.org/r/20250609-topics-tyr-regulator-v4-1-b4fdcf1385a7@collabora.com
Changes in v4:
- Rewrote the abstraction to use typestates as per the suggestions by
Benno and Alex.
- Introduced the `Dynamic` state.
- Added more examples.
- Fixed some broken docs.
- Link to v3: https://lore.kernel.org/r/20250513-topics-tyr-regulator-v3-1-4cc2704dfec6@collabora.com
Changes in v3:
- Rebased on rust-next
- Added examples to showcase the API
- Fixed some rendering issues in the docs
- Exposed {get|set}_voltage for both Regulator and EnabledRegulator
- Derived Clone, Copy, PartialEq and Eq for Microvolt
- Link to v2: https://lore.kernel.org/r/20250326-topics-tyr-regulator-v2-1-c0ea6a861be6@collabora.com
Resend v2:
- cc Regulator maintainers
Changes from v1:
- Rebased on rust-next
- Split the design into two types as suggested by Alice Ryhl.
- Modify the docs to highlight how users can use kernel::types::Either
or an enum to enable and disable the regulator at runtime.
- Link to v1: https://lore.kernel.org/rust-for-linux/20250219162517.278362-1-daniel.almeida@collabora.com/
---
Daniel Almeida (2):
rust: regulator: add a bare minimum regulator abstraction
MAINTAINERS: add regulator.rs to the regulator API entry
MAINTAINERS | 1 +
rust/bindings/bindings_helper.h | 1 +
rust/helpers/helpers.c | 1 +
rust/helpers/regulator.c | 43 +++++
rust/kernel/lib.rs | 1 +
rust/kernel/regulator.rs | 418 ++++++++++++++++++++++++++++++++++++++++
6 files changed, 465 insertions(+)
---
base-commit: e04c78d86a9699d136910cfc0bdcf01087e3267e
change-id: 20250714-topics-tyr-regulator2-3aecd5492b2d
Best regards,
--
Daniel Almeida <daniel.almeida@collabora.com>
On Mon, 14 Jul 2025 15:52:03 -0300, Daniel Almeida wrote:
> Changes in v8:
> - Added Alex's r-b
> - Added helpers/regulator.c, since the stubs are declared as inline if
> CONFIG_REGULATOR is not set (Intel bot)
> - Removed unneeded "regulator.enable()" line from docs: it was not needed
> and, ironically, it misused the API by choosing Regulator<Dynamic>
> and then not keeping the enabled count count balenced (Alex)
> - Clarified that the "Enabled" state decreases the enabled refcount when it
> drops (Alex)
> - Renamed "Microvolt" as "Voltage" and introduced
> from_microvolts/as_microvolts (Alex)
> - Fixed the spelling for MAINTAINERS in the second commit (Alex)
> - Link to v7: https://lore.kernel.org/rust-for-linux/20250704-topics-tyr-regulator-v7-0-77bfca2e22dc@collabora.com/
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/2] rust: regulator: add a bare minimum regulator abstraction
commit: 9b614ceada7cb846de1a1c3bb0b29b0a2726ef45
[2/2] MAINTAINERS: add regulator.rs to the regulator API entry
commit: d9f334fca5448907cc47ba8553926f9ba148512f
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
Mark, this looks like a good candidate for merging, how do you want to go about this? I believe that this should go through the regulator tree, but I guess it can go through the Rust tree if you give your acked-by. -- Daniel
© 2016 - 2026 Red Hat, Inc.