On Sat, 10 Apr 2021 03:36:14 +0200, Geraldo Nascimento wrote:
More complete patch disabling unneeded implicit feedback and setting clock selector to default clock on rate change for UFX1604
After re-reading https://bugzilla.kernel.org/show_bug.cgi?id=199327 it is even more clear to me that implicit feedback for the UFX1604/UFX1204 needs to be disabled.
This is a more complete patch that disables that and for the UFX1604 only sets the clock selector to its pin 1 default clock synced to the USB SOF upon rate change. This is needed because apparently the endpoints are hardwired to the clock selector and after we change the rate on the main USB SOF synced clock the clock selector is left in a halfway state in regards to the sampling rate.
That's why the pops and clicks aren't evident at stock 48000Hz, become slightly audible at 44100Hz and detestable at 96000Hz. Seems the clock selector needs a nudge or it will screw up the sync.
Unfortunately I don't have access to the lsusb -v of the UFX1204 soI'm waiting for someone to share it here in the list or in the bugzilla thread. This patch needs some more love from the community.
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.
Signed-off-by: Geraldo Nascimento geraldogabriel@gmail.com
Thanks for the patch.
But we'd like to avoid the setup with a magic ID number. Judging from what it achieves, does the change like below give the similar effect?
We might need to apply it conditionally, so this is just meant for testing.
Takashi
--- a/sound/usb/clock.c +++ b/sound/usb/clock.c @@ -324,6 +324,8 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, ret = __uac_clock_find_source(chip, fmt, selector->baCSourceID[ret - 1], visited, validate); + if (ret > 0) + uac_clock_selector_set_val(chip, entity_id, cur); if (!validate || ret > 0 || !chip->autoclock) return ret;