diff options
author | Viorel Suman <viorel.suman@nxp.com> | 2018-02-09 11:39:58 +0200 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2019-11-25 15:53:55 +0800 |
commit | 868ead7e7e0d6dc17512808ae84964a08a05499c (patch) | |
tree | 2bd2f5588bb720d421f5870e496e189fea8da49a /sound/soc/fsl/fsl_sai.c | |
parent | c5f603a927ea19c95fb6e12ecfdbf8c6620aac21 (diff) |
MLK-17528-3: ASoC: fsl_sai: Set clock rate in "set_sysclk" API
Set the requested clock rate in "set_sysclk" for specified clock id.
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Diffstat (limited to 'sound/soc/fsl/fsl_sai.c')
-rw-r--r-- | sound/soc/fsl/fsl_sai.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index d1f40636a0b9..f4b46fe69d8a 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -245,6 +245,25 @@ static int fsl_sai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, return 0; } + if (freq > 0) { + if (clk_id < 0 || clk_id >= FSL_SAI_MCLK_MAX) { + dev_err(cpu_dai->dev, "Unknown clock id: %d\n", clk_id); + return -EINVAL; + } + + if (IS_ERR_OR_NULL(sai->mclk_clk[clk_id])) { + dev_err(cpu_dai->dev, "Unassigned clock: %d\n", clk_id); + return -EINVAL; + } + + ret = clk_set_rate(sai->mclk_clk[clk_id], freq); + if (ret < 0) { + dev_err(cpu_dai->dev, "failed to set clock rate (%u): %d\n", + freq, ret); + return ret; + } + } + ret = fsl_sai_set_dai_sysclk_tr(cpu_dai, clk_id, freq, FSL_FMT_TRANSMITTER); if (ret) { |