linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Scally <djrscally@gmail.com>
To: Mark Brown <broonie@kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Gross <mgross@linux.intel.com>,
	Maximilian Luz <luzmaximilian@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	kieran.bingham@ideasonboard.com
Subject: Re: [RFC PATCH 0/2] Add software node support to regulator framework
Date: Tue, 13 Jul 2021 00:32:26 +0100	[thread overview]
Message-ID: <e17af9dc-78c0-adb8-1dfb-0698e7a4e394@gmail.com> (raw)
In-Reply-To: <20210712170120.GG4435@sirena.org.uk>

Hi Mark - sorry for the late reply.

On 12/07/2021 18:01, Mark Brown wrote:
> On Mon, Jul 12, 2021 at 07:08:23PM +0300, Andy Shevchenko wrote:
>> On Mon, Jul 12, 2021 at 4:35 PM Mark Brown <broonie@kernel.org> wrote:
>>> But why?  I'm not seeing the advantage over providing platform data
>>> based on DMI quirks here, it seems like a bunch of work for no reason.
>> What do you mean by additional work? It's exactly opposite since most
>> of the drivers in the kernel are using the fwnode interface rather
>> than platform data. Why should we _add_ the specific platform data
>> handling code in the certain drivers instead of not touching them at
>> all?
> It's adding an entirely new representation of standard data with less
> validation support than either DT or platform data which seems like a
> needlessly roundabout and error prone way of moving the data about with
> less tooling support.  As far as I can tell the only advantage is that
> it lets you write the quirk in a different source file but I'm finding
> it hard to get excited about that.


I do think it can simplify driver code too; a lot of them aren't written
to parse platform data to get the init data, as they're just relying on
reading it from devicetree so in the event that we get more cases like
this, we need to modify those drivers to look for platform data too. On
the other hand, even the drivers that don't directly call
of_get_regulator_init_data() still do that lookup during the
regulator_of_get_init_data() call in regulator_register(), so the ones
that do parse platform data for init_data structs will check DT as part
of regulator_register() anyway. Imitating that seems simpler to me.


It also creates some problems to suppress the enumeration of the i2c
device via ACPI (which we'll have to do in a machine specific fashion,
because some laptops have this chip with properly configured ACPI and
thus work fine as-is) to re-enumerate it in a board file with the
platform data; the ACPI methods and buffers are used by the i2c device's
driver; there's a bunch of regrettably non-standards-compliant
information in there that we need to check to make sure we do things
properly.


I take the point about this being error-prone lacking tooling support -
happy to work on this as much as needed to alleviate your concerns if we
decide to proceed down this route.


> If we were fixing up an existing
> ACPI binding or something this approach would make sense to me but it's
> making something entirely new out of whole cloth here.
>
> We already have generic platform data support for the regulator API so
> driver modifications would just be the DMI matching which is going to
> have to happen somewhere anyway, I don't see a huge win from putting
> them in one file rather than another.  It should basically just boil
> down to being another data table, I imagine you could write a helper for
> it, or probably even come up with some generic thing that let you
> register a platform data/DMI combo independently of the driver to get it
> out of the driver code (looking more like the existing GPIO code which
> is already being used in another bit of this quirking).
>
> It feels like this should be making more use of existing stuff than it
> is.  If you look at what the core part of the code does it's taking data
> which was provided by one part of the kernel in one set of C structs and
> parsing those into a struct init_data which is what the core actually
> wants to consume.  This seems like an entirely redundant process, we
> should be able to just write the machine configuration into some struct
> init_datas and get that associated with the regulators without creating
> an otherwise entirely unused intermediate representation of the data.

The advantage of the GPIO lookups is there's no need to have the pointer
to the registered devices to register the lookup table; we could imitate
that, by adding entries to a list with the lookup values being device
and regulator name (with the init data as the thing that's "looked up")
and check for those during regulator_register() maybe?

  reply	other threads:[~2021-07-12 23:32 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 22:42 [RFC PATCH 0/2] Add software node support to regulator framework Daniel Scally
2021-07-08 22:42 ` [RFC PATCH 1/2] regulator: Add support for software node connections Daniel Scally
2021-07-09 17:26   ` Mark Brown
2021-07-08 22:42 ` [RFC PATCH 2/2] platform/surface: Add Surface Go 2 board file Daniel Scally
2021-07-09 17:40   ` Mark Brown
2021-07-09 17:04 ` [RFC PATCH 0/2] Add software node support to regulator framework Mark Brown
2021-07-10 22:48   ` Daniel Scally
2021-07-12 14:15     ` Mark Brown
2021-07-12 16:55       ` Laurent Pinchart
2021-07-12 17:32         ` Mark Brown
2021-07-11  9:37   ` Andy Shevchenko
2021-07-12 12:42     ` Mark Brown
2021-07-12 13:01       ` Andy Shevchenko
2021-07-12 13:34         ` Mark Brown
2021-07-12 16:08           ` Andy Shevchenko
2021-07-12 17:01             ` Mark Brown
2021-07-12 23:32               ` Daniel Scally [this message]
2021-07-13 15:24                 ` Mark Brown
2021-07-13 15:42                   ` Laurent Pinchart
2021-07-13 16:02                     ` Mark Brown
2021-07-13 16:06                       ` Laurent Pinchart
2021-07-13 18:24                         ` Mark Brown
2021-07-13 15:55                   ` Andy Shevchenko
2021-07-13 18:18                     ` Mark Brown
2021-07-13 19:46                       ` Andy Shevchenko
2021-07-14 16:05                         ` Mark Brown
2021-07-14  7:25                       ` Laurent Pinchart
2021-07-14 16:59                         ` Mark Brown
2021-07-14 17:18                           ` Laurent Pinchart
2021-07-14 17:28                             ` Mark Brown
2021-07-14 17:41                               ` Laurent Pinchart
2021-07-14 19:18                                 ` Mark Brown
2021-07-14 21:53                                   ` Laurent Pinchart
2021-07-13 22:06                   ` Daniel Scally
2021-07-10 22:28 ` Laurent Pinchart
2021-07-10 22:54   ` Daniel Scally
2021-07-11 16:55     ` Laurent Pinchart
2021-07-12  8:13       ` Daniel Scally
2021-07-12 11:50         ` Laurent Pinchart
2021-07-12 13:23         ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e17af9dc-78c0-adb8-1dfb-0698e7a4e394@gmail.com \
    --to=djrscally@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).