Commit d24dbc86 authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: Intel: avs: rt5682: Explicitly define codec format

rt5682 is headset codec configured in 48000/2/S24_LE format regardless
of front end format, so force it to be so.
Reviewed-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230303134854.2277146-4-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 61f36862
...@@ -169,6 +169,27 @@ static const struct snd_soc_ops avs_rt5682_ops = { ...@@ -169,6 +169,27 @@ static const struct snd_soc_ops avs_rt5682_ops = {
.hw_params = avs_rt5682_hw_params, .hw_params = avs_rt5682_hw_params,
}; };
static int
avs_rt5682_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pcm_hw_params *params)
{
struct snd_interval *rate, *channels;
struct snd_mask *fmt;
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
/* The ADSP will convert the FE rate to 48k, stereo */
rate->min = rate->max = 48000;
channels->min = channels->max = 2;
/* set SSPN to 24 bit */
snd_mask_none(fmt);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
return 0;
}
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
struct snd_soc_dai_link **dai_link) struct snd_soc_dai_link **dai_link)
{ {
...@@ -201,6 +222,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in ...@@ -201,6 +222,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
dl->id = 0; dl->id = 0;
dl->init = avs_rt5682_codec_init; dl->init = avs_rt5682_codec_init;
dl->exit = avs_rt5682_codec_exit; dl->exit = avs_rt5682_codec_exit;
dl->be_hw_params_fixup = avs_rt5682_be_fixup;
dl->ops = &avs_rt5682_ops; dl->ops = &avs_rt5682_ops;
dl->nonatomic = 1; dl->nonatomic = 1;
dl->no_pcm = 1; dl->no_pcm = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment