• Takashi Iwai's avatar
    ALSA: usb-audio: Handle discrete rates properly in hw constraints · bc4e94aa
    Takashi Iwai authored
    In the current code, when the device provides the discrete sample rate
    tables with unusual sample rates, the driver tries to gather the whole
    values from the audioformat entries and create a hw-constraint rule to
    restrict with this single rate list.  This is rather inefficient and
    may overlook the rates that are associated only with the certain
    audioformat entries.
    
    This patch improves the hw constraint setup by rewriting the existing
    hw_rule_rate().  The discrete sample rates (identified by rate_table
    and nr_rates of format entry) are checked in the existing
    hw_rule_rate() instead of extra rules; in the case of discrete rates,
    the function compares with each rate table entry and calculates the
    min/max values from there.  For the contiguous rates, the behavior
    doesn't change.
    
    Along with it, snd_usb_pcm_check_knot() and snb_usb_substream
    rate_list field become superfluous, thus those are dropped.
    Tested-by: default avatarKeith Milner <kamilner@superlative.org>
    Tested-by: default avatarDylan Robinson <dylan_robinson@motu.com>
    Link: https://lore.kernel.org/r/20201123085347.19667-2-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    bc4e94aa
pcm.c 49.6 KB