From patchwork Fri Apr 26 15:25:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 792397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09FE1C4345F for ; Fri, 26 Apr 2024 15:30:44 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1DAE6218E; Fri, 26 Apr 2024 17:30:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1DAE6218E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1714145443; bh=8xb9CTljEsAsammvjDjYTYN3LOKkRjHFFUmPijaKb2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=WzBIamu0dKPch0W99WtMMB7MppspsB5qZ6X2YolJOq/RzyygZiTdm5O2h3lONgC01 By5P3bDr/+dXBevf8ThWEDyXRZWYn6mAY91roAwyAWew6RE2yr1SzfKGsduvWt2BZw GbVobWyYBy2mcIX7vZ2ekjcSAvwbYLcxdyaSubNM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C77BAF80608; Fri, 26 Apr 2024 17:26:46 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1B880F802E8; Fri, 26 Apr 2024 17:26:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A8D82F80696; Fri, 26 Apr 2024 17:26:11 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 495C2F805EB for ; Fri, 26 Apr 2024 17:25:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 495C2F805EB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=mbfb7Jzc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714145154; x=1745681154; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8xb9CTljEsAsammvjDjYTYN3LOKkRjHFFUmPijaKb2w=; b=mbfb7JzchT6Zx4y3KDA8AKfCosN2XPFnKkY6b9a/vo0wl5fK0NfmUGkJ /fUohn4gxFuIyUxfHDY/kUjHVQGhsOtuWayGhYhZN3FoHiF1Q4+/nkI6j /IMWZULpZCGclZfPZNtzFWVvcl1rDCgNlnTYX37OEqdfDLIlR+zkdVFBv SsZOzGcN48A2fxbUO6MjVzC9K4lGjQmeVIzs59GYndhRtwAxrETrJr1OV 6HveBo+2M5f5uJE55Q58SfL+xFBmrqSvDusKpO7cT5Yr3y9QpBv1gL5ye SymvXumg/E3vHpOFLTCg4E73MwIz0pYKi/j6LYolngyme7plJPTEI3BzD A==; X-CSE-ConnectionGUID: CpNSYfmPQS+b2v80XxfByg== X-CSE-MsgGUID: dtWWX0tXTy+95Y/h9Ad/8w== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21291348" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21291348" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:25:50 -0700 X-CSE-ConnectionGUID: ydVepSTTRdKbktrdkQFcbg== X-CSE-MsgGUID: Ph6QY0G4Sl+hIZeL177Nmg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259598" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:25:49 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Brent Lu , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 17/23] ASoC: Intel: sof-rt5682: add mclk_en to sof_rt5682_private Date: Fri, 26 Apr 2024 10:25:23 -0500 Message-Id: <20240426152529.38345-18-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152529.38345-1-pierre-louis.bossart@linux.intel.com> References: <20240426152529.38345-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: P4PKGSWIRI5EA4CB6RGNWBENXNS3MVZK X-Message-ID-Hash: P4PKGSWIRI5EA4CB6RGNWBENXNS3MVZK X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Brent Lu Add a variable mclk_en to sof_rt5682_private structure to reduce global variable access. No functional change. Reviewed-by: Bard Liao Signed-off-by: Brent Lu Signed-off-by: Pierre-Louis Bossart --- 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");