Skip to content

Commit d24dbc8

Browse files
Amadeusz Sławińskibroonie
authored andcommitted
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: Cezary Rojewski <[email protected]> Signed-off-by: Amadeusz Sławiński <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 61f3686 commit d24dbc8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

sound/soc/intel/avs/boards/rt5682.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,27 @@ static const struct snd_soc_ops avs_rt5682_ops = {
169169
.hw_params = avs_rt5682_hw_params,
170170
};
171171

172+
static int
173+
avs_rt5682_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pcm_hw_params *params)
174+
{
175+
struct snd_interval *rate, *channels;
176+
struct snd_mask *fmt;
177+
178+
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
179+
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
180+
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
181+
182+
/* The ADSP will convert the FE rate to 48k, stereo */
183+
rate->min = rate->max = 48000;
184+
channels->min = channels->max = 2;
185+
186+
/* set SSPN to 24 bit */
187+
snd_mask_none(fmt);
188+
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
189+
190+
return 0;
191+
}
192+
172193
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
173194
struct snd_soc_dai_link **dai_link)
174195
{
@@ -201,6 +222,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
201222
dl->id = 0;
202223
dl->init = avs_rt5682_codec_init;
203224
dl->exit = avs_rt5682_codec_exit;
225+
dl->be_hw_params_fixup = avs_rt5682_be_fixup;
204226
dl->ops = &avs_rt5682_ops;
205227
dl->nonatomic = 1;
206228
dl->no_pcm = 1;

0 commit comments

Comments
 (0)