diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-11-23 11:53:07 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2020-11-23 17:11:02 +0300 |
commit | bc4e94aa8e72e79598e63a0b73febdcd8aeb541f (patch) | |
tree | 7d8a4f198a5b0957c4dc1d848994addd1d7a5ccd /sound/usb/card.h | |
parent | 418baf2c28f3473039f2f7377760bd8f6897ae18 (diff) | |
download | linux-bc4e94aa8e72e79598e63a0b73febdcd8aeb541f.tar.xz |
ALSA: usb-audio: Handle discrete rates properly in hw constraints
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: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/card.h')
-rw-r--r-- | sound/usb/card.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/sound/usb/card.h b/sound/usb/card.h index 5351d7183b1b..3cc668f98f43 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -157,7 +157,6 @@ struct snd_usb_substream { u64 formats; /* format bitmasks (all or'ed) */ unsigned int num_formats; /* number of supported audio formats (list) */ struct list_head fmt_list; /* format list */ - struct snd_pcm_hw_constraint_list rate_list; /* limited rates */ spinlock_t lock; int last_frame_number; /* stored frame number */ |