Skip to content

Commit 61f3686

Browse files
Amadeusz Sławińskibroonie
authored andcommitted
ASoC: Intel: avs: da7219: Explicitly define codec format
da7219 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 d16c893 commit 61f3686

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,26 @@ static void avs_da7219_codec_exit(struct snd_soc_pcm_runtime *rtd)
117117
snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL);
118118
}
119119

120+
static int
121+
avs_da7219_be_fixup(struct snd_soc_pcm_runtime *runrime, struct snd_pcm_hw_params *params)
122+
{
123+
struct snd_interval *rate, *channels;
124+
struct snd_mask *fmt;
125+
126+
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
127+
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
128+
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
129+
130+
/* The ADSP will convert the FE rate to 48k, stereo */
131+
rate->min = rate->max = 48000;
132+
channels->min = channels->max = 2;
133+
134+
/* set SSP0 to 24 bit */
135+
snd_mask_none(fmt);
136+
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
137+
return 0;
138+
}
139+
120140
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
121141
struct snd_soc_dai_link **dai_link)
122142
{
@@ -148,6 +168,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
148168
dl->num_platforms = 1;
149169
dl->id = 0;
150170
dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
171+
dl->be_hw_params_fixup = avs_da7219_be_fixup;
151172
dl->init = avs_da7219_codec_init;
152173
dl->exit = avs_da7219_codec_exit;
153174
dl->nonatomic = 1;

0 commit comments

Comments
 (0)