[alsa-devel] [PATCH 2/2] ALSA: usb-audio: UAC2 jack detection

Andrew Chant achant at google.com
Fri Mar 23 23:24:55 CET 2018


On Fri, Mar 23, 2018 at 12:47 AM, Takashi Iwai <tiwai at suse.de> wrote:
> Let's follow the other usages, and here iface is set to
> SNDRV_CTL_ELEM_IFACE_CARD.  This was for avoiding such volatile
> controls appearing the mixer application.
Will do - it looks like the "Clock Source Validity" control also needs this.
I'll send a patch for that as well.

>> +     .access = SNDRV_CTL_ELEM_ACCESS_READ,
>
> Actually we should have set SNDRV_CTL_ELEM_ACCESS_VOLATILE, too.
> We forgot it in ctljack.c, too.
Sounds good.

>
> The rest looks good.  But one thing to confirm: the value change
> notification is done in snd_usb_mixer_interrupt()?
>
> Also, is the jack re-detected after suspend/resume?  That is, plug off
> the jack while sleeping, and after the resume, is the jack status
> change recognized and notified?

Yes - the USB audio device causes a remote wakeup, then after a few ms
responds with the interrupt data message indicating the connector control
that changed.  This ends up calling snd_usb_mixer_interrupt().

On codeaurora kernels for Qualcomm SoCs, there's a
patch which enables autosuspend for any USB device with an audio interface.
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/sound/usb/card.c?h=LA.HB.1.1.5.c1#n663
so suspend/resume paths are well tested when devices are used on Android.

Two new questions:
#1 - I'd like to report the impedance of the load connected to the jack
(generally as an integer).  Is a read-only control element the right way to
do this?

#2 - In our particular case there's a single jack which can detect presence of
a microphone and playback separately.  USB descriptors provide a mechanism to
show that the input and output terminals are linked in this way
(terminal type 4xx along with bAssocTerminal).

Is there a better way of having this reported than two separate mono jack
controls?


More information about the Alsa-devel mailing list