All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org, Rob Herring <robh+dt@kernel.org>,
	linux-gpio@vger.kernel.org, tiwai@suse.de,
	Linus Walleij <linus.walleij@linaro.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Daniel Matuschek <daniel@hifiberry.com>,
	Hui Wang <hui.wang@canonical.com>,
	Matthias Reichl <hias@horus.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-clk@vger.kernel.org
Subject: Re: [RFC PATCH 02/16] ASoC: pcm512x: use "sclk" string to retrieve clock
Date: Wed, 15 Apr 2020 20:50:33 +0100	[thread overview]
Message-ID: <20200415195033.GL5265@sirena.org.uk> (raw)
In-Reply-To: <9a7fbbac-818a-01d0-7a32-8ae313f9ad50@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 4565 bytes --]

On Wed, Apr 15, 2020 at 12:26:57PM -0500, Pierre-Louis Bossart wrote:

> > You have the opportunity to run whatever code you want to run at the
> > point where you're registering your drivers with the system on module
> > init, things like DMI quirk tables (which is what you're going to need
> > to do here AFAICT) should work just as well there as they do later on
> > when the driver loads.

> The idea here was to have one single build, and then rely on what the user
> configured with initrd override to probe the right I2C codec driver and
> indirectly the machine driver. It's similar to device tree overlays.

> With the same up2 board, I change the .aml file in
> /lib/firmware/acpi-upgrades, swap one HAT board for another and the new
> board is handled automagically.

> I don't see how I can use hard-coded DMI tables or board-specific things
> without losing the single build?

Ugh, so you change for another machine description and don't update any
of the DMI information?  Perhaps you can't...  That doesn't seem very
ACPI given how reliant it is on doing quirks based on DMI data for
modern systems :/

> > The clkdev stuff can use dev_name() so so long as the devices appear
> > with predictable names you should be fine.  If not IIRC everything in
> > ACPI is named in the AML so clkdev could be extended to be able to find
> > things based on the names it gives.

> I had a discussion with Andy Shevchenko that we should precisely not be
> using dev_name() since we don't control the names that ACPI selects for us.

It's not ideal and you should definitely use something better if it's
available but if it's all you've got...  You could also search for the
device by binding string at runtime, that'd blow up if you've got more
than one of the same device but it's a bit less likely.

> And since I was using the generic PRP0001 thing for the clock device to
> probe using the 'compatible' string it's actually even less reliable and
> unique...

I see, though actually that might be a place to set up links from now I
think about it - if you know what the I2C device is going to be called
you could have the platform device for the clock source register the
links too.

> > If existing usages that have ended up getting merged are going to be
> > used to push for additional adoption then that's not encouraging.

> I wasn't trying to push this against your will, rather I wanted to highlight
> that we should be clear on the direction for all these uses of the clk API
> in an ACPI context. If what I suggested here is not the right path, then how
> do we deal with all the existing cases? This PCM512x use is not a mainstream
> usage, we use this board mainly for validation and for community support,
> the other cases with 'mclk' and 'sspX_fsync' are critical and impact devices
> shipping in large volumes.

The ideal thing would of course be to extend ACPI to encode things like
this in the firmware description so that it is able to reflect the
reality of modern systems, the graph bits of this were already specified
so most of the work has been done.  However it's a bit late for
the shipping systems.

Normal shipping systems are in a lot better position here in that they 
do have some hope of being able to patch up the links after the fact
with DMI based quirks.  It really would be good to see a way of doing
that deployed, especially in cases where you might otherwise have to
modify the CODEC driver.  I *think* that should be doable, assuming
there's some stable or runtime discoverable naming for the ACPI devices.

In the case of this driver could you look at registering the link from
the device for the clocks?  Have it say "I supply SCK on device X" as it
registers.  That should be fairly straightforward I think, we do that
for one of the regulators.

The main thing I want to avoid is having to have the CODEC drivers know
platform specific strings that they're supposed to look up, or general
approaches where that ends up being a thing that looks idiomatic.  That
was something board files did for a while, it didn't work very well and
we did something better with clkdev instead.  I'm a lot less worried
about this for cases where it's two devices that are part of the SoC
talking to each other, that's relatively well controled and doesn't
affect non-x86 platforms.  When it starts touching the CODECs it's a lot
more worrying.

