aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/intel/boards/sof_cs42l42.c
diff options
context:
space:
mode:
authorGravatar Brent Lu <brent.lu@intel.com> 2021-06-25 15:50:42 -0500
committerGravatar Mark Brown <broonie@kernel.org> 2021-07-11 23:48:31 +0100
commit837ad6da36ba765d9ff8120c93dd243b9200957e (patch)
tree21e8138d14ff87b50b7e848665c4de1350f02ffa /sound/soc/intel/boards/sof_cs42l42.c
parentASoC: SOF: add a helper to get topology configured bclk (diff)
downloadlinux-837ad6da36ba765d9ff8120c93dd243b9200957e.tar.gz
linux-837ad6da36ba765d9ff8120c93dd243b9200957e.tar.bz2
linux-837ad6da36ba765d9ff8120c93dd243b9200957e.zip
ASoC: Intel: sof_cs42l42: use helper function to get bclk frequency
Use sof_dai_get_bclk() function to get bclk frequency instead of a hard-coded magic number depending on configuration in topology. Reviewed-by: Bard Liao <bard.liao@intel.com> Signed-off-by: Brent Lu <brent.lu@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210625205042.65181-5-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/boards/sof_cs42l42.c')
-rw-r--r--sound/soc/intel/boards/sof_cs42l42.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/soc/intel/boards/sof_cs42l42.c b/sound/soc/intel/boards/sof_cs42l42.c
index 42aadf801f72..2b16011b7a06 100644
--- a/sound/soc/intel/boards/sof_cs42l42.c
+++ b/sound/soc/intel/boards/sof_cs42l42.c
@@ -16,6 +16,7 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
+#include <sound/sof.h>
#include <sound/soc-acpi.h>
#include <dt-bindings/sound/cs42l42.h>
#include "../../codecs/hdac_hdmi.h"
@@ -122,7 +123,12 @@ static int sof_cs42l42_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int clk_freq, ret;
- clk_freq = 3072000; /* BCLK freq */
+ clk_freq = sof_dai_get_bclk(rtd); /* BCLK freq */
+
+ if (clk_freq <= 0) {
+ dev_err(rtd->dev, "get bclk freq failed: %d\n", clk_freq);
+ return -EINVAL;
+ }
/* Configure sysclk for codec */
ret = snd_soc_dai_set_sysclk(codec_dai, 0,