Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Sen Wang <sen@ti.com>
To: <peter.ujfalusi@gmail.com>, <broonie@kernel.org>,
	<lgirdwood@gmail.com>, <perex@perex.cz>, <tiwai@suse.com>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <devarsht@ti.com>, <r-donadkar@ti.com>, <s-jain1@ti.com>,
	<m-shah@ti.com>, Sen Wang <sen@ti.com>
Subject: [PATCH 1/2] ASoC: ti: davinci-mcasp: extract mcasp_is_auxclk_enabled() helper
Date: Thu, 5 Mar 2026 13:58:24 -0600	[thread overview]
Message-ID: <20260305195825.9998-2-sen@ti.com> (raw)
In-Reply-To: <20260305195825.9998-1-sen@ti.com>

Move the AUXCLK-enabled check out of davinci_mcasp_calc_clk_div() into
a reusable helper.  No functional change.

Signed-off-by: Sen Wang <sen@ti.com>
---
 sound/soc/ti/davinci-mcasp.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 2d260fbc9b83..6d0310f09b12 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -274,6 +274,14 @@ static inline unsigned int mcasp_get_auxclk_fs_ratio(struct davinci_mcasp *mcasp
 	       mcasp->auxclk_fs_ratio_tx : mcasp->auxclk_fs_ratio_rx;
 }
 
+static inline bool mcasp_is_auxclk_enabled(struct davinci_mcasp *mcasp, int stream)
+{
+	if (mcasp->async_mode && stream == SNDRV_PCM_STREAM_CAPTURE)
+		return mcasp_get_reg(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG) & AHCLKRE;
+
+	return mcasp_get_reg(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG) & AHCLKXE;
+}
+
 static void mcasp_start_rx(struct davinci_mcasp *mcasp)
 {
 	if (mcasp->rxnumevt) {	/* enable FIFO */
@@ -1337,16 +1345,15 @@ static int davinci_mcasp_calc_clk_div(struct davinci_mcasp *mcasp,
 	int bclk_div_id, auxclk_div_id;
 	bool auxclk_enabled;
 
+	auxclk_enabled = mcasp_is_auxclk_enabled(mcasp, stream);
+
 	if (mcasp->async_mode && stream == SNDRV_PCM_STREAM_CAPTURE) {
-		auxclk_enabled = mcasp_get_reg(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG) & AHCLKRE;
 		bclk_div_id = MCASP_CLKDIV_BCLK_RXONLY;
 		auxclk_div_id = MCASP_CLKDIV_AUXCLK_RXONLY;
 	} else if (mcasp->async_mode && stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		auxclk_enabled = mcasp_get_reg(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG) & AHCLKXE;
 		bclk_div_id = MCASP_CLKDIV_BCLK_TXONLY;
 		auxclk_div_id = MCASP_CLKDIV_AUXCLK_TXONLY;
 	} else {
-		auxclk_enabled = mcasp_get_reg(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG) & AHCLKXE;
 		bclk_div_id = MCASP_CLKDIV_BCLK;
 		auxclk_div_id = MCASP_CLKDIV_AUXCLK;
 	}
-- 
2.43.0


  reply	other threads:[~2026-03-05 19:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 19:58 [PATCH 0/2] ASoC: ti: davinci-mcasp: McASP code cleanup and clk div fixes Sen Wang
2026-03-05 19:58 ` Sen Wang [this message]
2026-03-05 19:58 ` [PATCH 2/2] ASoC: ti: davinci-mcasp: improve aux_div selection for mid-range dividers Sen Wang
2026-03-10 15:53 ` [PATCH 0/2] ASoC: ti: davinci-mcasp: McASP code cleanup and clk div fixes Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260305195825.9998-2-sen@ti.com \
    --to=sen@ti.com \
    --cc=broonie@kernel.org \
    --cc=devarsht@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=m-shah@ti.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@gmail.com \
    --cc=r-donadkar@ti.com \
    --cc=s-jain1@ti.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox