public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Jan Schär" <jan@jschaer.ch>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH 1/2] ALSA: usb-audio: Support jack detection on Dell dock
Date: Mon, 04 Jul 2022 14:29:05 +0200	[thread overview]
Message-ID: <874jzxysby.wl-tiwai@suse.de> (raw)
In-Reply-To: <20220627171855.42338-1-jan@jschaer.ch>

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

           reply	other threads:[~2022-07-04 12:30 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20220627171855.42338-1-jan@jschaer.ch>]

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=874jzxysby.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=jan@jschaer.ch \
    --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