Re: (subset) [PATCH v2 0/7] Devm helpers for regulator get and enable

From: Mark Brown
Date: Tue Aug 16 2022 - 01:31:21 EST


On Mon, Aug 15, 2022 at 01:58:55PM -0700, Stephen Boyd wrote:
> Quoting Laurent Pinchart (2022-08-15 11:52:36)
> > On Mon, Aug 15, 2022 at 05:33:06PM +0100, Mark Brown wrote:
> > > On Mon, Aug 15, 2022 at 06:54:45PM +0300, Laurent Pinchart wrote:

> > > > - With devres, you don't have full control over the order in which
> > > > resources will be released, which means that you can't control the
> > > > power off sequence, in particular if it needs to be sequenced with
> > > > GPIOs and clocks. That's not a concern for all drivers, but this API
> > > > will creep in in places where it shouldn't be used, driver authours
> > > > should really pay attention to power management and not live with the
> > > > false impression that everything will be handled automatically for
> > > > them. In the worst cases, an incorrect power off sequence could lead
> > > > to hardware damage.

> I think the main issue is that platform drivers are being asked to do
> too much. We've put the burden on platform driver authors to intimately
> understand how their devices are integrated, and as we all know they're

This is for the regulator API, it's mainly for off SoC devices so it's
not a question of understanding the integration of a device into a piece
of silicon, it's a question of understanding the integration of a chip
into a board which seems reasonably in scope for a chip driver and is
certainly the sort of thing that you'd be talking to your customers
about as a silicon vendor.

> The basic idea is that drivers should be focused on what they're
> driving, not navigating the (sometimes) complex integration that's
> taking place around them. When a device driver probe function is called
> the device should already be powered on. When the driver is
> removed/unbound, the power should be removed after the driver's remove
> function is called. We're only going to be able to solve the power
> sequencing and ordering problem by taking away power control and
> sequencing from drivers.

That is a sensible approach for most on SoC things but for something
shipped as a separate driver there's little point in separating the
power and clocking domain driver from the device since there's typically
a 1:1 mapping. Usually either it's extremely simple (eg, turn
everything on and remove reset) but some devices really need to manage
things. There's obviously some edge cases in SoC integration as well
(eg, the need to manage card supplies for SD controllers, or knowing
exact clock rates for things like audio controllers) so you need some
flex.

Attachment: signature.asc
Description: PGP signature