All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Fix regression with Dell Dock jack detection
@ 2022-11-02 11:34 Takashi Iwai
  2022-11-02 11:53 ` Jaroslav Kysela
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2022-11-02 11:34 UTC (permalink / raw)
  To: alsa-devel

The recent commit added Jack controls to Dell Dock, but it added with
iface = SNDRV_CTL_ELEM_IFACE_CARD.  Unfortunately this doesn't match
with the changes in user-space UCM profile, which expects iface =
SNDRV_CTL_ELEM_IFACE_MIXER as default.  This mismatch resulted in the
non-working profile, and the Dell Dock is gone on pipewire /
PulseAudio after the kernel update.

Fix the regression by adjusting the iface of the new ctl elements to
*_MIXER.

Fixes: 4b8ea38fabab ("ALSA: usb-audio: Support jack detection on Dell dock")
Cc: <stable@vger.kernel.org>
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1204719
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/mixer_quirks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index ab0d459f4271..3039a17259ab 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -2042,7 +2042,7 @@ static int realtek_ctl_connector_get(struct snd_kcontrol *kcontrol,
 }
 
 static const struct snd_kcontrol_new realtek_connector_ctl_ro = {
-	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
+	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.name = "", /* will be filled later manually */
 	.access = SNDRV_CTL_ELEM_ACCESS_READ,
 	.info = snd_ctl_boolean_mono_info,
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Fix regression with Dell Dock jack detection
  2022-11-02 11:34 [PATCH] ALSA: usb-audio: Fix regression with Dell Dock jack detection Takashi Iwai
@ 2022-11-02 11:53 ` Jaroslav Kysela
  2022-11-02 11:59   ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Jaroslav Kysela @ 2022-11-02 11:53 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel

On 02. 11. 22 12:34, Takashi Iwai wrote:
> The recent commit added Jack controls to Dell Dock, but it added with
> iface = SNDRV_CTL_ELEM_IFACE_CARD.  Unfortunately this doesn't match
> with the changes in user-space UCM profile, which expects iface =
> SNDRV_CTL_ELEM_IFACE_MIXER as default.  This mismatch resulted in the
> non-working profile, and the Dell Dock is gone on pipewire /
> PulseAudio after the kernel update.
> 
> Fix the regression by adjusting the iface of the new ctl elements to
> *_MIXER.

Hi Takashi,

UCM expects SNDRV_CTL_ELEM_IFACE_CARD for jacks by default. Which change do 
you refer? I would drop this patch.

					Thanks,
						Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Fix regression with Dell Dock jack detection
  2022-11-02 11:53 ` Jaroslav Kysela
@ 2022-11-02 11:59   ` Takashi Iwai
  2022-11-02 12:05     ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2022-11-02 11:59 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

On Wed, 02 Nov 2022 12:53:48 +0100,
Jaroslav Kysela wrote:
> 
> On 02. 11. 22 12:34, Takashi Iwai wrote:
> > The recent commit added Jack controls to Dell Dock, but it added with
> > iface = SNDRV_CTL_ELEM_IFACE_CARD.  Unfortunately this doesn't match
> > with the changes in user-space UCM profile, which expects iface =
> > SNDRV_CTL_ELEM_IFACE_MIXER as default.  This mismatch resulted in the
> > non-working profile, and the Dell Dock is gone on pipewire /
> > PulseAudio after the kernel update.
> > 
> > Fix the regression by adjusting the iface of the new ctl elements to
> > *_MIXER.
> 
> Hi Takashi,
> 
> UCM expects SNDRV_CTL_ELEM_IFACE_CARD for jacks by default. Which
> change do you refer? I would drop this patch.

It's about ucm2/USB-Audio/Dell/WD15-Dock-HiFi.conf, the JackControl
entries.  For example,
		JackControl "Headphone Jack"
expects the mixer element.  The bad thing is that the complete card
entry disappears because of inconsistency.
If you modify the entry as
		JackControl "name='Headphone Jack',iface=CARD"
