ASoC: Mediatek: MT8183: change supported formats of DL2 and UL1

DL2 and UL1 are for BTSCO.  They should only provide 16-bit, mono,
8kHz and 16kHz to userspace.  Change the formats accordingly.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Tzung-Bi Shih 2019-04-08 18:47:28 +08:00 committed by Mark Brown
parent f2a36a7842
commit 1df1e5457c
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -69,6 +69,46 @@ mt8183_mt6358_ts3a227_max98357_dapm_routes[] = {
{"IT6505_8CH", NULL, "TDM"},
};
static int
mt8183_mt6358_ts3a227_max98357_bt_sco_startup(
struct snd_pcm_substream *substream)
{
static const unsigned int rates[] = {
8000, 16000
};
static const struct snd_pcm_hw_constraint_list constraints_rates = {
.count = ARRAY_SIZE(rates),
.list = rates,
.mask = 0,
};
static const unsigned int channels[] = {
1,
};
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 = 1;
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_mt6358_ts3a227_max98357_bt_sco_ops = {
.startup = mt8183_mt6358_ts3a227_max98357_bt_sco_startup,
};
static struct snd_soc_dai_link
mt8183_mt6358_ts3a227_max98357_dai_links[] = {
/* FE */
@ -93,6 +133,7 @@ mt8183_mt6358_ts3a227_max98357_dai_links[] = {
SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1,
.dpcm_playback = 1,
.ops = &mt8183_mt6358_ts3a227_max98357_bt_sco_ops,
},
{
.name = "Playback_3",
@ -115,6 +156,7 @@ mt8183_mt6358_ts3a227_max98357_dai_links[] = {
SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1,
.dpcm_capture = 1,
.ops = &mt8183_mt6358_ts3a227_max98357_bt_sco_ops,
},
{
.name = "Capture_2",