ALSA: usb-audio: More refactoring of hw constraint rules
authorTakashi Iwai <tiwai@suse.de>
Mon, 2 Jan 2023 17:07:59 +0000 (18:07 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 4 Jan 2023 08:54:21 +0000 (09:54 +0100)
commit37b3e56d8911f9ec1e1aaa5cccdff33cb0a7a832
tree0f5c227b7aff9cf432c2dbd3dfd1e2f950ebce51
parentd463ac1acb454fafed58f695cb3067fbf489f3a0
ALSA: usb-audio: More refactoring of hw constraint rules

Although we applied a workaround for the hw constraints code with the
implicit feedback sync, it still has a potential problem.  Namely, as
the code treats only the first matching (sync) endpoint, it might be
too restrictive when multiple endpoints are listed in the substream's
format list.

This patch is another attempt to improve the hw constraint handling
for the implicit feedback sync.  The code is rewritten and the sync EP
handling for the rate and the format is put inside the fmt_list loop
in each hw_rule_*() function instead of the additional rules.  The
rules for the period size and periods are extended to loop over the
fmt_list like others, and they apply the constraints only if needed.

Link: https://lore.kernel.org/r/4e509aea-e563-e592-e652-ba44af6733fe@veniogames.com
Link: https://lore.kernel.org/r/20230102170759.29610-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/pcm.c