it would work.  But the fact that other JackControl stuff works, it's
better to align the USB-audio with IFACE_MIXER, I guess.


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Fix regression with Dell Dock jack detection
  2022-11-02 11:59   ` Takashi Iwai
@ 2022-11-02 12:05     ` Takashi Iwai
  2022-11-02 12:18       ` Jaroslav Kysela
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2022-11-02 12:05 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

On Wed, 02 Nov 2022 12:59:49 +0100,
Takashi Iwai wrote:
> 
> On Wed, 02 Nov 2022 12:53:48 +0100,
> Jaroslav Kysela wrote:
> > 
> > On 02. 11. 22 12:34, Takashi Iwai wrote:
> > > The recent commit added Jack controls to Dell Dock, but it added with
> > > iface = SNDRV_CTL_ELEM_IFACE_CARD.  Unfortunately this doesn't match
> > > with the changes in user-space UCM profile, which expects iface =
> > > SNDRV_CTL_ELEM_IFACE_MIXER as default.  This mismatch resulted in the
> > > non-working profile, and the Dell Dock is gone on pipewire /
> > > PulseAudio after the kernel update.
> > > 
> > > Fix the regression by adjusting the iface of the new ctl elements to
> > > *_MIXER.
> > 
> > Hi Takashi,
> > 
> > UCM expects SNDRV_CTL_ELEM_IFACE_CARD for jacks by default. Which
> > change do you refer? I would drop this patch.
> 
> It's about ucm2/USB-Audio/Dell/WD15-Dock-HiFi.conf, the JackControl
> entries.  For example,
> 		JackControl "Headphone Jack"
> expects the mixer element.  The bad thing is that the complete card
> entry disappears because of inconsistency.
> If you modify the entry as
> 		JackControl "name='Headphone Jack',iface=CARD"
> it would work.  But the fact that other JackControl stuff works, it's
> better to align the USB-audio with IFACE_MIXER, I guess.

Hm, looking at the UCM code, UCM should treat IFACE_CARD as default,
indeed.  Something went south.  Will take a deeper look.


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Fix regression with Dell Dock jack detection
  2022-11-02 12:05     ` Takashi Iwai
@ 2022-11-02 12:18       ` Jaroslav Kysela
  2022-11-02 12:45         ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Jaroslav Kysela @ 2022-11-02 12:18 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On 02. 11. 22 13:05, Takashi Iwai wrote:
> On Wed, 02 Nov 2022 12:59:49 +0100,
> Takashi Iwai wrote:
>>
>> On Wed, 02 Nov 2022 12:53:48 +0100,
>> Jaroslav Kysela wrote:
>>>
>>> On 02. 11. 22 12:34, Takashi Iwai wrote:
>>>> The recent commit added Jack controls to Dell Dock, but it added with
>>>> iface = SNDRV_CTL_ELEM_IFACE_CARD.  Unfortunately this doesn't match
>>>> with the changes in user-space UCM profile, which expects iface =
>>>> SNDRV_CTL_ELEM_IFACE_MIXER as default.  This mismatch resulted in the
>>>> non-working profile, and the Dell Dock is gone on pipewire /
>>>> PulseAudio after the kernel update.
>>>>
>>>> Fix the regression by adjusting the iface of the new ctl elements to
>>>> *_MIXER.
>>>
>>> Hi Takashi,
>>>
>>> UCM expects SNDRV_CTL_ELEM_IFACE_CARD for jacks by default. Which
>>> change do you refer? I would drop this patch.
>>
>> It's about ucm2/USB-Audio/Dell/WD15-Dock-HiFi.conf, the JackControl
>> entries.  For example,
>> 		JackControl "Headphone Jack"
>> expects the mixer element.  The bad thing is that the complete card
>> entry disappears because of inconsistency.
>> If you modify the entry as
>> 		JackControl "name='Headphone Jack',iface=CARD"
>> it would work.  But the fact that other JackControl stuff works, it's
>> better to align the USB-audio with IFACE_MIXER, I guess.
> 
> Hm, looking at the UCM code, UCM should treat IFACE_CARD as default,
> indeed.  Something went south.  Will take a deeper look.

Perhaps, it's this issue - 
https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2744 . The 
configuration for the Dell's docking station has also defined all jacks. If 
only an output equipment is connected, the pipewire may set the profile as not 
available. My fix (MR1429) should work. No idea why this issue is not visible 
in PA.

 From alsa-info (from the OpenSuse bug), jack states:

	name 'Line Out Jack' 	value true
	name 'Headphone Jack' 	value false
	name 'Headset Mic Jack'	value false

				Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Fix regression with Dell Dock jack detection
  2022-11-02 12:18       ` Jaroslav Kysela
@ 2022-11-02 12:45         ` Takashi Iwai
  2022-11-02 14:05           ` Jaroslav Kysela
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2022-11-02 12:45 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

