diff options
author | Mark Brown <broonie@kernel.org> | 2021-02-05 16:01:21 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-02-05 16:01:21 +0100 |
commit | 2927e6d398d0fca52d8f011a89dcfcabb2b1abfd (patch) | |
tree | 30ddd4cddded855db423c290512d7be7c13dc9db /sound/soc/mediatek/mt8192 | |
parent | Merge series "ASoC: mediatek: mt8192: apply some cleanup" from Tzung-Bi Shih ... (diff) | |
parent | Merge series "ASoC: SOF/Intel/SoundWire: add missing quirks and DMIC support"... (diff) | |
download | linux-2927e6d398d0fca52d8f011a89dcfcabb2b1abfd.tar.xz linux-2927e6d398d0fca52d8f011a89dcfcabb2b1abfd.zip |
Merge branch 'asoc-5.11' into asoc-5.12
Diffstat (limited to 'sound/soc/mediatek/mt8192')
-rw-r--r-- | sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c index f4b09672af8f..a606133951b7 100644 --- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c @@ -406,6 +406,53 @@ static const struct snd_soc_ops mt8192_mt6359_capture1_ops = { .startup = mt8192_mt6359_cap1_startup, }; +static int +mt8192_mt6359_rt5682_startup(struct snd_pcm_substream *substream) +{ + static const unsigned int channels[] = { + 1, 2 + }; + static const struct snd_pcm_hw_constraint_list constraints_channels = { + .count = ARRAY_SIZE(channels), + .list = channels, + .mask = 0, + }; + static const unsigned int rates[] = { + 48000 + }; + static const struct snd_pcm_hw_constraint_list constraints_rates = { + .count = ARRAY_SIZE(rates), + .list = rates, + .mask = 0, + }; + + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + int ret; + + ret = snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, + &constraints_channels); + if (ret < 0) { + dev_err(rtd->dev, "hw_constraint_list channels failed\n"); + return ret; + } + + ret = snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, + &constraints_rates); + if (ret < 0) { + dev_err(rtd->dev, "hw_constraint_list rate failed\n"); + return ret; + } + + return 0; +} + +static const struct snd_soc_ops mt8192_mt6359_rt5682_ops = { + .startup = mt8192_mt6359_rt5682_startup, +}; + /* FE */ SND_SOC_DAILINK_DEFS(playback1, DAILINK_COMP_ARRAY(COMP_CPU("DL1")), @@ -653,6 +700,7 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = { SND_SOC_DPCM_TRIGGER_PRE}, .dynamic = 1, .dpcm_playback = 1, + .ops = &mt8192_mt6359_rt5682_ops, SND_SOC_DAILINK_REG(playback3), }, { @@ -726,6 +774,7 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = { SND_SOC_DPCM_TRIGGER_PRE}, .dynamic = 1, .dpcm_capture = 1, + .ops = &mt8192_mt6359_rt5682_ops, SND_SOC_DAILINK_REG(capture2), }, { |