Skip to content

Commit 1eb96c1

Browse files
Yu-Hsuan Hsubroonie
authored andcommitted
ASoC: rockchip: add format and rate constraints on rk3399
S8 and S24 formats does not work on this machine driver so force to use S16_LE instead. In addition, add constraint to limit the max value of rate because the rate higher than 96000(172000, 192000) is not stable either. Signed-off-by: Yu-Hsuan Hsu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent ad922ca commit 1eb96c1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sound/soc/rockchip/rk3399_gru_sound.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,32 @@ static int rockchip_sound_dmic_hw_params(struct snd_pcm_substream *substream,
219219
return 0;
220220
}
221221

222+
static int rockchip_sound_startup(struct snd_pcm_substream *substream)
223+
{
224+
struct snd_pcm_runtime *runtime = substream->runtime;
225+
226+
runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
227+
return snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
228+
8000, 96000);
229+
}
230+
222231
static const struct snd_soc_ops rockchip_sound_max98357a_ops = {
232+
.startup = rockchip_sound_startup,
223233
.hw_params = rockchip_sound_max98357a_hw_params,
224234
};
225235

226236
static const struct snd_soc_ops rockchip_sound_rt5514_ops = {
237+
.startup = rockchip_sound_startup,
227238
.hw_params = rockchip_sound_rt5514_hw_params,
228239
};
229240

230241
static const struct snd_soc_ops rockchip_sound_da7219_ops = {
242+
.startup = rockchip_sound_startup,
231243
.hw_params = rockchip_sound_da7219_hw_params,
232244
};
233245

234246
static const struct snd_soc_ops rockchip_sound_dmic_ops = {
247+
.startup = rockchip_sound_startup,
235248
.hw_params = rockchip_sound_dmic_hw_params,
236249
};
237250

0 commit comments

Comments
 (0)