diff mbox series

Behringer UFX1604: get rid of pops and clicks while on 96000hz

Message ID CAEsQvcsXKRzCfDcid7nBnfvg6Vx1xQiBuK-EQmv4iGkDvZ0b3Q@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series Behringer UFX1604: get rid of pops and clicks while on 96000hz | expand

Commit Message

Geraldo Nascimento March 25, 2021, 10:39 p.m. UTC
Hello everyone!

This one has been bugging me for quite a while. I went deep hard in the
guts of ALSA to try to solve it, and it turned out to be a minor thing
apparently. The problem is old, and every UFX1604 Linux user can attest
that it's impossible to use 96000hz in DUPLEX mode without annoying pops
and clicks on the capture stream.

The fix is simple: after we alter the CLOCK_SOURCE to match our sample
rate, let's tell the CLOCK_SELECTOR we want CLOCK_SOURCE 212 (synced to USB
SOF) on pin 1. Solves the problem for me, no more pops and clicks while on
96000hz.

If you own an UFX1604 please give this patch a good testing. Let me know if
it solves the pops and clicks on the input stream for you while on DUPLEX
96000hz.

 }

Comments

Geraldo Nascimento March 25, 2021, 10:45 p.m. UTC | #1
Oh, forgot to mention. Both IN and OUT audio endpoints on the UFX1604 are
Synchronous. Somehow someone thought it was a good idea to add an implicit
feedback quirk for it.

I consider this unneeded and pointless. In fact I disengaged the implicit
feedback quirk on my 5.12-rc4 tree and it runs fine without it.

On Thu, Mar 25, 2021 at 7:39 PM Geraldo <geraldogabriel@gmail.com> wrote:

> Hello everyone!
>
> This one has been bugging me for quite a while. I went deep hard in the
> guts of ALSA to try to solve it, and it turned out to be a minor thing
> apparently. The problem is old, and every UFX1604 Linux user can attest
> that it's impossible to use 96000hz in DUPLEX mode without annoying pops
> and clicks on the capture stream.
>
> The fix is simple: after we alter the CLOCK_SOURCE to match our sample
> rate, let's tell the CLOCK_SELECTOR we want CLOCK_SOURCE 212 (synced to USB
> SOF) on pin 1. Solves the problem for me, no more pops and clicks while on
> 96000hz.
>
> If you own an UFX1604 please give this patch a good testing. Let me know
> if it solves the pops and clicks on the input stream for you while on
> DUPLEX 96000hz.
>
> --- clock.c.git 2021-03-22 04:19:55.543485748 -0300
> +++ clock.c     2021-03-25 19:23:38.597197159 -0300
> @@ -610,6 +610,13 @@ int snd_usb_set_sample_rate_v2v3(struct
>         if (err < 0)
>                 return err;
>
> +        if (chip->usb_id == USB_ID(0x1397, 0x0001)) { /* Behringer
> UFX1604 */
> +                printk(KERN_WARNING "Setting clock selector for UFX1604");
> +                err = uac_clock_selector_set_val(chip, 211, 1);
> +                if (err < 0)
> +                    return err;
> +       }
> +
>         return get_sample_rate_v2v3(chip, fmt->iface, fmt->altsetting,
> clock);
>  }
>
>
Geraldo Nascimento March 27, 2021, 12:59 a.m. UTC | #2
To clarify: I'm not blaming anyone for introducing an implicit feedback
quirk on a Synchronous endpoint. In fact, I'm almost sure it was somehow
needed at the time. But it isn't anymore. What is needed is to set the
CLOCK_SELECTOR to pin 1 right after we set CLOCK_SOURCE to our desired rate.

Em Qui, 25 de mar de 2021 19:45, Geraldo <geraldogabriel@gmail.com>
escreveu:

> Oh, forgot to mention. Both IN and OUT audio endpoints on the UFX1604 are
> Synchronous. Somehow someone thought it was a good idea to add an implicit
> feedback quirk for it.
>
> I consider this unneeded and pointless. In fact I disengaged the implicit
> feedback quirk on my 5.12-rc4 tree and it runs fine without it.
>
> On Thu, Mar 25, 2021 at 7:39 PM Geraldo <geraldogabriel@gmail.com> wrote:
>
>> Hello everyone!
>>
>> This one has been bugging me for quite a while. I went deep hard in the
>> guts of ALSA to try to solve it, and it turned out to be a minor thing
>> apparently. The problem is old, and every UFX1604 Linux user can attest
>> that it's impossible to use 96000hz in DUPLEX mode without annoying pops
>> and clicks on the capture stream.
>>
>> The fix is simple: after we alter the CLOCK_SOURCE to match our sample
>> rate, let's tell the CLOCK_SELECTOR we want CLOCK_SOURCE 212 (synced to USB
>> SOF) on pin 1. Solves the problem for me, no more pops and clicks while on
>> 96000hz.
>>
>> If you own an UFX1604 please give this patch a good testing. Let me know
>> if it solves the pops and clicks on the input stream for you while on
>> DUPLEX 96000hz.
>>
>> --- clock.c.git 2021-03-22 04:19:55.543485748 -0300
>> +++ clock.c     2021-03-25 19:23:38.597197159 -0300
>> @@ -610,6 +610,13 @@ int snd_usb_set_sample_rate_v2v3(struct
>>         if (err < 0)
>>                 return err;
>>
>> +        if (chip->usb_id == USB_ID(0x1397, 0x0001)) { /* Behringer
>> UFX1604 */
>> +                printk(KERN_WARNING "Setting clock selector for
>> UFX1604");
>> +                err = uac_clock_selector_set_val(chip, 211, 1);
>> +                if (err < 0)
>> +                    return err;
>> +       }
>> +
>>         return get_sample_rate_v2v3(chip, fmt->iface, fmt->altsetting,
>> clock);
>>  }
>>
>>
>
diff mbox series

Patch

--- clock.c.git 2021-03-22 04:19:55.543485748 -0300
+++ clock.c     2021-03-25 19:23:38.597197159 -0300
@@ -610,6 +610,13 @@  int snd_usb_set_sample_rate_v2v3(struct
        if (err < 0)
                return err;

+        if (chip->usb_id == USB_ID(0x1397, 0x0001)) { /* Behringer UFX1604
*/
+                printk(KERN_WARNING "Setting clock selector for UFX1604");
+                err = uac_clock_selector_set_val(chip, 211, 1);
+                if (err < 0)
+                    return err;
+       }
+
        return get_sample_rate_v2v3(chip, fmt->iface, fmt->altsetting,
clock);