From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C829224234 for ; Mon, 2 Feb 2026 16:41:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770050472; cv=none; b=hDAr6yWUOQun+wMy7Rq+mxVghxUA59pvmyYwJLD84cbIXvhkrowTEFuIeq/8u2txBib8XhnHHtQhcQh5XJh4H+NCwhB6lnf1rWdL14cODX4gqwyo5nKTHOqSuA34wLp6e/KBcBA3ZsIjGW7aiF6GNDZbp21iKNFUC1yY99ysyms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770050472; c=relaxed/simple; bh=KShGaT1qgrVmzBvsExwPDJ7IJ5x4aX4qzzVujJIQm3M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lqQFReho1jku5K1j+PLAPsVQhZCdurn9L3qjDMQBqv2oMQqrGG+b8lnbsI1Rya7h0CpBV7v1ZHGRz5lkQweWGiERzdnY4pamQ3E6tAiNfgWe0AujDYKD6dzq8bfZn6pDAlUbkG+20/OnNQ0PI9VYzWXwPOQHhyehyvVD+IvqcOc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bcZmKp/x; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bcZmKp/x" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-59de38466c2so5736003e87.0 for ; Mon, 02 Feb 2026 08:41:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770050470; x=1770655270; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=wKZpya53ePP94vNtf7vtbWwSUdhjwrNT/p0Fq+u4v78=; b=bcZmKp/xQAozATxueY0J8buk23c3urSljaA63ltTIIcyOmYM6VvBoB6cHt2RXe/kNM UAYdl6AVgY+1qXUnSz2U3ZcY5lCTjxKlrNbiTHRrieRD69PKwEwr0uiGA073XW3ObrKz y1Qe9pfx3RDfNyK17mi1NIozlGhu/fF1X0GIxGp9rp4N98C73JFF+6/0O3dOShEM1Wf5 KFtdjU5NtrzT/lfFhsymGt7viooTN30f+iPjwRfFml+OZ+S7DOpaTIyrzCL+VGp3OJGi U7JmkB1wyiN7MdGifEbfs9wWIOWA+nqAEV3IhIU9m6wQntXB16BKh7KmwvQmalym7T7T GJXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770050470; x=1770655270; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wKZpya53ePP94vNtf7vtbWwSUdhjwrNT/p0Fq+u4v78=; b=u0J7i48+/rYF7PuWccQDe/Q2UoyF6gmIZQ4OQvQN/jSw5svhXqVU4b9V2+zSwry1B3 6/dgHGnWi+krK3MxM7LvS2HsAQHoDU2i7I1Z85Mny4ZjWZVit/PVrxIMeZrWgzji7pgs 33/KpPqgmxN0EC+9pGQy+JRwlBPDcK0/8RsvDVH2zdQ2NKQIyLHOvD+JmWJ8W9XqxZ4l SYnATlHUJ+pCG2ODyU0fphsg1bjSRhDP9bmgvaLZgiviQyobg7+kcEkaALMWbdYASf9n rVTARF6cbNhueJHG6fFxeS4dUtulQsthKU2jE9pvXoxgBe0vvaK+CKHVwE3eNh3jyieB oFDQ== X-Forwarded-Encrypted: i=1; AJvYcCVIa3r64SUW7GI7zZoQz86eGJeGx7v9Agch3rH8YhFOvuI24UKDYE+jA//1p9aI7PdLuB0LXC2dRePbG/8=@vger.kernel.org X-Gm-Message-State: AOJu0YwKBEpVZKFcc8TQ8jlJWjpW/ZVvKJbDgzizgFo8Quc7fzMvmLks uO4YGCMrC5ZAIdAgysekBKENWA16fzJCq3QFu1aRB99ZL2ruf28b6wKg X-Gm-Gg: AZuq6aJSVNxNY6mOvPjocPpdw02dy8YuoKBGMU9ZdEIu8pHPFJclbxj6n93f+aoFMc0 GFzGaBwsq+xhfNDC7hJLAnAbwjTkNkH8cTkb5+t6YicE/0s3D1Ta7bCT3W7hcbNpACmnzoQYd+J gJ249Y4l/mCLBTPkRBTG3/QDqb61YavVVhqjitrm68ysotFzG5z0qpSQekUWawsSb4QWe0irEFd 8nih/wjc9UqR5wtLEVOtDBKMgXJn3dNSIzAW2WDhEf4x00r9V+Iu1YjJnOiGU9GnxGovvJTuWLE xJx1blF0xrzF99uAxkMY5NER7EIx5fK/NSL5JjSlqY+r2imth23qMeXHow4Rb+djy2DOhiq2+HT NEFZ9VsMNkwyPxDT00zK2fKWC87t+2Y1uF2Hto4gdEAxJmnYlETvquN1Uzvg/dsQbGE5D0r4EBE h3RdWbgKG1++LwDbl5nqHfPAkLfgREwbnWa3+wtlfYyms+PXE4MGk3jzqAcNOQdZs17wNPiGYS4 2voXhvyBLADEnE5BDxHKQDN3IL/uD1MRDvEHD0Syv/Rq5s= X-Received: by 2002:a05:6512:3f1f:b0:595:81eb:5368 with SMTP id 2adb3069b0e04-59e1643285emr4848977e87.39.1770050469254; Mon, 02 Feb 2026 08:41:09 -0800 (PST) Received: from ?IPV6:2001:999:700:7c7d:ca87:d71e:154f:6316? (n7ka2o5f47ode54rg9i-1.v6.elisa-mobile.fi. [2001:999:700:7c7d:ca87:d71e:154f:6316]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-59e074889fasm3676714e87.30.2026.02.02.08.41.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Feb 2026 08:41:08 -0800 (PST) Message-ID: Date: Mon, 2 Feb 2026 18:42:20 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/4] ASoC: ti: davinci-mcasp: Disambiguate mcasp_is_synchronous function To: Sen Wang , broonie@kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260130051045.1898892-1-sen@ti.com> <20260130051045.1898892-3-sen@ti.com> From: =?UTF-8?Q?P=C3=A9ter_Ujfalusi?= Content-Language: en-US In-Reply-To: <20260130051045.1898892-3-sen@ti.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 30/01/2026 07:10, Sen Wang wrote: > The current mcasp_is_synchronous() function does more than what it > proclaims, it also checks if McASP is a frame producer. True, the naming was not too precise. It is tasked to decide if the TX clock needs to be enabled for RX operation, which precisely when McASP is in synchronous mode _and_ it is clock provider. > Therefore split the original function into two separate ones and > replace all occurrences with the new equivalent logic. So the functions > can be re-used when checking async/sync status in light of async mode > enhancements. Acked-by: Peter Ujfalusi > > Signed-off-by: Sen Wang > --- > sound/soc/ti/davinci-mcasp.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c > index 621a9d5f9377..aa14fc1c8011 100644 > --- a/sound/soc/ti/davinci-mcasp.c > +++ b/sound/soc/ti/davinci-mcasp.c > @@ -179,10 +179,16 @@ static void mcasp_set_ctl_reg(struct davinci_mcasp *mcasp, u32 ctl_reg, u32 val) > > static bool mcasp_is_synchronous(struct davinci_mcasp *mcasp) > { > - u32 rxfmctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_RXFMCTL_REG); > u32 aclkxctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_ACLKXCTL_REG); > > - return !(aclkxctl & TX_ASYNC) && rxfmctl & AFSRE; > + return !(aclkxctl & TX_ASYNC); > +} > + > +static bool mcasp_is_frame_producer(struct davinci_mcasp *mcasp) > +{ > + u32 rxfmctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_RXFMCTL_REG); > + > + return rxfmctl & AFSRE; > } > > static inline void mcasp_set_clk_pdir(struct davinci_mcasp *mcasp, bool enable) > @@ -226,7 +232,7 @@ static void mcasp_start_rx(struct davinci_mcasp *mcasp) > * synchronously from the transmit clock and frame sync. We need to make > * sure that the TX signlas are enabled when starting reception. > */ > - if (mcasp_is_synchronous(mcasp)) { > + if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp)) { > mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXHCLKRST); > mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXCLKRST); > mcasp_set_clk_pdir(mcasp, true); > @@ -239,7 +245,7 @@ static void mcasp_start_rx(struct davinci_mcasp *mcasp) > mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLR_REG, RXSMRST); > /* Release Frame Sync generator */ > mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLR_REG, RXFSRST); > - if (mcasp_is_synchronous(mcasp)) > + if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp)) > mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXFSRST); > > /* enable receive IRQs */ > @@ -305,7 +311,7 @@ static void mcasp_stop_rx(struct davinci_mcasp *mcasp) > * In synchronous mode stop the TX clocks if no other stream is > * running > */ > - if (mcasp_is_synchronous(mcasp) && !mcasp->streams) { > + if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp) && !mcasp->streams) { > mcasp_set_clk_pdir(mcasp, false); > mcasp_set_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, 0); > } > @@ -332,7 +338,7 @@ static void mcasp_stop_tx(struct davinci_mcasp *mcasp) > * In synchronous mode keep TX clocks running if the capture stream is > * still running. > */ > - if (mcasp_is_synchronous(mcasp) && mcasp->streams) > + if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp) && mcasp->streams) > val = TXHCLKRST | TXCLKRST | TXFSRST; > else > mcasp_set_clk_pdir(mcasp, false); > @@ -1041,7 +1047,8 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream, > * not running already we need to configure the TX slots in > * order to have correct FSX on the bus > */ > - if (mcasp_is_synchronous(mcasp) && !mcasp->channels) > + if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp) && > + !mcasp->channels) > mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, > FSXMOD(total_slots), FSXMOD(0x1FF)); > } -- Péter