Skip to content

Commit 3bc17b8

Browse files
committed
ASoC: codecs: es8316: Fix HW rate calculation for 48Mhz MCLK
JIRA: https://issues.redhat.com/browse/RHEL-80681 commit 85c9ac7 Author: Marian Postevca <posteuca@mutex.one> Date: Fri Dec 27 22:27:51 2024 +0200 ASoC: codecs: es8316: Fix HW rate calculation for 48Mhz MCLK For 48Mhz MCLK systems the calculation of the HW rate is broken, and will not produce even one sane rate. Since es83xx supports the option to halve MCLK, calculate also rates with MCLK/2. Signed-off-by: Marian Postevca <posteuca@mutex.one> Link: https://patch.msgid.link/20241227202751.244954-1-posteuca@mutex.one Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
1 parent 91c1490 commit 3bc17b8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sound/soc/codecs/es8316.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ struct es8316_priv {
3939
struct snd_soc_jack *jack;
4040
int irq;
4141
unsigned int sysclk;
42-
unsigned int allowed_rates[ARRAY_SIZE(supported_mclk_lrck_ratios)];
42+
/* ES83xx supports halving the MCLK so it supports twice as many rates
43+
*/
44+
unsigned int allowed_rates[ARRAY_SIZE(supported_mclk_lrck_ratios) * 2];
4345
struct snd_pcm_hw_constraint_list sysclk_constraints;
4446
bool jd_inverted;
4547
};
@@ -386,6 +388,12 @@ static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai,
386388

387389
if (freq % ratio == 0)
388390
es8316->allowed_rates[count++] = freq / ratio;
391+
392+
/* We also check if the halved MCLK produces a valid rate
393+
* since the codec supports halving the MCLK.
394+
*/
395+
if ((freq / ratio) % 2 == 0)
396+
es8316->allowed_rates[count++] = freq / ratio / 2;
389397
}
390398

391399
if (count) {

0 commit comments

Comments
 (0)