I think by now there's ample evidence that it's worth investing in
better firmware descriptions :(

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org, tiwai@suse.de,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Daniel Matuschek <daniel@hifiberry.com>,
	Matthias Reichl <hias@horus.com>,
	Hui Wang <hui.wang@canonical.com>,
	linux-gpio@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	linux-clk@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>
Subject: Re: [RFC PATCH 02/16] ASoC: pcm512x: use "sclk" string to retrieve clock
Date: Wed, 15 Apr 2020 20:50:33 +0100	[thread overview]
Message-ID: <20200415195033.GL5265@sirena.org.uk> (raw)
In-Reply-To: <9a7fbbac-818a-01d0-7a32-8ae313f9ad50@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 4565 bytes --]

On Wed, Apr 15, 2020 at 12:26:57PM -0500, Pierre-Louis Bossart wrote:

> > You have the opportunity to run whatever code you want to run at the
> > point where you're registering your drivers with the system on module
> > init, things like DMI quirk tables (which is what you're going to need
> > to do here AFAICT) should work just as well there as they do later on
> > when the driver loads.

> The idea here was to have one single build, and then rely on what the user
> configured with initrd override to probe the right I2C codec driver and
> indirectly the machine driver. It's similar to device tree overlays.

> With the same up2 board, I change the .aml file in
> /lib/firmware/acpi-upgrades, swap one HAT board for another and the new
> board is handled automagically.

> I don't see how I can use hard-coded DMI tables or board-specific things
> without losing the single build?

Ugh, so you change for another machine description and don't update any
of the DMI information?  Perhaps you can't...  That doesn't seem very
ACPI given how reliant it is on doing quirks based on DMI data for
modern systems :/

> > The clkdev stuff can use dev_name() so so long as the devices appear
> > with predictable names you should be fine.  If not IIRC everything in
> > ACPI is named in the AML so clkdev could be extended to be able to find
> > things based on the names it gives.

> I had a discussion with Andy Shevchenko that we should precisely not be
> using dev_name() since we don't control the names that ACPI selects for us.

It's not ideal and you should definitely use something better if it's
available but if it's all you've got...  You could also search for the
device by binding string at runtime, that'd blow up if you've got more
than one of the same device but it's a bit less likely.

> And since I was using the generic PRP0001 thing for the clock device to
> probe using the 'compatible' string it's actually even less reliable and
> unique...

I see, though actually that might be a place to set up links from now I
think about it - if you know what the I2C device is going to be called
you could have the platform device for the clock source register the
links too.

> > If existing usages that have ended up getting merged are going to be
> > used to push for additional adoption then that's not encouraging.

> I wasn't trying to push this against your will, rather I wanted to highlight
> that we should be clear on the direction for all these uses of the clk API
> in an ACPI context. If what I suggested here is not the right path, then how
> do we deal with all the existing cases? This PCM512x use is not a mainstream
> usage, we use this board mainly for validation and for community support,
> the other cases with 'mclk' and 'sspX_fsync' are critical and impact devices
> shipping in large volumes.

The ideal thing would of course be to extend ACPI to encode things like
this in the firmware description so that it is able to reflect the
reality of modern systems, the graph bits of this were already specified
so most of the work has been done.  However it's a bit late for
the shipping systems.

Normal shipping systems are in a lot better position here in that they 
do have some hope of being able to patch up the links after the fact
with DMI based quirks.  It really would be good to see a way of doing
that deployed, especially in cases where you might otherwise have to
modify the CODEC driver.  I *think* that should be doable, assuming
there's some stable or runtime discoverable naming for the ACPI devices.

In the case of this driver could you look at registering the link from
the device for the clocks?  Have it say "I supply SCK on device X" as it
registers.  That should be fairly straightforward I think, we do that
for one of the regulators.

The main thing I want to avoid is having to have the CODEC drivers know
platform specific strings that they're supposed to look up, or general
approaches where that ends up being a thing that looks idiomatic.  That
was something board files did for a while, it didn't work very well and
we did something better with clkdev instead.  I'm a lot less worried
about this for cases where it's two devices that are part of the SoC
talking to each other, that's relatively well controled and doesn't
affect non-x86 platforms.  When it starts touching the CODECs it's a lot
more worrying.

