public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] ALSA: usb-audio: Support jack detection on Dell dock
       [not found] <20220627171855.42338-1-jan@jschaer.ch>
@ 2022-07-04 12:29 ` Takashi Iwai
  0 siblings, 0 replies; only message in thread
From: Takashi Iwai @ 2022-07-04 12:29 UTC (permalink / raw)
  To: Jan Schär; +Cc: alsa-devel, Takashi Iwai

On Mon, 27 Jun 2022 19:18:54 +0200,
Jan Schär wrote:
> 
> The Dell WD15 dock has a headset and a line out port. Add support for
> detecting if a jack is inserted into one of these ports.
> For the headset jack, additionally determine if a mic is present.
> 
> The WD15 contains an ALC4020 USB audio controller and ALC3263 audio codec
> from Realtek. It is a UAC 1 device, and UAC 1 does not support jack
> detection. Instead, jack detection works by sending HD Audio commands over
> vendor-type USB messages.
> 
> I found out how it works by looking at USB captures on Windows.
> The audio codec is very similar to the one supported by
> sound/soc/codecs/rt298.c / rt298.h, some constant names and the mic
> detection are adapted from there. The realtek_add_jack function is adapted
> from build_connector_control in sound/usb/mixer.c.
> 
> I tested this on a WD15 dock with the latest firmware.
> 
> Signed-off-by: Jan Schär <jan@jschaer.ch>
> ---
> For testing this patch, you need to change the content of the file
> /usr/share/alsa/ucm2/USB-Audio/Dell-WD15-Dock-HiFi.conf to the following:
> ```
> SectionDevice."Headphones" {
> 	Comment "Headphones"
> 
> 	Value {
> 		PlaybackPriority 100
> 		PlaybackPCM "hw:${CardId}"
> 		JackControl "Headphone Jack"
> 
> 		If.Headphone_ctl {
> 			Condition {
> 				Type ControlExists
> 				Control "name='Headphone Playback Switch'"
> 			}
> 			True {
> 				PlaybackMixerElem "Headphone"
> 				PlaybackVolume "Headphone Playback Volume"
> 				PlaybackSwitch "Headphone Playback Switch"
> 			}
> 		}
> 	}
> }
> 
> SectionDevice."Line" {
> 	Comment "Line Out"
> 
> 	Value {
> 		PlaybackPriority 200
> 		PlaybackPCM "hw:${CardId},1"
> 		JackControl "Line Out Jack"
> 
> 		If.Line_ctl {
> 			Condition {
> 				Type ControlExists
> 				Control "name='Line Playback Switch'"
> 			}
> 			True {
> 				PlaybackMixerElem "Line"
> 				PlaybackVolume "Line Playback Volume"
> 				PlaybackSwitch "Line Playback Switch"
> 			}
> 		}
> 	}
> }
> 
> SectionDevice."Headset" {
> 	Comment "Headset Microphone"
> 
> 	Value {
> 		CapturePriority 100
> 		CapturePCM "hw:${CardId}"
> 		JackControl "Headset Mic Jack"
> 
> 		If.Mic_ctl {
> 			Condition {
> 				Type ControlExists
> 				Control "name='Mic Capture Switch'"
> 			}
> 			True {
> 				CaptureMixerElem "Mic"
> 				CaptureVolume "Mic Capture Volume"
> 				CaptureSwitch "Mic Capture Switch"
> 			}
> 		}
> 	}
> }
> ```

This is an interesting finding.
Applied both patches to for-next branch now.


Thanks!

Takashi

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-04 12:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220627171855.42338-1-jan@jschaer.ch>
2022-07-04 12:29 ` [PATCH 1/2] ALSA: usb-audio: Support jack detection on Dell dock Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox