]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: Intel: avs: drop SNDRV_PCM_RATE_KNOT
authorJerome Brunet <jbrunet@baylibre.com>
Thu, 5 Sep 2024 14:13:00 +0000 (16:13 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 6 Sep 2024 07:23:55 +0000 (09:23 +0200)
The custom rate constraint list was necessary to support 12kHz, 24kHz and
128kHz. These rates are now available through SNDRV_PCM_RATE_12000,
SNDRV_PCM_RATE_24000 and SNDRV_PCM_RATE_128000.

Use them and drop the custom rate constraint rule.

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-9-8371948d3921@baylibre.com
sound/soc/intel/avs/pcm.c

index c76b86254a8b4dafd4767ec3f8b224456f45aec0..afc0fc74cf9419f973c40314e6f302f23fcb9c1b 100644 (file)
@@ -471,16 +471,6 @@ static int hw_rule_param_size(struct snd_pcm_hw_params *params, struct snd_pcm_h
 static int avs_pcm_hw_constraints_init(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
-       static const unsigned int rates[] = {
-               8000, 11025, 12000, 16000,
-               22050, 24000, 32000, 44100,
-               48000, 64000, 88200, 96000,
-               128000, 176400, 192000,
-       };
-       static const struct snd_pcm_hw_constraint_list rate_list = {
-               .count = ARRAY_SIZE(rates),
-               .list = rates,
-       };
        int ret;
 
        ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
@@ -492,10 +482,6 @@ static int avs_pcm_hw_constraints_init(struct snd_pcm_substream *substream)
        if (ret < 0)
                return ret;
 
-       ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &rate_list);
-       if (ret < 0)
-               return ret;
-
        /* Adjust buffer and period size based on the audio format. */
        snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, hw_rule_param_size, NULL,
                            SNDRV_PCM_HW_PARAM_FORMAT, SNDRV_PCM_HW_PARAM_CHANNELS,
@@ -1332,7 +1318,9 @@ static const struct snd_soc_dai_driver i2s_dai_template = {
                .channels_min   = 1,
                .channels_max   = 8,
                .rates          = SNDRV_PCM_RATE_8000_192000 |
-                                 SNDRV_PCM_RATE_KNOT,
+                                 SNDRV_PCM_RATE_12000 |
+                                 SNDRV_PCM_RATE_24000 |
+                                 SNDRV_PCM_RATE_128000,
                .formats        = SNDRV_PCM_FMTBIT_S16_LE |
                                  SNDRV_PCM_FMTBIT_S32_LE,
                .subformats     = SNDRV_PCM_SUBFMTBIT_MSBITS_20 |
@@ -1343,7 +1331,9 @@ static const struct snd_soc_dai_driver i2s_dai_template = {
                .channels_min   = 1,
                .channels_max   = 8,
                .rates          = SNDRV_PCM_RATE_8000_192000 |
-                                 SNDRV_PCM_RATE_KNOT,
+                                 SNDRV_PCM_RATE_12000 |
+                                 SNDRV_PCM_RATE_24000 |
+                                 SNDRV_PCM_RATE_128000,
                .formats        = SNDRV_PCM_FMTBIT_S16_LE |
                                  SNDRV_PCM_FMTBIT_S32_LE,
                .subformats     = SNDRV_PCM_SUBFMTBIT_MSBITS_20 |