On Wed, 02 Nov 2022 13:18:05 +0100,
Jaroslav Kysela wrote:
> 
> On 02. 11. 22 13:05, Takashi Iwai wrote:
> > On Wed, 02 Nov 2022 12:59:49 +0100,
> > Takashi Iwai wrote:
> >> 
> >> On Wed, 02 Nov 2022 12:53:48 +0100,
> >> Jaroslav Kysela wrote:
> >>> 
> >>> On 02. 11. 22 12:34, Takashi Iwai wrote:
> >>>> The recent commit added Jack controls to Dell Dock, but it added with
> >>>> iface = SNDRV_CTL_ELEM_IFACE_CARD.  Unfortunately this doesn't match
> >>>> with the changes in user-space UCM profile, which expects iface =
> >>>> SNDRV_CTL_ELEM_IFACE_MIXER as default.  This mismatch resulted in the
> >>>> non-working profile, and the Dell Dock is gone on pipewire /
> >>>> PulseAudio after the kernel update.
> >>>> 
> >>>> Fix the regression by adjusting the iface of the new ctl elements to
> >>>> *_MIXER.
> >>> 
> >>> Hi Takashi,
> >>> 
> >>> UCM expects SNDRV_CTL_ELEM_IFACE_CARD for jacks by default. Which
> >>> change do you refer? I would drop this patch.
> >> 
> >> It's about ucm2/USB-Audio/Dell/WD15-Dock-HiFi.conf, the JackControl
> >> entries.  For example,
> >> 		JackControl "Headphone Jack"
> >> expects the mixer element.  The bad thing is that the complete card
> >> entry disappears because of inconsistency.
> >> If you modify the entry as
> >> 		JackControl "name='Headphone Jack',iface=CARD"
> >> it would work.  But the fact that other JackControl stuff works, it's
> >> better to align the USB-audio with IFACE_MIXER, I guess.
> > 
> > Hm, looking at the UCM code, UCM should treat IFACE_CARD as default,
> > indeed.  Something went south.  Will take a deeper look.
> 
> Perhaps, it's this issue -
> https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2744 . The
> configuration for the Dell's docking station has also defined all
> jacks. If only an output equipment is connected, the pipewire may set
> the profile as not available. My fix (MR1429) should work. No idea why
> this issue is not visible in PA.

Yeah, I guess you're right, it's an issue in pipewire.  Let's scratch
my previous patch.

My bogus fix in the kernel looked as if working just because it made
the jack unmatching (again), hence it skips the bug of pipewire.


BTW, while looking at this bug, I noticed another bug in alsa-lib
src/ucm/main.c.  The check in snd_use_case_parse_ctl_elem_id() should
be rather to the value, not the identifier:

--- a/src/ucm/main.c
+++ b/src/ucm/main.c
@@ -2793,7 +2793,7 @@ int snd_use_case_parse_ctl_elem_id(snd_ctl_elem_id_t *dst,
 	    strcmp(ucm_id, "CaptureSwitch"))
 		return -EINVAL;
 	snd_ctl_elem_id_clear(dst);
-	if (strcasestr(ucm_id, "name="))
+	if (strcasestr(value, "name="))
 		return __snd_ctl_ascii_elem_id_parse(dst, value, NULL);
 	iface = SND_CTL_ELEM_IFACE_MIXER;
 	if (jack_control)



Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Fix regression with Dell Dock jack detection
  2022-11-02 12:45         ` Takashi Iwai
@ 2022-11-02 14:05           ` Jaroslav Kysela
  0 siblings, 0 replies; 7+ messages in thread
From: Jaroslav Kysela @ 2022-11-02 14:05 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On 02. 11. 22 13:45, Takashi Iwai wrote:

> BTW, while looking at this bug, I noticed another bug in alsa-lib
> src/ucm/main.c.  The check in snd_use_case_parse_ctl_elem_id() should
> be rather to the value, not the identifier:
> 
> --- a/src/ucm/main.c
> +++ b/src/ucm/main.c
> @@ -2793,7 +2793,7 @@ int snd_use_case_parse_ctl_elem_id(snd_ctl_elem_id_t *dst,
>   	    strcmp(ucm_id, "CaptureSwitch"))
>   		return -EINVAL;
>   	snd_ctl_elem_id_clear(dst);
> -	if (strcasestr(ucm_id, "name="))
> +	if (strcasestr(value, "name="))
>   		return __snd_ctl_ascii_elem_id_parse(dst, value, NULL);
>   	iface = SND_CTL_ELEM_IFACE_MIXER;
>   	if (jack_control)

Oops. Thanks, it looks like an obvious thinko. Fixed right now.

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-02 14:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-02 11:34 [PATCH] ALSA: usb-audio: Fix regression with Dell Dock jack detection Takashi Iwai
2022-11-02 11:53 ` Jaroslav Kysela
2022-11-02 11:59   ` Takashi Iwai
2022-11-02 12:05     ` Takashi Iwai
2022-11-02 12:18       ` Jaroslav Kysela
2022-11-02 12:45         ` Takashi Iwai
2022-11-02 14:05           ` Jaroslav Kysela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.