Skip to content

Commit 79acb4c

Browse files
jbrun3ttiwai
authored andcommitted
ASoC: cs35l41: drop SNDRV_PCM_RATE_KNOT
The custom rate constraint list 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-7-8371948d3921@baylibre.com
1 parent 7067e81 commit 79acb4c

1 file changed

Lines changed: 11 additions & 23 deletions

File tree

sound/soc/codecs/cs35l41.c

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -808,26 +808,6 @@ static int cs35l41_get_clk_config(int freq)
808808
return -EINVAL;
809809
}
810810

811-
static const unsigned int cs35l41_src_rates[] = {
812-
8000, 12000, 11025, 16000, 22050, 24000, 32000,
813-
44100, 48000, 88200, 96000, 176400, 192000
814-
};
815-
816-
static const struct snd_pcm_hw_constraint_list cs35l41_constraints = {
817-
.count = ARRAY_SIZE(cs35l41_src_rates),
818-
.list = cs35l41_src_rates,
819-
};
820-
821-
static int cs35l41_pcm_startup(struct snd_pcm_substream *substream,
822-
struct snd_soc_dai *dai)
823-
{
824-
if (substream->runtime)
825-
return snd_pcm_hw_constraint_list(substream->runtime, 0,
826-
SNDRV_PCM_HW_PARAM_RATE,
827-
&cs35l41_constraints);
828-
return 0;
829-
}
830-
831811
static int cs35l41_component_set_sysclk(struct snd_soc_component *component,
832812
int clk_id, int source,
833813
unsigned int freq, int dir)
@@ -974,13 +954,21 @@ static void cs35l41_component_remove(struct snd_soc_component *component)
974954
}
975955

976956
static const struct snd_soc_dai_ops cs35l41_ops = {
977-
.startup = cs35l41_pcm_startup,
978957
.set_fmt = cs35l41_set_dai_fmt,
979958
.hw_params = cs35l41_pcm_hw_params,
980959
.set_sysclk = cs35l41_dai_set_sysclk,
981960
.set_channel_map = cs35l41_set_channel_map,
982961
};
983962

963+
#define CS35L41_RATES ( \
964+
SNDRV_PCM_RATE_8000_48000 | \
965+
SNDRV_PCM_RATE_12000 | \
966+
SNDRV_PCM_RATE_24000 | \
967+
SNDRV_PCM_RATE_88200 | \
968+
SNDRV_PCM_RATE_96000 | \
969+
SNDRV_PCM_RATE_176400 | \
970+
SNDRV_PCM_RATE_192000)
971+
984972
static struct snd_soc_dai_driver cs35l41_dai[] = {
985973
{
986974
.name = "cs35l41-pcm",
@@ -989,14 +977,14 @@ static struct snd_soc_dai_driver cs35l41_dai[] = {
989977
.stream_name = "AMP Playback",
990978
.channels_min = 1,
991979
.channels_max = 2,
992-
.rates = SNDRV_PCM_RATE_KNOT,
980+
.rates = CS35L41_RATES,
993981
.formats = CS35L41_RX_FORMATS,
994982
},
995983
.capture = {
996984
.stream_name = "AMP Capture",
997985
.channels_min = 1,
998986
.channels_max = 4,
999-
.rates = SNDRV_PCM_RATE_KNOT,
987+
.rates = CS35L41_RATES,
1000988
.formats = CS35L41_TX_FORMATS,
1001989
},
1002990
.ops = &cs35l41_ops,

0 commit comments

Comments
 (0)