From be8498ee21aa0952d80f781597fcdb29954c7517 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 10 Jun 2024 16:34:00 +0100
Subject: [PATCH 1119/1135] iqaudio-codec: Use the codec's new set_bclk_ratio

To ensure that the CPU DAI and codec agree over the BCLK ratio, impose
a fixed value of 64 on both of them.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 sound/soc/bcm/iqaudio-codec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/sound/soc/bcm/iqaudio-codec.c
+++ b/sound/soc/bcm/iqaudio-codec.c
@@ -127,13 +127,19 @@ static int snd_rpi_iqaudio_codec_init(st
 	snd_soc_dapm_disable_pin(&rtd->card->dapm, "AUX Jack");
 	snd_soc_dapm_sync(&rtd->card->dapm);
 
-	/* Set bclk ratio to align with codec's BCLK rate */
+	/* Impose BCLK ratios otherwise the codec may cheat */
 	ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64);
 	if (ret) {
 		dev_err(rtd->dev, "Failed to set CPU BLCK ratio\n");
 		return ret;
 	}
 
+	ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64);
+	if (ret) {
+		dev_err(rtd->dev, "Failed to set codec BCLK ratio\n");
+		return ret;
+	}
+
 	/* Set MCLK frequency to codec, onboard 11.2896MHz clock */
 	return snd_soc_dai_set_sysclk(codec_dai, DA7213_CLKSRC_MCLK, 11289600,
 				      SND_SOC_CLOCK_OUT);