From e7ab858390f24a23ba0827066382ba0e6a8e4379 Mon Sep 17 00:00:00 2001 From: Vitaly Rodionov Date: Thu, 23 Oct 2025 10:03:17 +0100 Subject: [PATCH] ASoC: cs530x: Correct MCLK reference frequency values The MCLK frequency must be 49.152 MHz (for 48 kHz-related sample rates) or 45.1584 MHz (for 44.1 kHz-related sample rates). Signed-off-by: Vitaly Rodionov Link: https://patch.msgid.link/20251023090327.58275-10-vitalyr@opensource.cirrus.com Signed-off-by: Mark Brown --- sound/soc/codecs/cs530x.c | 9 ++++++--- sound/soc/codecs/cs530x.h | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/cs530x.c b/sound/soc/codecs/cs530x.c index 6552bef0577b0..e74e6ffa73320 100644 --- a/sound/soc/codecs/cs530x.c +++ b/sound/soc/codecs/cs530x.c @@ -1100,9 +1100,12 @@ static int cs530x_set_sysclk(struct snd_soc_component *component, int clk_id, switch (source) { case CS530X_SYSCLK_SRC_MCLK: - if (freq != 24560000 && freq != 22572000) { - dev_err(component->dev, "Invalid MCLK source rate %d\n", - freq); + switch (freq) { + case CS530X_SYSCLK_REF_45_1MHZ: + case CS530X_SYSCLK_REF_49_1MHZ: + break; + default: + dev_err(component->dev, "Invalid MCLK source rate %d\n", freq); return -EINVAL; } break; diff --git a/sound/soc/codecs/cs530x.h b/sound/soc/codecs/cs530x.h index d11711715ba80..2c773c4b6b925 100644 --- a/sound/soc/codecs/cs530x.h +++ b/sound/soc/codecs/cs530x.h @@ -200,6 +200,12 @@ /* IN_VOL_CTL5 and OUT_VOL_CTL5 */ #define CS530X_INOUT_VU BIT(0) +/* MCLK Reference Source Frequency */ +/* 41KHz related */ +#define CS530X_SYSCLK_REF_45_1MHZ 45158400 +/* 48KHz related */ +#define CS530X_SYSCLK_REF_49_1MHZ 49152000 + /* System Clock Source */ #define CS530X_SYSCLK_SRC_MCLK 0 #define CS530X_SYSCLK_SRC_PLL 1 -- 2.47.3