Re: [PATCH 0/7] rust: reset: add reset control abstractions

From: Philipp Zabel

Date: Fri Nov 27 2026 - 05:30:46 EST


Hi Daniel,

On Do, 2026-11-26 at 13:04 -0300, Daniel Almeida wrote:
> This series adds a Rust abstraction for the consumer side of the reset
> controller API.

I've been looking forward to this for a while. I'll need some time to
digest this, but let's start with some vague thoughts.

I hope we can use this opportunity to improve the somewhat fuzzy C API
as well.

There's exclusive vs shared reset controls, self-clearing resets that
pulse under firmware or hardware control vs direct assert/deassert
level control, and as I recently discovered, sleeping vs non-sleeping
use cases, all mixed into the same API. I'd like to make this more
explicit in the C API, but have to weigh against potential driver
churn.

And then there's device_reset(), which can also divert to ACPI _RST...

> A driver can get the reset lines of its device, as an
> exclusive or a shared reset control, and assert and deassert them.

I like using the type system to separate exclusive and shared reset
controls.

> This will be used by the upcoming rkvenc driver that my colleagues
> Detlev Casanova, Nicolas Dufresne and I are working on, to recover a
> hung core of the encoder without stopping the other one. More details on
> this driver can be found by watching Nicolas Dufresne's talk at LPC 2026
> [0]. Samsung's Rust UFS RFC [1] also uses reset lines, through an
> abstraction that it has not posted.

Could you point me to an example that shows how your bindings are used?

> The abstraction follows the regulator abstraction and the clk series
> [2], with the reset state as a type parameter.
>
> Patch 1 adds the C helpers that patch 2 needs.
>
> Patch 2 adds ExclusiveResetControl, with the Unknown, Asserted and
> Deasserted states.

When a reset_control_assert/deassert() fails, does the state go back to
Unknown?

> Patch 3 adds ExclusiveResetControl::get_array() and
> get_array_optional(), which get all the reset lines of a device as one
> control.

Do you have any users for this?

> Patch 4 adds AssertedGuard, which asserts the line of an exclusive
> control in the Unknown state and deasserts it when dropped, as a
> convenience for drivers.

Same question, I'd like to see how this is used.

> Patch 5 adds SharedResetControl, with the Unknown and Deasserted states
> only, and patch 6 adds its array getters.

And this.

> Patch 7 adds ExclusiveResetControl::devm_deassert() and
> devm_deassert_optional(), for drivers that only need their line
> deasserted while they are bound.

This seems like a straightforward equivalent to
Regulator::devm_enable()?

> reset_control_reset(), the bulk API and the shared devm getters are not
> covered,

Why did you decide to leave those out specifically?

I think the _reset() vs _assert/deassert() APIs could be wrapped in a
TriggeredResetControl vs LevelResetControl (or ResetTrigger/ResetPulse
vs ResetControl?) to separate the two APIs.


regards
Philipp