Skip to contentSkip to conversation

ALSA: usb-audio: Skip setting clock selector for single connections

PATCH Applied Alexander Tsoy 2 participants 5 messages Jan 23, 2024 – Jan 28, 2024 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Skip setting clock selector for single connections

Since commit 086b957cc17f5 ("ALSA: usb-audio: Skip the clock selector inquiry for single connections") we are already skipping clock selector inquiry if only one clock source is connected, but we are still sending a set request. Lets skip that too.

This should fix errors when setting a sample rate on devices that don't have any controls present within the clock selector. An example of such device is the new revision of MOTU M Series (07fd:000b):

AudioControl Interface Descriptor:
bLength 8
bDescriptorType 36
bDescriptorSubtype 11 (CLOCK_SELECTOR)
bClockID 1
bNrInPins 1
baCSourceID(0) 2
bmControls 0x00
iClockSelector 0

Perhaps we also should check if clock selectors are readable and writeable like we already do for clock sources, but this is out of scope of this patch.

---
 sound/usb/clock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/clock.c +2 -1
index 33db334e6556..94e4aaeafe58 100644
@@ -325,7 +325,8 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
 					      visited, validate);
 		if (ret > 0) {
 			/* Skip setting clock selector again for some devices */
-			if (chip->quirk_flags & QUIRK_FLAG_SKIP_CLOCK_SELECTOR)
+			if (chip->quirk_flags & QUIRK_FLAG_SKIP_CLOCK_SELECTOR ||
+			    pins == 1)
 				return ret;
 			err = uac_clock_selector_set_val(chip, entity_id, cur);
 			if (err < 0)
Signature · 1 line
2.43.0
Applied
#1 lore raw
Quoted 20 lines · Alexander Tsoy

Since commit 086b957cc17f5 ("ALSA: usb-audio: Skip the clock selector inquiry for single connections") we are already skipping clock selector inquiry if only one clock source is connected, but we are still sending a set request. Lets skip that too.

This should fix errors when setting a sample rate on devices that don't have any controls present within the clock selector. An example of such device is the new revision of MOTU M Series (07fd:000b):

AudioControl Interface Descriptor:
bLength 8
bDescriptorType 36
bDescriptorSubtype 11 (CLOCK_SELECTOR)
bClockID 1
bNrInPins 1
baCSourceID(0) 2
bmControls 0x00
iClockSelector 0

Quoted 6 lines

Perhaps we also should check if clock selectors are readable and writeable like we already do for clock sources, but this is out of scope of this patch.

Thanks, applied.

Takashi

#2 lore raw

В Вт, 23/01/2024 в 15:14 +0100, Takashi Iwai пишет:

Quoted 37 lines
Quoted 37 lines
Quoted 35 lines · Alexander Tsoy
Quoted 35 lines

Since commit 086b957cc17f5 ("ALSA: usb-audio: Skip the clock selector
inquiry for single connections") we are already skipping clock selector
inquiry if only one clock source is connected, but we are still sending
a set request. Lets skip that too.

This should fix errors when setting a sample rate on devices that
don't
have any controls present within the clock selector. An example of
such
device is the new revision of MOTU M Series (07fd:000b):

      AudioControl Interface Descriptor:
        bLength                 8 bDescriptorType        36 bDescriptorSubtype     11 (CLOCK_SELECTOR) bClockID                1 bNrInPins               1 baCSourceID(0)          2 bmControls           0x00 iClockSelector          0

Perhaps we also should check if clock selectors are readable and
writeable
like we already do for clock sources, but this is out of scope of
this
patch.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Thanks, applied.

It looks like this patch will bring back problems with Behringer mixers [1]. So we probably should revert. The mentioned case with MOTU M Series should be also covered by "Support read-only clock selector control" commit.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=199327

#3 lore raw
Quoted 42 lines · Alexander Tsoy

В Вт, 23/01/2024 в 15:14 +0100, Takashi Iwai пишет:

Quoted 40 lines
Quoted 40 lines
Quoted 37 lines · Alexander Tsoy
Quoted 37 lines

Since commit 086b957cc17f5 ("ALSA: usb-audio: Skip the clock selector
inquiry for single connections") we are already skipping clock selector
inquiry if only one clock source is connected, but we are still sending
a set request. Lets skip that too.

This should fix errors when setting a sample rate on devices that
don't
have any controls present within the clock selector. An example of
such
device is the new revision of MOTU M Series (07fd:000b):

      AudioControl Interface Descriptor:
        bLength                 8 bDescriptorType        36 bDescriptorSubtype     11 (CLOCK_SELECTOR) bClockID                1 bNrInPins               1 baCSourceID(0)          2 bmControls           0x00 iClockSelector          0

Perhaps we also should check if clock selectors are readable and
writeable
like we already do for clock sources, but this is out of scope of
this
patch.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

Thanks, applied.

It looks like this patch will bring back problems with Behringer mixers [1]. So we probably should revert. The mentioned case with MOTU M Series should be also covered by "Support read-only clock selector control" commit.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=199327

OK, care to submit a patch to revert it?

thanks,

Takashi

#4 lore raw

В Вс, 28/01/2024 в 13:09 +0100, Takashi Iwai пишет:

Quoted 59 lines
Quoted 57 lines · Alexander Tsoy

В Вт, 23/01/2024 в 15:14 +0100, Takashi Iwai пишет:

Quoted 44 lines
Quoted 44 lines
Quoted 42 lines · Alexander Tsoy
Quoted 42 lines

Since commit 086b957cc17f5 ("ALSA: usb-audio: Skip the clock
selector
inquiry for single connections") we are already skipping clock
selector
inquiry if only one clock source is connected, but we are still
sending
a set request. Lets skip that too.

This should fix errors when setting a sample rate on devices
that
don't
have any controls present within the clock selector. An example
of
such
device is the new revision of MOTU M Series (07fd:000b):

      AudioControl Interface Descriptor:
        bLength                 8 bDescriptorType        36 bDescriptorSubtype     11 (CLOCK_SELECTOR) bClockID                1 bNrInPins               1 baCSourceID(0)          2 bmControls           0x00 iClockSelector          0

Perhaps we also should check if clock selectors are readable
and
writeable
like we already do for clock sources, but this is out of scope
of
this
patch.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Thanks, applied.

It looks like this patch will bring back problems with Behringer mixers
[1]. So we probably should revert. The mentioned case with MOTU M Series should be also covered by "Support read-only clock selector control" commit.

Quoted 3 lines
Quoted 1 line

[1] https://bugzilla.kernel.org/show_bug.cgi?id=199327

OK, care to submit a patch to revert it?

Sure, done!