Re: USB Audio Interface / Denon MC7000 and MC8000 controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



В Пн, 03/02/2020 в 11:23 +0100, Tobias пишет:
> Dear Alexander - unfortunately I did hot hear back from you. I guess 
> this may not be your highest priority but still - do you have any
> other 
> idea to make the MC7000 sound device working? Thanks a lot.

I think it should be safe to ignore clock validity check result if:
- only one single sample rate is supported;
- the clock source is internal,
- there is no clock selector.

Could you try the following patch?


diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 018b1ecb5404..636c340d4f9f 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -197,6 +197,38 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
 	return data ? true :  false;
 }
 
+/*
+ * Assume the clock is valid if clock source supports only one single sample
+ * rate, its type is not external and there is no clock selector. This is needed
+ * for some Denon DJ controllers, that always report that clock is invalid.
+ */
+static bool uac_clock_source_is_valid_quirk(struct snd_usb_audio *chip,
+					    struct audioformat *fmt,
+					    int clock)
+{
+	if (fmt->protocol == UAC_VERSION_3) {
+		struct uac3_clock_source_descriptor *cs_desc =
+			snd_usb_find_clock_source_v3(chip->ctrl_intf, clock);
+
+		if (!cs_desc)
+			return false;
+
+		return (fmt->nr_rates == 1 &&
+			(fmt->clock & 0xff) == cs_desc->bClockID &&
+			(cs_desc->bmAttributes & 0x1) != UAC3_CLOCK_SOURCE_TYPE_EXT);
+	} else { /* UAC_VERSION_2 */
+		struct uac_clock_source_descriptor *cs_desc =
+			snd_usb_find_clock_source(chip->ctrl_intf, clock);
+
+		if (!cs_desc)
+			return false;
+
+		return (fmt->nr_rates == 1 &&
+			(fmt->clock & 0xff) == cs_desc->bClockID &&
+			(cs_desc->bmAttributes & 0x3) != UAC_CLOCK_SOURCE_TYPE_EXT);
+	}
+}
+
 static int __uac_clock_find_source(struct snd_usb_audio *chip, int entity_id,
 				   unsigned long *visited, bool validate)
 {
@@ -577,7 +609,8 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip, int iface,
 
 validation:
 	/* validate clock after rate change */
-	if (!uac_clock_source_is_valid(chip, fmt->protocol, clock))
+	if (!uac_clock_source_is_valid(chip, fmt->protocol, clock) &&
+	    !uac_clock_source_is_valid_quirk(chip, fmt, clock))
 		return -ENXIO;
 	return 0;
 }

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux