Skip to content

Commit

Permalink
ASoC: Intel: sof_cs42l42: use helper function to get bclk frequency
Browse files Browse the repository at this point in the history
Use sof_dai_get_bclk() function to get bclk frequency instead of a
hard-coded magic number depending on configuration in topology.

Signed-off-by: Brent Lu <brent.lu@intel.com>
  • Loading branch information
brentlu authored and kv2019i committed Jun 15, 2021
1 parent b38538a commit d90a16c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sound/soc/intel/boards/sof_cs42l42.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d90a16c

Please sign in to comment.