From: Brent Lu <brent.lu@xxxxxxxxx>
Add a variable mclk_en to sof_rt5682_private structure to reduce
global variable access. No functional change.
Reviewed-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
Signed-off-by: Brent Lu <brent.lu@xxxxxxxxx>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
---
sound/soc/intel/boards/sof_board_helpers.h | 2 ++
sound/soc/intel/boards/sof_rt5682.c | 7 +++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/sound/soc/intel/boards/sof_board_helpers.h b/sound/soc/intel/boards/sof_board_helpers.h
index 644f6b4a1b7b..dfcc2c5c25cc 100644
--- a/sound/soc/intel/boards/sof_board_helpers.h
+++ b/sound/soc/intel/boards/sof_board_helpers.h
@@ -101,10 +101,12 @@ struct sof_da7219_private {
*
* @mclk: mclk clock data
* @is_legacy_cpu: true for BYT/CHT boards
+ * @mclk_en: true for mclk pin is connected
*/
struct sof_rt5682_private {
struct clk *mclk;
bool is_legacy_cpu;
+ bool mclk_en;
};
/*
diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index efca7604040e..654c2428f625 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -165,7 +165,7 @@ static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
int extra_jack_data;
int ret, mclk_freq;
- if (sof_rt5682_quirk & SOF_RT5682_MCLK_EN) {
+ if (ctx->rt5682.mclk_en) {
mclk_freq = sof_dai_get_mclk(rtd);
if (mclk_freq <= 0) {
dev_err(rtd->dev, "invalid mclk freq %d\n", mclk_freq);
@@ -278,7 +278,7 @@ static int sof_rt5682_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
int pll_id, pll_source, pll_in, pll_out, clk_id, ret;
- if (sof_rt5682_quirk & SOF_RT5682_MCLK_EN) {
+ if (ctx->rt5682.mclk_en) {
if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) {
ret = clk_prepare_enable(ctx->rt5682.mclk);
if (ret < 0) {
@@ -728,6 +728,9 @@ static int sof_audio_probe(struct platform_device *pdev)
}
}
+ if (sof_rt5682_quirk & SOF_RT5682_MCLK_EN)
+ ctx->rt5682.mclk_en = true;
+
/* need to get main clock from pmc */
if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) {
ctx->rt5682.mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
--
2.40.1
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]