Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: "Martin Povišer" <povik+lin@cutebit.org>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	Sven Peter <sven@svenpeter.dev>,
	linux-kernel@vger.kernel.org, Hector Martin <marcan@marcan.st>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	asahi@lists.linux.dev, Mark Kettenis <kettenis@openbsd.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>
Subject: Re: [RFC PATCH v2 5/5] ASoC: apple: Add macaudio machine driver
Date: Thu, 9 Jun 2022 16:16:18 +0100	[thread overview]
Message-ID: <YqIOwrRN8rPUF7Y8@sirena.org.uk> (raw)
In-Reply-To: <8961DDD2-93FF-4A18-BCA2-90FCE298F517@cutebit.org>

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

On Thu, Jun 09, 2022 at 04:09:57PM +0200, Martin Povišer wrote:
> > On 9. 6. 2022, at 15:33, Mark Brown <broonie@kernel.org> wrote:

> >> +		/*
> >> +		 * Primary FE
> >> +		 *
> >> +		 * The mclk/fs ratio at 64 for the primary frontend is important
> >> +		 * to ensure that the headphones codec's idea of left and right
> >> +		 * in a stereo stream over I2S fits in nicely with everyone else's.
> >> +		 * (This is until the headphones codec's driver supports
> >> +		 * set_tdm_slot.)
> >> +		 *
> >> +		 * The low mclk/fs ratio precludes transmitting more than two
> >> +		 * channels over I2S, but that's okay since there is the secondary
> >> +		 * FE for speaker arrays anyway.
> >> +		 */
> >> +		.mclk_fs = 64,
> >> +	},

> > This seems weird - it looks like it's confusing MCLK and the bit clock
> > for the audio bus.  These are two different clocks.  Note that it's very
> > common for devices to require a higher MCLK/fs ratio to deliver the best
> > audio performance, 256fs is standard.

> On these machines we are not producing any other clock for the codecs
> besides the bit clock, so I am using MCLK interchangeably for it. (It is
> what the sample rate is derived from after all.)

Please don't do this, you're just making everything needlessly hard to
understand by using standard terminology inappropriately and there's a
risk of breakage further down the line with drivers implementing the
standard ops.

> One of the codec drivers this is to be used with (cs42l42) expects to be
> given the I2S bit clock with

>   snd_soc_dai_set_sysclk(dai, 0, mclk, SND_SOC_CLOCK_IN);

That's very, very non-standard...

> I can rename mclk to bclk in all of the code to make it clearer maybe.
> Also the platform driver can take the bit clock value from set_bclk_ratio,
> instead of set_sysclk from where it takes it now. The cs42l42 driver I can
> patch too to accept set_bclk_ratio.

...indeed, set_bclk_ratio() is a better interface for setting the bclk
ratio - the CODEC driver should really be doing that as well.

> > This shouldn't be open coded in a driver, please factor it out into the
> > core so we've got an API for "set limit X on control Y" then call that.

> There’s already snd_soc_limit_volume, but it takes a fixed control name.
> Can I extend it to understand patterns beginning with a wildcard, like
> '* Amp Gain Volume’?

Or add a new call that does that.

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

  reply	other threads:[~2022-06-09 15:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 19:19 [RFC PATCH v2 0/5] Apple Macs machine/platform ASoC driver Martin Povišer
2022-06-06 19:19 ` [RFC PATCH v2 1/5] dt-bindings: sound: Add Apple MCA I2S transceiver Martin Povišer
2022-06-06 19:44   ` Mark Brown
2022-06-09 18:44   ` Rob Herring
2022-06-06 19:19 ` [RFC PATCH v2 2/5] dt-bindings: sound: Add Apple Macs sound peripherals Martin Povišer
2022-06-06 19:49   ` Mark Brown
2022-06-09 20:03   ` Rob Herring
2022-06-06 19:19 ` [RFC PATCH v2 3/5] ASoC: apple: Add MCA platform driver for Apple SoCs Martin Povišer
2022-06-06 20:17   ` Mark Brown
2022-06-06 20:35     ` Martin Povišer
2022-06-06 19:19 ` [RFC PATCH v2 4/5] ASoC: Introduce 'fixup_controls' card method Martin Povišer
2022-06-06 19:19 ` [RFC PATCH v2 5/5] ASoC: apple: Add macaudio machine driver Martin Povišer
2022-06-06 20:02   ` Pierre-Louis Bossart
2022-06-06 20:46     ` Martin Povišer
2022-06-06 21:22       ` Pierre-Louis Bossart
2022-06-06 21:33         ` Martin Povišer
2022-06-09 13:16   ` Mark Brown
2022-06-09 13:42     ` Martin Povišer
2022-06-09 15:03       ` Mark Brown
     [not found]         ` <2A0422B8-8367-457E-A146-730F7C3DE66B@cutebit.org>
     [not found]           ` <YqIWtzphzVGmbIOe@sirena.org.uk>
2022-06-09 16:19             ` Martin Povišer
2022-06-09 16:35               ` Mark Brown
2022-06-09 13:33   ` Mark Brown
2022-06-09 14:09     ` Martin Povišer
2022-06-09 15:16       ` Mark Brown [this message]
2022-06-09 15:27         ` Martin Povišer
2022-06-09 15:53 ` [RFC PATCH v2 0/5] Apple Macs machine/platform ASoC driver Mark Brown
2022-06-10 15:58 ` (subset) " 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=YqIOwrRN8rPUF7Y8@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=asahi@lists.linux.dev \
    --cc=devicetree@vger.kernel.org \
    --cc=kettenis@openbsd.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=povik+lin@cutebit.org \
    --cc=robh+dt@kernel.org \
    --cc=sven@svenpeter.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox