ASoC: Intel: sof-rt5682: add mclk_en to sof_rt5682_private
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@linux.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/20240426152529.38345-18-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user