All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Skip setting clock selector for single connections
@ 2024-01-23 13:46 Alexander Tsoy
  2024-01-23 14:14 ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Tsoy @ 2024-01-23 13:46 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai, Jaroslav Kysela

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.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217601
Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
---
 sound/usb/clock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 33db334e6556..94e4aaeafe58 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -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)
-- 
2.43.0


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

* Re: [PATCH] ALSA: usb-audio: Skip setting clock selector for single connections
  2024-01-23 13:46 [PATCH] ALSA: usb-audio: Skip setting clock selector for single connections Alexander Tsoy
@ 2024-01-23 14:14 ` Takashi Iwai
  2024-01-28 10:35   ` Alexander Tsoy
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2024-01-23 14:14 UTC (permalink / raw)
  To: Alexander Tsoy; +Cc: alsa-devel, Jaroslav Kysela

On Tue, 23 Jan 2024 14:46:35 +0100,
Alexander Tsoy wrote:
> 
> 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.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=217601
> Signed-off-by: Alexander Tsoy <alexander@tsoy.me>

Thanks, applied.


Takashi

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

* Re: [PATCH] ALSA: usb-audio: Skip setting clock selector for single connections
  2024-01-23 14:14 ` Takashi Iwai
@ 2024-01-28 10:35   ` Alexander Tsoy
  2024-01-28 12:09     ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Tsoy @ 2024-01-28 10:35 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-sound, alsa-devel, Jaroslav Kysela

В Вт, 23/01/2024 в 15:14 +0100, Takashi Iwai пишет:
> > On Tue, 23 Jan 2024 14:46:35 +0100,
> > Alexander Tsoy wrote:
> > > > 
> > > > 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.
> > > > 
> > > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=217601
> > > > Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
> > 
> > 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

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

* Re: [PATCH] ALSA: usb-audio: Skip setting clock selector for single connections
  2024-01-28 10:35   ` Alexander Tsoy
@ 2024-01-28 12:09     ` Takashi Iwai
  2024-01-28 13:27       ` Alexander Tsoy
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2024-01-28 12:09 UTC (permalink / raw)
  To: Alexander Tsoy; +Cc: linux-sound, alsa-devel, Jaroslav Kysela

On Sun, 28 Jan 2024 11:35:51 +0100,
Alexander Tsoy wrote:
> 
> В Вт, 23/01/2024 в 15:14 +0100, Takashi Iwai пишет:
> > > On Tue, 23 Jan 2024 14:46:35 +0100,
> > > Alexander Tsoy wrote:
> > > > > 
> > > > > 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.
> > > > > 
> > > > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=217601
> > > > > Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
> > > 
> > > 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

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

* Re: [PATCH] ALSA: usb-audio: Skip setting clock selector for single connections
  2024-01-28 12:09     ` Takashi Iwai
@ 2024-01-28 13:27       ` Alexander Tsoy
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Tsoy @ 2024-01-28 13:27 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-sound, alsa-devel, Jaroslav Kysela

В Вс, 28/01/2024 в 13:09 +0100, Takashi Iwai пишет:
> On Sun, 28 Jan 2024 11:35:51 +0100,
> Alexander Tsoy wrote:
> > 
> > В Вт, 23/01/2024 в 15:14 +0100, Takashi Iwai пишет:
> > > > On Tue, 23 Jan 2024 14:46:35 +0100,
> > > > Alexander Tsoy wrote:
> > > > > > 
> > > > > > 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.
> > > > > > 
> > > > > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=217601
> > > > > > Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
> > > > 
> > > > 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?

Sure, done!

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

end of thread, other threads:[~2024-01-28 13:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-23 13:46 [PATCH] ALSA: usb-audio: Skip setting clock selector for single connections Alexander Tsoy
2024-01-23 14:14 ` Takashi Iwai
2024-01-28 10:35   ` Alexander Tsoy
2024-01-28 12:09     ` Takashi Iwai
2024-01-28 13:27       ` Alexander Tsoy

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.