Re: [RFC PATCH 0/2] Add software node support to regulator framework

From: Mark Brown
Date: Mon Jul 12 2021 - 13:32:45 EST


On Mon, Jul 12, 2021 at 07:55:21PM +0300, Laurent Pinchart wrote:
> On Mon, Jul 12, 2021 at 03:15:28PM +0100, Mark Brown wrote:

> > Like I said elsewhere it seems a lot easier to just have the I2C driver
> > set platform data based on parsing DMI information like we do elsewhere.
> > I really don't see any benefit to introducing an additional layer of
> > abstraction and binding here, it just seems to be making things more
> > fragile.

> The idea behind software nodes is that individual device drivers
> shouldn't care about where platform-specific data come from. They can
> use the same fwnode API, regardless of whether the device is described
> through OF, ACPI, or software nodes created by a board file in the

That's much more fwnode than swnode. fwnode is a cute hack for letting
ACPI based systems that don't fit the ACPI model reuse DT bindings which
can work well for some things which are just outside the scope of ACPI
completely but is a really bad idea for things where there's specific
firmware modelling for the thing being handled, in those cases it should
be avoided and firmware specific handling used instead. Power handling
(including regulators) is one of those areas - ACPI has really strong
opinions on how it should be done and we don't want to be encouraging
systems to go against that model. AFAICT swnode is mostly just a way of
patching up firmware that could be getting away with fwnode but didn't
for some reason, in this case we don't want to ever see ACPI systems
trying to use the DT regulator bindings in their firmware descriptions.

> kernel. It allows grouping all platform data that should be provided by
> firmware in a single place, conditioned by a DMI match, instead of
> distributing DMI matches to lots of drivers.

Like I said in reply to Andy's mail if we're essentially filling in a C
struct through a massive pile of indirection involving writing C code
containing a bunch of static initialisations of less specific structs
that doesn't seem great. We can probably arrange to pass the init_data
from different files rather than putting the quirks in the driver,
that'd be fine if a bit more work, but swnodes only seem to be adding
problems here.

Attachment: signature.asc
Description: PGP signature