From: Mark Brown <broonie@kernel.org>
To: "Martin Povišer" <povik+lin@cutebit.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Mark Kettenis <kettenis@openbsd.org>,
Hector Martin <marcan@marcan.st>, Sven Peter <sven@svenpeter.dev>,
asahi@lists.linux.dev
Subject: Re: [RFC PATCH v2 5/5] ASoC: apple: Add macaudio machine driver
Date: Thu, 9 Jun 2022 14:16:04 +0100 [thread overview]
Message-ID: <YqHylN3xba9XFrF8@sirena.org.uk> (raw)
In-Reply-To: <20220606191910.16580-6-povik+lin@cutebit.org>
[-- Attachment #1: Type: text/plain, Size: 2608 bytes --]
On Mon, Jun 06, 2022 at 09:19:10PM +0200, Martin Povišer wrote:
> + * ┌──────────┐ ┌───────────────► ┌─────┐ ┌──────────┐
> + * │ Primary ├───────┤ │ Mux │ ──► │ Speakers │
> + * └──────────┘ │ ┌──────────► └─────┘ └──────────┘
> + * ┌─── │ ───┘ ▲
> + * ┌──────────┐ │ │ │
> + * │Secondary ├──┘ │ ┌────────────┴┐
> + * └──────────┘ ├────►│Plug-in Demux│
> + * │ └────────────┬┘
> + * │ │
> + * │ ▼
> + * │ ┌─────┐ ┌──────────┐
> + * └───────────────► │ Mux │ ──► │Headphones│
> + * └─────┘ └──────────┘
As far as I can tell this demux is entirely software based - why not
just expose the routing control to userspace and let it handle
switching (which I suspect may be more featureful than what's
implemented here)?
> +static int macaudio_jack_event(struct notifier_block *nb, unsigned long event,
> + void *data)
> +{
> + struct snd_soc_jack *jack = data;
> + struct macaudio_snd_data *ma = snd_soc_card_get_drvdata(jack->card);
> +
> + ma->jack_plugin_state = !!event;
> +
> + if (!ma->plugin_demux_kcontrol)
> + return 0;
> +
> + snd_soc_dapm_mux_update_power(&ma->card.dapm, ma->plugin_demux_kcontrol,
> + ma->jack_plugin_state,
> + (struct soc_enum *) &macaudio_plugin_demux_enum, NULL);
> +
> + return 0;
> +}
This should be integrated with the core jack detection stuff in
soc-jack.c and/or the core stuff that's wrapping - that way you'll
ensure that events are generated and status readable via all the
interfaces userspace might be looking for. The ASoC stuff also has some
DAPM integration for turning on/off outputs which might DTRT for you if
you do need it in kernel.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-06-09 13:16 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 [this message]
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
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=YqHylN3xba9XFrF8@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=perex@perex.cz \
--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
all inboxes | Powered by JetHome®