diff options
author | Tzung-Bi Shih <tzungbi@google.com> | 2020-06-23 13:51:30 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-06-23 12:54:10 +0100 |
commit | b1647f9f4f27824a689f774014bc33728b4fe7ec (patch) | |
tree | 90475037bccb1b04b3c12b8491df027b58eb403e /sound/soc/mediatek/mt8183 | |
parent | 5748f4eb01a4df7a42024fe8bc7855f05febb7c5 (diff) | |
download | linux-b1647f9f4f27824a689f774014bc33728b4fe7ec.tar.gz linux-b1647f9f4f27824a689f774014bc33728b4fe7ec.tar.bz2 linux-b1647f9f4f27824a689f774014bc33728b4fe7ec.zip |
ASoC: mediatek: mt8183-da7219: set playback and capture constraints
Sets playback and capture constraints to S16_LE, stereo, 48kHz.
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200623055130.159718-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/mediatek/mt8183')
-rw-r--r-- | sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index ffd7c931e7bb..b61bb2de4ec3 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -120,6 +120,46 @@ static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, } static int +mt8183_da7219_max98357_startup( + struct snd_pcm_substream *substream) +{ + static const unsigned int rates[] = { + 48000, + }; + static const struct snd_pcm_hw_constraint_list constraints_rates = { + .count = ARRAY_SIZE(rates), + .list = rates, + .mask = 0, + }; + static const unsigned int channels[] = { + 2, + }; + static const struct snd_pcm_hw_constraint_list constraints_channels = { + .count = ARRAY_SIZE(channels), + .list = channels, + .mask = 0, + }; + + struct snd_pcm_runtime *runtime = substream->runtime; + + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); + runtime->hw.channels_max = 2; + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, + &constraints_channels); + + runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; + snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16); + + return 0; +} + +static const struct snd_soc_ops mt8183_da7219_max98357_ops = { + .startup = mt8183_da7219_max98357_startup, +}; + +static int mt8183_da7219_max98357_bt_sco_startup( struct snd_pcm_substream *substream) { @@ -256,6 +296,7 @@ static struct snd_soc_dai_link mt8183_da7219_max98357_dai_links[] = { SND_SOC_DPCM_TRIGGER_PRE}, .dynamic = 1, .dpcm_playback = 1, + .ops = &mt8183_da7219_max98357_ops, SND_SOC_DAILINK_REG(playback1), }, { @@ -303,6 +344,7 @@ static struct snd_soc_dai_link mt8183_da7219_max98357_dai_links[] = { SND_SOC_DPCM_TRIGGER_PRE}, .dynamic = 1, .dpcm_capture = 1, + .ops = &mt8183_da7219_max98357_ops, SND_SOC_DAILINK_REG(capture3), }, { |