All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	kuninori.morimoto.gx@renesas.com, linux-kernel@vger.kernel.org,
	tiwai@suse.com, lgirdwood@gmail.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org
Subject: Re: [PATCH v1 1/2] ASoC: simple-card: Support custom DAI system clock IDs
Date: Wed, 26 Oct 2022 20:22:59 +0100	[thread overview]
Message-ID: <3vVkKn5WAgfH6HITfpqZP3wEVaTf1Kvc@localhost> (raw)
In-Reply-To: <Y1lOLgLNDgsmvfe5@sirena.org.uk>


Mark Brown <broonie@kernel.org> writes:

> On Wed, Oct 26, 2022 at 03:42:31PM +0100, Aidan MacDonald wrote:
>> Mark Brown <broonie@kernel.org> writes:
>>
>>> There is a strong case for saying that all the clocking in CODECs might
>>> fit into the clock API, especially given the whole DT thing.
>>>
>> The ASoC APIs don't speak "struct clk", which seems (to me) like a
>> prerequisite before we can think about doing anything with clocks.
>
> Right, they probably should.

Let me throw out an idea then... the clock API will probably need to
gain the ability to express constraints, eg. limit a clock to set of
frequencies or frequency ranges; ratio constraints to ensure a set of
clocks are in one of a specified set of ratios; and maybe require that
certain clocks be synchronous.

This'd go a long way toward making the clock API suitable for audio
clocking.

>> Even if ASoC began to use the clock API for codec clocking, it's not
>> clear how you maintain backward compatibility with the existing
>> simple-card bindings. You'd have to go over all DAIs and mimic the
>> effects of "snd_soc_dai_set_sysclk(dai, 0, freq, dir)" because there
>> could be a device tree relying on it somewhere.
>
> Of course, you'd need to define bindings for devices with multiple
> clocks such that things continue to work out compatibly.
>
>> So... given you're already stuck maintaining .set_sysclk() behavior
>> forever, is there much harm in exposing the sysclock ID to the DT?
>
> Yes, it's ABI and the more baked in this stuff gets the more issues we
> have when trying to integrate with the wider clock tree in the system -
> for example when devices are able to output their system clock to be
> used as a master clock for a device which can use the clock API as an
> input.  It's fine in kernel but we should be trying to keep it out of
> ABI.

Fair enough. It's too bad this limits the usefulness of simple-card,
but for the time being I'm happy maintaining these patches out of tree.

Regards,
Aidan

WARNING: multiple messages have this Message-ID (diff)
From: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: lgirdwood@gmail.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org,
	kuninori.morimoto.gx@renesas.com, perex@perex.cz, tiwai@suse.com,
	alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] ASoC: simple-card: Support custom DAI system clock IDs
Date: Wed, 26 Oct 2022 20:22:59 +0100	[thread overview]
Message-ID: <3vVkKn5WAgfH6HITfpqZP3wEVaTf1Kvc@localhost> (raw)
In-Reply-To: <Y1lOLgLNDgsmvfe5@sirena.org.uk>


Mark Brown <broonie@kernel.org> writes:

> On Wed, Oct 26, 2022 at 03:42:31PM +0100, Aidan MacDonald wrote:
>> Mark Brown <broonie@kernel.org> writes:
>>
>>> There is a strong case for saying that all the clocking in CODECs might
>>> fit into the clock API, especially given the whole DT thing.
>>>
>> The ASoC APIs don't speak "struct clk", which seems (to me) like a
>> prerequisite before we can think about doing anything with clocks.
>
> Right, they probably should.

Let me throw out an idea then... the clock API will probably need to
gain the ability to express constraints, eg. limit a clock to set of
frequencies or frequency ranges; ratio constraints to ensure a set of
clocks are in one of a specified set of ratios; and maybe require that
certain clocks be synchronous.

This'd go a long way toward making the clock API suitable for audio
clocking.

