]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ALSA: emu10k1: drop SNDRV_PCM_RATE_KNOT
authorJerome Brunet <jbrunet@baylibre.com>
Thu, 5 Sep 2024 14:12:54 +0000 (16:12 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 6 Sep 2024 07:23:54 +0000 (09:23 +0200)
The custom rate constraint lists were necessary to support 12kHz and 24kHz.
These rates are now available through SNDRV_PCM_RATE_12000 and
SNDRV_PCM_RATE_24000.

Use them and drop the custom rate constraint rules.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: David Rhodes <drhodes@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240905-alsa-12-24-128-v1-3-8371948d3921@baylibre.com
sound/pci/emu10k1/emupcm.c

index 7f4c1b38d6ecfdbf0617937b4e40a2dc488c6535..1bf6e3d652f81448a563edc9c930b84eadcef5f0 100644 (file)
@@ -147,16 +147,6 @@ static const struct snd_pcm_hw_constraint_list hw_constraints_capture_buffer_siz
        .mask = 0
 };
 
-static const unsigned int capture_rates[8] = {
-       8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000
-};
-
-static const struct snd_pcm_hw_constraint_list hw_constraints_capture_rates = {
-       .count = 8,
-       .list = capture_rates,
-       .mask = 0
-};
-
 static unsigned int snd_emu10k1_capture_rate_reg(unsigned int rate)
 {
        switch (rate) {
@@ -174,16 +164,6 @@ static unsigned int snd_emu10k1_capture_rate_reg(unsigned int rate)
        }
 }
 
-static const unsigned int audigy_capture_rates[9] = {
-       8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000
-};
-
-static const struct snd_pcm_hw_constraint_list hw_constraints_audigy_capture_rates = {
-       .count = 9,
-       .list = audigy_capture_rates,
-       .mask = 0
-};
-
 static unsigned int snd_emu10k1_audigy_capture_rate_reg(unsigned int rate)
 {
        switch (rate) {
@@ -207,17 +187,16 @@ static void snd_emu10k1_constrain_capture_rates(struct snd_emu10k1 *emu,
 {
        if (emu->card_capabilities->emu_model &&
            emu->emu1010.word_clock == 44100) {
-               // This also sets the rate constraint by deleting SNDRV_PCM_RATE_KNOT
                runtime->hw.rates = SNDRV_PCM_RATE_11025 | \
                                    SNDRV_PCM_RATE_22050 | \
                                    SNDRV_PCM_RATE_44100;
                runtime->hw.rate_min = 11025;
                runtime->hw.rate_max = 44100;
-               return;
+       } else if (emu->audigy) {
+               runtime->hw.rates = SNDRV_PCM_RATE_8000_48000 |
+                                   SNDRV_PCM_RATE_12000 |
+                                   SNDRV_PCM_RATE_24000;
        }
-       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
-                                  emu->audigy ? &hw_constraints_audigy_capture_rates :
-                                                &hw_constraints_capture_rates);
 }
 
 static void snd_emu1010_constrain_efx_rate(struct snd_emu10k1 *emu,
@@ -1053,7 +1032,7 @@ static const struct snd_pcm_hardware snd_emu10k1_capture =
                                 SNDRV_PCM_INFO_RESUME |
                                 SNDRV_PCM_INFO_MMAP_VALID),
        .formats =              SNDRV_PCM_FMTBIT_S16_LE,
-       .rates =                SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_KNOT,
+       .rates =                SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_24000,
        .rate_min =             8000,
        .rate_max =             48000,
        .channels_min =         1,