OSDN Git Service

ALSA: usb-audio: UAC2 jack detection
authorAndrew Chant <achant@google.com>
Sat, 24 Mar 2018 02:25:23 +0000 (19:25 -0700)
committerTakashi Iwai <tiwai@suse.de>
Sat, 24 Mar 2018 08:50:27 +0000 (09:50 +0100)
commit5a222e8494524d04cc8de63726644759e5b132f7
treeb015bea685e37a27503e22d4318df93a3100bdec
parent40cab6e88cb0b6c56d3f30b7491a20e803f948f6
ALSA: usb-audio: UAC2 jack detection

This implements UAC2 jack detection support, presenting
jack status as a boolean read-only mono mixer.

The presence of any channel in the UAC2_TE_CONNECTOR
control for a terminal will result in the mixer saying
the jack is connected.

Mixer naming follows the convention in sound/core/ctljack.c,
terminating the mixer with " Jack".
For additional clues as to which jack is being presented,
the name is prefixed with " - Input Jack" or " - Output Jack"
depending on if it's an input or output terminal.

This is required because terminal names are ambiguous
between inputs and outputs and often duplicated -
Bidirectional terminal types (0x400 -> 0x4FF)
"... may be used separately for input only or output only.
These types require two Terminal descriptors. Both have the same type."
(quote from "USB Device Class Definition for Terminal Types")

Since bidirectional terminal types are common for headphone adapters,
this distinguishes between two otherwise identically-named
jack controls.

Tested with a UAC2 audio device with connector control capability.

Signed-off-by: Andrew Chant <achant@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer.c