I think by now there's ample evidence that it's worth investing in
better firmware descriptions :(

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-04-15 19:51 UTC|newest]

Thread overview: 136+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 19:58 [RFC PATCH 00/16] ASoC/SOF/clk/gpio/dt: add Hifiberry DAC+ PRO support Pierre-Louis Bossart
2020-04-09 19:58 ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 01/16] ASoC: pcm512x: expose 6 GPIOs Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-14 17:09   ` Andy Shevchenko
2020-04-14 17:09     ` Andy Shevchenko
2020-04-14 17:52     ` Pierre-Louis Bossart
2020-04-14 17:52       ` Pierre-Louis Bossart
2020-04-15  9:49       ` Andy Shevchenko
2020-04-15  9:49         ` Andy Shevchenko
2020-04-16 11:42     ` Linus Walleij
2020-04-16 11:42       ` Linus Walleij
2020-04-16 14:25       ` Pierre-Louis Bossart
2020-04-16 14:25         ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 02/16] ASoC: pcm512x: use "sclk" string to retrieve clock Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-14 17:11   ` Andy Shevchenko
2020-04-14 17:11     ` Andy Shevchenko
2020-04-14 17:54     ` Pierre-Louis Bossart
2020-04-14 17:54       ` Pierre-Louis Bossart
2020-04-15  9:52       ` Andy Shevchenko
2020-04-15  9:52         ` Andy Shevchenko
2020-04-15 14:19         ` Pierre-Louis Bossart
2020-04-15 14:19           ` Pierre-Louis Bossart
2020-04-15 15:10           ` Andy Shevchenko
2020-04-15 15:10             ` Andy Shevchenko
2020-04-14 17:45   ` Mark Brown
2020-04-14 17:45     ` Mark Brown
2020-04-14 18:14     ` Pierre-Louis Bossart
2020-04-14 18:14       ` Pierre-Louis Bossart
2020-04-14 18:27       ` Mark Brown
2020-04-14 18:27         ` Mark Brown
2020-04-14 19:15         ` Pierre-Louis Bossart
2020-04-14 19:15           ` Pierre-Louis Bossart
2020-04-14 19:50           ` Mark Brown
2020-04-14 19:50             ` Mark Brown
2020-04-14 20:13             ` Pierre-Louis Bossart
2020-04-14 20:13               ` Pierre-Louis Bossart
2020-04-14 21:02               ` Pierre-Louis Bossart
2020-04-14 21:02                 ` Pierre-Louis Bossart
2020-04-15 11:07                 ` Mark Brown
2020-04-15 11:07                   ` Mark Brown
2020-04-15 11:36               ` Mark Brown
2020-04-15 11:36                 ` Mark Brown
2020-04-15 14:44                 ` Pierre-Louis Bossart
2020-04-15 14:44                   ` Pierre-Louis Bossart
2020-04-15 16:22                   ` Mark Brown
2020-04-15 16:22                     ` Mark Brown
2020-04-15 17:26                     ` Pierre-Louis Bossart
2020-04-15 17:26                       ` Pierre-Louis Bossart
2020-04-15 19:50                       ` Mark Brown [this message]
2020-04-15 19:50                         ` Mark Brown
2020-04-15 20:22                         ` Pierre-Louis Bossart
2020-04-15 20:22                           ` Pierre-Louis Bossart
2020-04-15 20:39                           ` Mark Brown
2020-04-15 20:39                             ` Mark Brown
2020-04-09 19:58 ` [RFC PATCH 03/16] ASoC: Intel: sof-pcm512x: use gpiod for LED Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-14 17:17   ` Andy Shevchenko
2020-04-14 17:17     ` Andy Shevchenko
2020-04-14 17:52     ` Mark Brown
2020-04-14 17:52       ` Mark Brown
2020-04-14 17:57     ` Pierre-Louis Bossart
2020-04-14 17:57       ` Pierre-Louis Bossart
2020-04-15  9:51       ` Andy Shevchenko
2020-04-15  9:51         ` Andy Shevchenko
2020-04-09 19:58 ` [RFC PATCH 04/16] ASoC: Intel: sof-pcm512x: detect Hifiberry DAC+ PRO Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-14 17:20   ` Andy Shevchenko
2020-04-14 17:20     ` Andy Shevchenko
2020-04-14 18:02     ` Pierre-Louis Bossart
2020-04-14 18:02       ` Pierre-Louis Bossart
2020-04-15  9:55       ` Andy Shevchenko
2020-04-15  9:55         ` Andy Shevchenko
2020-04-15 14:07         ` Pierre-Louis Bossart
2020-04-15 14:07           ` Pierre-Louis Bossart
2020-04-15 15:05           ` Andy Shevchenko
2020-04-15 15:05             ` Andy Shevchenko
2020-04-09 19:58 ` [RFC PATCH 05/16] ASoC: Intel: sof-pcm512x: reconfigure sclk in hw_params if needed Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-14 17:24   ` Andy Shevchenko
2020-04-14 17:24     ` Andy Shevchenko
2020-04-14 18:06     ` Pierre-Louis Bossart
2020-04-14 18:06       ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 06/16] ASoC: Intel: sof-pcm512x: select HIFIBERRY_DACPRO clk Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 07/16] clk: hifiberry-dacpro: initial import Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-14 17:31   ` Andy Shevchenko
2020-04-14 17:31     ` Andy Shevchenko
2020-04-14 18:09     ` Pierre-Louis Bossart
2020-04-14 18:09       ` Pierre-Louis Bossart
2020-04-15 10:00       ` Andy Shevchenko
2020-04-15 10:00         ` Andy Shevchenko
2020-04-09 19:58 ` [RFC PATCH 08/16] clk: hifiberry-dacpro: update SDPX/copyright Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 09/16] clk: hifiberry-dacpro: style cleanups, use devm_ Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 10/16] clk: hifiberry-dacpro: add OF dependency Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 11/16] clk: hifiberry-dacpro: transition to _hw functions Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 12/16] clk: hifiberry-dacpro: add ACPI support Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-22  9:32   ` Stephen Boyd
2020-04-22  9:32     ` Stephen Boyd
2020-04-22  9:47     ` Andy Shevchenko
2020-04-22  9:47       ` Andy Shevchenko
2020-04-22  9:54     ` Pierre-Louis Bossart
2020-04-22  9:54       ` Pierre-Louis Bossart
2020-04-22 20:52       ` Stephen Boyd
2020-04-22 20:52         ` Stephen Boyd
2020-04-22 21:08         ` Pierre-Louis Bossart
2020-04-22 21:08           ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 13/16] clk: hifiberry-dacpro: add "sclk" lookup Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-22  9:35   ` Stephen Boyd
2020-04-22  9:35     ` Stephen Boyd
2020-04-22  9:51     ` Pierre-Louis Bossart
2020-04-22  9:51       ` Pierre-Louis Bossart
2020-04-22 11:54       ` Andy Shevchenko
2020-04-22 11:54         ` Andy Shevchenko
2020-04-09 19:58 ` [RFC PATCH 14/16] clk: hifiberry-dacpro: toggle GPIOs on prepare/unprepare Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 15/16] clk: hifiberry-dacpro: add delay on clock prepare/deprepare Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-09 19:58 ` [RFC PATCH 16/16] ASoC: dt-bindings: add document for Hifiberry DAC+ PRO clock Pierre-Louis Bossart
2020-04-09 19:58   ` Pierre-Louis Bossart
2020-04-14 17:27   ` Andy Shevchenko
2020-04-14 17:27     ` Andy Shevchenko
2020-04-14 18:10     ` Pierre-Louis Bossart
2020-04-14 18:10       ` Pierre-Louis Bossart
2020-04-14 16:50 ` [RFC PATCH 00/16] ASoC/SOF/clk/gpio/dt: add Hifiberry DAC+ PRO support Andy Shevchenko
2020-04-14 16:50   ` Andy Shevchenko
2020-04-14 16:57   ` Pierre-Louis Bossart
2020-04-14 16:57     ` Pierre-Louis Bossart

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=20200415195033.GL5265@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=daniel@hifiberry.com \
    --cc=hias@horus.com \
    --cc=hui.wang@canonical.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.