Skip to content

Commit 9dc03a1

Browse files
jbrun3ttiwai
authored andcommitted
ASoC: sunxi: sun4i-codec: drop SNDRV_PCM_RATE_KNOT
The custom rate constraint lists was 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 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-11-8371948d3921@baylibre.com
1 parent c061d1e commit 9dc03a1

1 file changed

Lines changed: 9 additions & 19 deletions

File tree

sound/soc/sunxi/sun4i-codec.c

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -577,28 +577,12 @@ static int sun4i_codec_hw_params(struct snd_pcm_substream *substream,
577577
hwrate);
578578
}
579579

580-
581-
static unsigned int sun4i_codec_src_rates[] = {
582-
8000, 11025, 12000, 16000, 22050, 24000, 32000,
583-
44100, 48000, 96000, 192000
584-
};
585-
586-
587-
static struct snd_pcm_hw_constraint_list sun4i_codec_constraints = {
588-
.count = ARRAY_SIZE(sun4i_codec_src_rates),
589-
.list = sun4i_codec_src_rates,
590-
};
591-
592-
593580
static int sun4i_codec_startup(struct snd_pcm_substream *substream,
594581
struct snd_soc_dai *dai)
595582
{
596583
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
597584
struct sun4i_codec *scodec = snd_soc_card_get_drvdata(rtd->card);
598585

599-
snd_pcm_hw_constraint_list(substream->runtime, 0,
600-
SNDRV_PCM_HW_PARAM_RATE, &sun4i_codec_constraints);
601-
602586
/*
603587
* Stop issuing DRQ when we have room for less than 16 samples
604588
* in our TX FIFO
@@ -626,6 +610,13 @@ static const struct snd_soc_dai_ops sun4i_codec_dai_ops = {
626610
.prepare = sun4i_codec_prepare,
627611
};
628612

613+
#define SUN4I_CODEC_RATES ( \
614+
SNDRV_PCM_RATE_8000_48000 | \
615+
SNDRV_PCM_RATE_12000 | \
616+
SNDRV_PCM_RATE_24000 | \
617+
SNDRV_PCM_RATE_96000 | \
618+
SNDRV_PCM_RATE_192000)
619+
629620
static struct snd_soc_dai_driver sun4i_codec_dai = {
630621
.name = "Codec",
631622
.ops = &sun4i_codec_dai_ops,
@@ -635,7 +626,7 @@ static struct snd_soc_dai_driver sun4i_codec_dai = {
635626
.channels_max = 2,
636627
.rate_min = 8000,
637628
.rate_max = 192000,
638-
.rates = SNDRV_PCM_RATE_CONTINUOUS,
629+
.rates = SUN4I_CODEC_RATES,
639630
.formats = SNDRV_PCM_FMTBIT_S16_LE |
640631
SNDRV_PCM_FMTBIT_S32_LE,
641632
.sig_bits = 24,
@@ -646,7 +637,7 @@ static struct snd_soc_dai_driver sun4i_codec_dai = {
646637
.channels_max = 2,
647638
.rate_min = 8000,
648639
.rate_max = 48000,
649-
.rates = SNDRV_PCM_RATE_CONTINUOUS,
640+
.rates = SUN4I_CODEC_RATES,
650641
.formats = SNDRV_PCM_FMTBIT_S16_LE |
651642
SNDRV_PCM_FMTBIT_S32_LE,
652643
.sig_bits = 24,
@@ -1233,7 +1224,6 @@ static const struct snd_soc_component_driver sun4i_codec_component = {
12331224
#endif
12341225
};
12351226

1236-
#define SUN4I_CODEC_RATES SNDRV_PCM_RATE_CONTINUOUS
12371227
#define SUN4I_CODEC_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
12381228
SNDRV_PCM_FMTBIT_S32_LE)
12391229

0 commit comments

Comments
 (0)