From patchwork Mon Feb 17 23:17:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13978775 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 950901AE01C; Mon, 17 Feb 2025 23:18:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739834283; cv=none; b=BYxkVbd7uDs/B286EPqmLt7R75XJuyBXmNjUIRtGN1TTBoHdaideVnVbb4fZT4zYXyiu+xyqOQ+HrXtPKQaWV9kAPgaPT7NByLlhiGu7Iu2yrhWYvo15TodBDN81b4Hx1syJvK6Oq/iPva90PShttg/yEXZesSpsm9/v0XayYNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739834283; c=relaxed/simple; bh=euxvD6yIxhjBOEu1HF06JzVE8wLldDYNfDpJHlqO/58=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bo6O98z0GrGo/veKhCF1NzwH/JCjuTP/+BeM3JXv9x+Ict9943JmUjAy4nvHR0COCKNhTQ2XN+rWuEjOQlKSPSDQ0lVKAzBl6MHbjCF7VE2OEBZ9e2UvHM9XMklUQwpaj05k11RyYYSQ+o72VjIFX0UG6noUmgHSe49pHRZJiUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hVjsIu+Z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hVjsIu+Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1E4AC4CEE8; Mon, 17 Feb 2025 23:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739834283; bh=euxvD6yIxhjBOEu1HF06JzVE8wLldDYNfDpJHlqO/58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hVjsIu+ZThFc1+tad0AKiQVaRUAKG6+ePgdobuBw5FGsE55GBVCZJHeT43N8eERaY OEafDR7c3o9p4eT/4z4s9xdOK6APLO+t6ljLEbATgoP43Mo8CF0iAiW4F3g/qcpiR1 sT2v8OOt3G/e8wTWnlvv9fOCHxDc7lM+jjE4LZY9y9mB4NV5XNuZXbuxMPBl3Y3OoV zvgods4PpId6LAKHqEqUx5XE8gGSjXz9p5T8JVye6Wwi0oQg+21f6fHrpXrly95HXD 1tj1piKxYE9pYbva0dOClP6RPgP8F6bT5LpBJpfRt99C17LYpzJeZ3lZJBg08QqqJa 5BtTyAki+T0Zg== From: Mario Limonciello To: Yazen Ghannam , Borislav Petkov , Mark Brown Cc: Mario Limonciello , Thomas Gleixner , Dave Hansen , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), "H . Peter Anvin" , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Pierre-Louis Bossart , Vijendar Mukunda , Peter Zijlstra , Jeff Johnson , Venkata Prasad Potturu , =?utf-8?q?Uwe_Klein?= =?utf-8?q?e-K=C3=B6nig?= , Arnd Bergmann , Cristian Ciocaltea , Krzysztof Kozlowski , linux-kernel@vger.kernel.org (open list:AMD NODE DRIVER), linux-sound@vger.kernel.org (open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...), sound-open-firmware@alsa-project.org (moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS) Subject: [PATCH 1/7] x86/amd_node: Add a helper for use with `read_poll_timeout` Date: Mon, 17 Feb 2025 17:17:41 -0600 Message-ID: <20250217231747.1656228-2-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250217231747.1656228-1-superm1@kernel.org> References: <20250217231747.1656228-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Mario Limonciello Some of the ACP drivers will poll registers through SMN using `read_poll_timeout` which requires returning the result of the register read as the argument. Add a helper to do just that. Tested by: Venkata Prasad Potturu Signed-off-by: Mario Limonciello --- arch/x86/include/asm/amd_node.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/include/asm/amd_node.h b/arch/x86/include/asm/amd_node.h index 113ad3e8ee40a..9f3f613366f7d 100644 --- a/arch/x86/include/asm/amd_node.h +++ b/arch/x86/include/asm/amd_node.h @@ -33,4 +33,15 @@ static inline u16 amd_num_nodes(void) int __must_check amd_smn_read(u16 node, u32 address, u32 *value); int __must_check amd_smn_write(u16 node, u32 address, u32 value); +/* helper for use with read_poll_timeout */ +static inline int smn_read_register(u32 reg) +{ + int data, rc; + + rc = amd_smn_read(0, reg, &data); + if (rc) + return rc; + + return data; +} #endif /*_ASM_X86_AMD_NODE_H_*/