From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 2BED636A033 for ; Sun, 10 May 2026 08:44:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778402671; cv=none; b=DetJrQ9Cg+mFkMkE8HeGA+vdUpGVc2ylVVKAJ2NCcsFA41gK0NiMsRwsU09schVDMzljj/UFeUVjAMRvNSDmAQghQUQnUYvDe1xQu2vCvImeGzVKeqLcy0k+CqnKnqDpUHQNiq6/iMvfUhDSpaiW/Rw3bTnZqcYP5mIpZO7TJLU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778402671; c=relaxed/simple; bh=hWWNXcujvCRjXLBYmvogX9Tx7LSARP+jOFk6z3oIOdg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tM8R9Q+B41mndGua2KBqgT5QAXRoamGpucuugaAMXBOBZuGC8yirs6gS1HEffZQSg/oDk8A1tEbd4W9NF6k3QKPEahEUY75w5UN+XmHNiPHS/2EYExd7Cx2h+Vr7aSF4YKYaYAGNguRL6FTHdmtTUY6XecFaj8T12AnplZMdZfc= 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=U3OIGi9i; arc=none smtp.client-ip=209.85.214.170 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="U3OIGi9i" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2b9705613ddso20642785ad.1 for ; Sun, 10 May 2026 01:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778402669; x=1779007469; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hjT6LUaCKBBOaTLM4HecbTdAzAOftGZyuLAMAnfg8dY=; b=U3OIGi9iF2g714qjCK+4M4635sGX0DgtTBpM0EEJUpyI9Mcso0o7aULhDlLrZjyCg0 ieF9qbMHb4yRkpxpEG5DtvlGFbNwt6Ap8Vts5W9Tf7okMzgVkhCE0Kl2h3xPuF+1rJ1p TWqy1OGQ77NCxQX7tJnevZkA4Z0eHW0glaC9UDHbceCjiDIii9hMpsvakzrtD+GlI8nc KhUXQ+CAkUXscCzAA0fCqzhChZA9qp7z6uN9WbePxEZYu+6qh48VeAHsvBtg81DZk5SN zonkxqaq6/wBT+cMZxttBtjiegk+oRT6GtsJacYCtbqoschJY94UPlJIr9JepN9y6Loi 4/cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778402669; x=1779007469; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hjT6LUaCKBBOaTLM4HecbTdAzAOftGZyuLAMAnfg8dY=; b=OcMp0/wvZ783/7AU2VHxeYYxHm/QTVJMvmhqTAAx/Tb7B9UhrLDlHmsZBA0o2uovhu vO31WMuvsgbd4D8E1Nk6mEY43LaOHN9oyoBcKoPMwZHQww7cZbvNeMudEQR2dqDHy0fG mMmpB/HhuBaXmEI+69K3wYEwCEP7tHsnwvaBEbS7ltk0YiAfnrzjXEn0iuMMJox0g+5W gUDLOAFe4sEtfTK9M8Iz9QbOrwybux4JHuAkEMFthstsvz6F7cuhEzTFFQQ7mDCNunUP q6AZcNZElcY0B0AEUT8f0xrrcAWDfTqG5aUGRj1D8x67ChU6HpjmpHE4IY4tX6EmfOfI 2tUQ== X-Forwarded-Encrypted: i=1; AFNElJ/ulKHeZypuyk5uYxpJTswrUgekq+Ob+OOrNf+WRkjBwblLwgpQ6rAPb+UtSOJrK/lIm4Y3VkjwC9hERag=@vger.kernel.org X-Gm-Message-State: AOJu0YzVeJiP5WnWIsBA3W/oOBKGbhTe/OcXYKka2zYC+r+F3vmblYqb zoldLtr6kqTjwJ4iu8U8DkIU26PKiRJpbOGbdsRbPqZLHv+lkzextPU+ X-Gm-Gg: Acq92OGkILDiQUkndmYGV9DNiOGw7bPWGWPKqMf90YsFzcF8OS7AcqCgzGx+acZukvF gKcDoMV8PEmsn/oZuXGUQRroCBdcCO+emn+/0gsmiQSwAcjVlOhHIpX3ngLIoS/qtCXm9IBXCiF wA6Q7LvQzRX3sE+RKXej+pOUSr0TIJ/2DtMgTHvj0KjeIT2N9VUy01KWC3wNrjDXAejbZBKKR/x qP7sCQxWjr4epBvV8OeSxjdwVll4lvL4AjQZEHBjfQQHp2WPkofLEiWQcoPQvQY7Epx46DGAzRE HpTplK94djN8wtEHbxlWbDbxLf4z+Yk09miJoZdj+VyM8q5cgyYQEy8sFsUfw7Cld1N0acx1acl O3EF77Qli0erM3uCcigrhBWQY99V/VRbxvyrFgQy98+7TVDe2whKVqs7CffUtsAv092wnFaiirc meK/zBV0C/sx1ilEQEQ5rHAfX+wgdOciCtVBu/ybO/Es399FEEY4jRAl/OCw== X-Received: by 2002:a17:903:1ab0:b0:2b2:4ffc:a7c4 with SMTP id d9443c01a7336-2ba798c0a22mr174893865ad.24.1778402669575; Sun, 10 May 2026 01:44:29 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2baf1d3ffa0sm70471005ad.25.2026.05.10.01.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 May 2026 01:44:29 -0700 (PDT) From: phucduc.bui@gmail.com To: kuninori.morimoto.gx@renesas.com Cc: broonie@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org, geert+renesas@glider.be, krzk+dt@kernel.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-sound@vger.kernel.org, magnus.damm@gmail.com, perex@perex.cz, robh@kernel.org, tiwai@suse.com, bui duc phuc Subject: [PATCH v3 10/10] ASoC: renesas: fsi: Add SPU clock control in hw_startup/shutdown Date: Sun, 10 May 2026 15:43:03 +0700 Message-ID: <20260510084303.122426-11-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260510084303.122426-1-phucduc.bui@gmail.com> References: <20260510084303.122426-1-phucduc.bui@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: bui duc phuc Enable and disable the SPU clock in fsi_hw_startup() and fsi_hw_shutdown() to ensure the clock is active while the driver accesses hardware registers. Previously, the SPU clock was enabled by the bootloader and remained active during operation. However, after adding the SPU clock to the device tree, it is disabled automatically once the system initialization completes. As a result, register accesses may occur while the clock is disabled, which can lead to system hangs. Manage the SPU clock explicitly in the driver to ensure correct behavior. Suggested-by: Kuninori Morimoto Signed-off-by: bui duc phuc --- sound/soc/renesas/fsi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sound/soc/renesas/fsi.c b/sound/soc/renesas/fsi.c index c3ac8b30f342..5307085c0615 100644 --- a/sound/soc/renesas/fsi.c +++ b/sound/soc/renesas/fsi.c @@ -1579,6 +1579,19 @@ static int fsi_hw_startup(struct fsi_priv *fsi, struct device *dev) { u32 data = 0; + int ret; + + /* enable spu clock */ + if (fsi->master->clk_spu) { + scoped_guard(spinlock_irqsave, &fsi->master->lock) { + if (fsi->master->spu_count == 0) { + ret = clk_enable(fsi->master->clk_spu); + if (ret < 0) + return ret; + } + fsi->master->spu_count++; + } + } /* clock setting */ if (fsi_is_clk_master(fsi)) @@ -1636,6 +1649,12 @@ static int fsi_hw_shutdown(struct fsi_priv *fsi, /* stop master clock */ if (fsi_is_clk_master(fsi)) return fsi_clk_disable(dev, fsi); + if (fsi->master->clk_spu) { + scoped_guard(spinlock_irqsave, &fsi->master->lock) { + if (--fsi->master->spu_count == 0) + clk_disable(fsi->master->clk_spu); + } + } return 0; } -- 2.43.0