lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 9 Jun 2022 15:42:09 +0200
From:   Martin Povišer <povik+lin@...ebit.org>
To:     Mark Brown <broonie@...nel.org>
Cc:     Liam Girdwood <lgirdwood@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzk+dt@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Mark Kettenis <kettenis@...nbsd.org>,
        Hector Martin <marcan@...can.st>,
        Sven Peter <sven@...npeter.dev>, asahi@...ts.linux.dev
Subject: Re: [RFC PATCH v2 5/5] ASoC: apple: Add macaudio machine driver


> On 9. 6. 2022, at 15:16, Mark Brown <broonie@...nel.org> wrote:
> 
> 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)?

Well, userspace should have the other two muxes at its disposal to
implement any routing/switching it wishes -- but in addition we are
also offering letting kernel take care of the switching, by pointing
the muxes to the demux.

I assume (but I don’t know the extent of what’s possible with UCM files),
that this will be of some value to users running plain ALSA with no
sound server.

>> +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.

Aren’t all the right events to userspace generated already by the
codec calling snd_soc_jack_report?

I looked at the existing DAPM integration but I couldn’t figure out
how to switch the demux with it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