>> Even if ASoC began to use the clock API for codec clocking, it's not
>> clear how you maintain backward compatibility with the existing
>> simple-card bindings. You'd have to go over all DAIs and mimic the
>> effects of "snd_soc_dai_set_sysclk(dai, 0, freq, dir)" because there
>> could be a device tree relying on it somewhere.
>
> Of course, you'd need to define bindings for devices with multiple
> clocks such that things continue to work out compatibly.
>
>> So... given you're already stuck maintaining .set_sysclk() behavior
>> forever, is there much harm in exposing the sysclock ID to the DT?
>
> Yes, it's ABI and the more baked in this stuff gets the more issues we
> have when trying to integrate with the wider clock tree in the system -
> for example when devices are able to output their system clock to be
> used as a master clock for a device which can use the clock API as an
> input.  It's fine in kernel but we should be trying to keep it out of
> ABI.

Fair enough. It's too bad this limits the usefulness of simple-card,
but for the time being I'm happy maintaining these patches out of tree.

Regards,
Aidan

  reply	other threads:[~2022-10-26 19:23 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22 16:27 [PATCH v1 1/2] ASoC: simple-card: Support custom DAI system clock IDs Aidan MacDonald
2022-10-22 16:27 ` Aidan MacDonald
2022-10-22 16:27 ` [PATCH v1 2/2] dt-bindings: ASoC: simple-card: Add system-clock-id property Aidan MacDonald
2022-10-22 16:27   ` Aidan MacDonald
2022-10-23 13:08   ` Krzysztof Kozlowski
2022-10-23 13:08     ` Krzysztof Kozlowski
2022-10-23 13:47     ` Aidan MacDonald
2022-10-23 13:47       ` Aidan MacDonald
2022-10-24 20:46       ` Krzysztof Kozlowski
2022-10-24 20:46         ` Krzysztof Kozlowski
2022-10-24 23:38         ` Aidan MacDonald
2022-10-24 23:38           ` Aidan MacDonald
2022-10-25  0:00           ` Krzysztof Kozlowski
2022-10-25  0:00             ` Krzysztof Kozlowski
2022-10-25  9:14             ` Aidan MacDonald
2022-10-25  9:14               ` Aidan MacDonald
2022-10-25 12:19               ` Krzysztof Kozlowski
2022-10-25 12:19                 ` Krzysztof Kozlowski
2022-10-26 14:48                 ` Aidan MacDonald
2022-10-26 14:48                   ` Aidan MacDonald
2022-10-26 15:03                   ` Krzysztof Kozlowski
2022-10-26 15:03                     ` Krzysztof Kozlowski
2022-10-26 19:27                     ` Aidan MacDonald
2022-10-26 19:27                       ` Aidan MacDonald
2022-10-26 15:05   ` Krzysztof Kozlowski
2022-10-26 15:05     ` Krzysztof Kozlowski
2022-10-23 23:54 ` [PATCH v1 1/2] ASoC: simple-card: Support custom DAI system clock IDs Kuninori Morimoto
2022-10-23 23:54   ` Kuninori Morimoto
2022-10-24  9:18   ` Aidan MacDonald
2022-10-24  9:18     ` Aidan MacDonald
2022-10-24 11:49 ` Mark Brown
2022-10-24 11:49   ` Mark Brown
2022-10-24 23:17   ` Aidan MacDonald
2022-10-24 23:17     ` Aidan MacDonald
2022-10-25 11:03     ` Mark Brown
2022-10-25 11:03       ` Mark Brown
2022-10-26 14:42       ` Aidan MacDonald
2022-10-26 14:42         ` Aidan MacDonald
2022-10-26 15:11         ` Mark Brown
2022-10-26 15:11           ` Mark Brown
2022-10-26 19:22           ` Aidan MacDonald [this message]
2022-10-26 19:22             ` Aidan MacDonald

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=3vVkKn5WAgfH6HITfpqZP3wEVaTf1Kvc@localhost \
    --to=aidanmacdonald.0x0@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.com \
    /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.