The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mark Brown <broonie@kernel.org>, Daniel Scally <djrscally@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Gross <mgross@linux.intel.com>,
	Maximilian Luz <luzmaximilian@gmail.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [RFC PATCH v2 1/3] regulator: core: Add regulator_lookup_list
Date: Wed, 25 Aug 2021 16:48:15 +0200	[thread overview]
Message-ID: <cc65098e-b459-b20a-f6e2-ee521fc20ca7@redhat.com> (raw)
In-Reply-To: <20210825103301.GC5186@sirena.org.uk>

Hi all,

On 8/25/21 12:33 PM, Mark Brown wrote:
> On Wed, Aug 25, 2021 at 12:06:18AM +0100, Daniel Scally wrote:
>> In some situations regulator devices can be enumerated via either
>> devicetree or ACPI and bound to regulator drivers but without any
>> init data being provided in firmware. This leaves their consumers
>> unable to acquire them via regulator_get().
>>
>> To fix the issue, add the ability to register a lookup table to a
>> list within regulator core, which will allow board files to provide
>> init data via matching against the regulator name and device name in
>> the same fashion as the gpiod lookup table.
> 
> This is the wrong level to do this I think, this is a generic problem
> that affects all kinds of platform data so if we're not going to scatter
> DMI quirks throughout the drivers like we currently do then we should
> have a way for boards to just store generic platform data for a device
> and then have that platform data joined up with the device later.  This
> could for example also be used by all the laptop audio subsystems which
> need DMI quirk tables in drivers for their components to figure out how
> they're wired up and avoids the need to go through subsystems adding new
> APIs.

Daniel, I believe that what Mark wants here is something similar to what
we already do for the 5v boost converter regulator in the TI bq24190 charger
chip used on some Cherry Trail devices.

There the entire i2c-client is instantiated by platform code here:
drivers/i2c/busses/i2c-cht-wc.c

This attaches a struct bq24190_platform_data as platform data to
the i2c-client, this struct contains a single 

const struct regulator_init_data *regulator_init_data

member which then gets consumed (if there is platform data set) by
the regulator code in:

drivers/power/supply/bq24190_charger.c

For the tps68470 regulator code the platform_data then would need to
have 3 const struct regulator_init_data * members one for each of the
3 regulators.

This platform_data could then be directly set (based on a DMI match table)
from intel_skl_int3472_tps68470.c avoiding probe-ordering issues (1) with
the lookup solution and will allow the code containing the DMI and
regulator_init_data tables to be build as a module.

So all in all I think that this will be a better solution.

Regards,

Hans


1) You are forcing the DMI matching driver adding the lookups to be builtin
but what if the tps68740-MFD + regulatorcode is also builtin, then there
still is no guarantee the lookups will be added before the regulator drivers'
probe function runs


p.s.

I see that you mention something similar later in the thread referring to
the tps65023-regulator driver. I did not check, but assuming that uses what
I describe above; then yes the idea would be to do something similar for
the tps68740-code, setting the platform_data when (just before) the MFD-cells
are instantiated from intel_skl_int3472_tps68470.c




  parent reply	other threads:[~2021-08-25 14:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 23:06 [RFC PATCH v2 0/3] Add regulator_lookup_list and API Daniel Scally
2021-08-24 23:06 ` [RFC PATCH v2 1/3] regulator: core: Add regulator_lookup_list Daniel Scally
2021-08-25 10:33   ` Mark Brown
2021-08-25 11:10     ` Andy Shevchenko
2021-08-25 11:30       ` Mark Brown
2021-08-25 12:26         ` Andy Shevchenko
2021-08-25 13:11           ` Mark Brown
2021-08-25 13:59             ` Laurent Pinchart
2021-08-25 14:03               ` Laurent Pinchart
2021-08-25 14:33                 ` Andy Shevchenko
2021-08-25 14:12               ` Daniel Scally
2021-08-25 14:22                 ` Laurent Pinchart
2021-08-25 14:52                   ` Mark Brown
2021-08-25 22:09                     ` Daniel Scally
2021-08-26 12:40                       ` Mark Brown
2021-08-25 14:41               ` Mark Brown
2021-08-25 14:48     ` Hans de Goede [this message]
2021-08-25 15:27       ` Mark Brown
2021-08-25 15:42         ` Laurent Pinchart
2021-08-25 16:13           ` Mark Brown
2021-08-25 20:25           ` Hans de Goede
2021-08-25 20:40             ` Laurent Pinchart
2021-08-25 21:24               ` Daniel Scally
2021-08-25 21:17       ` Daniel Scally
2021-08-24 23:06 ` [RFC PATCH v2 2/3] Documentation: power: Document regulator_lookup_list Daniel Scally
2021-08-24 23:06 ` [RFC PATCH v2 3/3] platform/surface: Add Surface Go 2 board file Daniel Scally

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=cc65098e-b459-b20a-f6e2-ee521fc20ca7@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=broonie@kernel.org \
    --cc=djrscally@gmail.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