From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 208893CDBD3; Tue, 26 May 2026 08:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779785278; cv=none; b=rGVx/EaGWKlpFfVi3ga6/4mHSAscnOtKpcyM9FKH26yUvJc3z2/iugDC/tuiTitZPku98I17nDjsnyhT/kwPtSoXc0blgswQc5nAI1Y92k80LpA9pz7gHboNbl3LXUiEHRQPj5L35fQPqNtBuZcE5oUfPTFY+41+o+MKVlLT22Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779785278; c=relaxed/simple; bh=pKWJIrWwULK7MPPuh4dScm97Qn6DeLGIoD1s9Cj52J0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JgnGOvBLSUWJuof0uEymiqiz58Mwx5OUib7uCLJfTDTLUkQx4IENGDOGvaVeQei7fHKYM1RBFLCoJk1046Yxdb7anIAz7hVm5Paerw4y6ygAy0xP01K6kVD/neplppLAHF/sbwiaZ9DXqq+Oqzn/M3HdaFpkJV8WsDZSS/xQG9M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dRRyk4PP; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dRRyk4PP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0120B1F000E9; Tue, 26 May 2026 08:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779785276; bh=i5Nn6yL11taMy19yhSsiN9EMkHGwtd+/hvtzhxnGpO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dRRyk4PP4MbXw8jCvgJuAa1eETEnugdc9NMrqoTzE/TgPCgIIDZrKBvH6ShYeZlV8 IaRmGQWT+MTrAy2YziUpwsf2L7dab0FNDD7XJkUj84Iw8htDUtYBBmpXAxgnCb1Epv uKMz1v/aAJujWaxgjqZWCUTYuSNZ0YZIi+ZRQt1VXtf/iswqyq71uRWtixKKY/oF8D KmJs9aY9A3ADVMKPTAz5/739fyGu3JNcgLY6tV9bNt2pZM2mzCNPtgX3nreMfeigZg wucA4KckivxUpR6Zkv6A3EOeFSsvHReuUnJiVOnuaiYXmjBHMHwwygpvGitdIE9mlC sRi9RQmltzlJA== From: Claudiu Beznea To: vkoul@kernel.org, Frank.Li@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, p.zabel@pengutronix.de, geert+renesas@glider.be, kuninori.morimoto.gx@renesas.com, long.luu.ur@renesas.com Cc: claudiu.beznea@kernel.org, claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Claudiu Beznea , Frank Li , John Madieu Subject: [PATCH v6 07/18] dmaengine: sh: rz-dmac: Add helper to check if the channel is enabled Date: Tue, 26 May 2026 11:46:59 +0300 Message-ID: <20260526084710.3491480-8-claudiu.beznea@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260526084710.3491480-1-claudiu.beznea@kernel.org> References: <20260526084710.3491480-1-claudiu.beznea@kernel.org> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Claudiu Beznea Add the rz_dmac_chan_is_enabled() helper to check if a channel is enabled. This helper will be reused in subsequent patches. Reviewed-by: Frank Li Tested-by: John Madieu Signed-off-by: Claudiu Beznea --- Changes in v6: - updated the patch description to describe better the changes - collected tags - s/chan/channel in rz_dmac_chan_is_enabled() to follow the naming convention accross the driver for the variable of type struct rz_dmac_chan Changes in v5: - none Changes in v4: - none Changes in v3: - none, this patch is new drivers/dma/sh/rz-dmac.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index d3926ecd63ac..76bac11c217c 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -279,6 +279,13 @@ static void rz_dmac_lmdesc_recycle(struct rz_dmac_chan *channel) channel->lmdesc.head = lmdesc; } +static bool rz_dmac_chan_is_enabled(struct rz_dmac_chan *channel) +{ + u32 val = rz_dmac_ch_readl(channel, CHSTAT, 1); + + return !!(val & CHSTAT_EN); +} + static void rz_dmac_enable_hw(struct rz_dmac_chan *channel) { struct dma_chan *chan = &channel->vc.chan; @@ -840,8 +847,7 @@ static int rz_dmac_device_pause(struct dma_chan *chan) guard(spinlock_irqsave)(&channel->vc.lock); - val = rz_dmac_ch_readl(channel, CHSTAT, 1); - if (!(val & CHSTAT_EN)) + if (!rz_dmac_chan_is_enabled(channel)) return 0; rz_dmac_ch_writel(channel, CHCTRL_SETSUS, CHCTRL, 1); -- 2.43.0