From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3057BC6FD1D for ; Thu, 23 Mar 2023 05:30:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229917AbjCWF36 (ORCPT ); Thu, 23 Mar 2023 01:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbjCWF3x (ORCPT ); Thu, 23 Mar 2023 01:29:53 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4361E20050 for ; Wed, 22 Mar 2023 22:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549393; x=1711085393; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jSG2veXKUxcXyV1zpGUhKNlxMdGkTNUGl0TfqUCdrR0=; b=nBme8f7xb3aJdQdLHuZgKrfnYVrdNcJFQ9TlMVY6E9hTT2N0EGtOZSOx acrZhMuIQ+HTjkrzZxkbIyQ+SC6edvPE31UQSLym/DZFv8uyHT6i2MzjW t+5AGPlgT1WPqKvIBiSN7NV8cdyAD1Cppdwrx+b7ImskRGOPfZ9LjFhGj Xs2R7eoxomi8YI6R16wk7lsAD3AbrnWcknfLz31XOhpvrwFQdXz/j2JdG Ubzm4qDmxGTWvwOjbQFyaMx/O21yvBBwyrk/hHmCOQPdpPGU5Ncbyzhkq gVHoD+m7VzCqNDHfjKuM3MUTp67033mGp0D9iGccSiVRiDYxOjbBr2651 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779279" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779279" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:29:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675566986" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675566986" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:29:50 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 01/20] ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake Date: Thu, 23 Mar 2023 13:44:33 +0800 Message-Id: <20230323054452.1543233-2-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Add the new enum needed for SoundWire IP selection. The LunarLake PCI descriptors and DSP parts will be added at a later time. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Acked-by: Mark Brown --- sound/soc/sof/intel/shim.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/intel/shim.h b/sound/soc/sof/intel/shim.h index 48428ccbcfe0..207df48e27cf 100644 --- a/sound/soc/sof/intel/shim.h +++ b/sound/soc/sof/intel/shim.h @@ -21,6 +21,7 @@ enum sof_intel_hw_ip_version { SOF_INTEL_CAVS_2_0, /* IceLake, JasperLake */ SOF_INTEL_CAVS_2_5, /* TigerLake, AlderLake */ SOF_INTEL_ACE_1_0, /* MeteorLake */ + SOF_INTEL_ACE_2_0, /* LunarLake */ }; =20 /* --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 462C0C6FD1C for ; Thu, 23 Mar 2023 05:30:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbjCWFap (ORCPT ); Thu, 23 Mar 2023 01:30:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbjCWFad (ORCPT ); Thu, 23 Mar 2023 01:30:33 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37A9821952 for ; Wed, 22 Mar 2023 22:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549415; x=1711085415; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yZvrzQd70YjHlJlmhsCqEtarCH/SM9v+ndjTDzenB98=; b=ip5WctNaZ6yniPU5HRt5p+BCkDwq2LlRSXZQGvsbfT90Ge1Pob0dm2w/ mjUbhjVoH55bQzKLy8kNRg27pRADrDYNyBrZ1pdrxcXwWqoHdAf29+B9I sVvY4U0TwrIjw0dc6y2gmbjFEtZ0pnHleFawUQmDups9xim2pxsnjjn9Q 6PjNQcdDDJ9FARBifShbClMttfIS9RHKRx4wLG22ucDn9sDaYIAUANKY7 DWDYL5ab9LrOSC9rfQlWfojairJidAbaJ2qKCP21oElkz8Zggypcr97oF XgU03U0V+nCGqiFJ5+p07DnesLZzo5bQsZbfs2Oldz2Ob7gkW6nsIEkIj w==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779287" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779287" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:29:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675566989" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675566989" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:29:53 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 02/20] soundwire: intel: add ACE2.x SHIM definitions Date: Thu, 23 Mar 2023 13:44:34 +0800 Message-Id: <20230323054452.1543233-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart With the HDaudio extended link integration, the SHIM and IP registers are split in blocks a) SHIM generic registers b) IP registers (same offsets for Cadence IP as before) c) SHIM vendor-specific registers Add offsets and definitions as defined in the hardware specifications. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- include/linux/soundwire/sdw_intel.h | 75 +++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index 207701aeeb47..8e6183e029fa 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -7,6 +7,10 @@ #include #include =20 +/********************************************************************* + * cAVS and ACE1.x definitions + *********************************************************************/ + #define SDW_SHIM_BASE 0x2C000 #define SDW_ALH_BASE 0x2C800 #define SDW_SHIM_BASE_ACE 0x38000 @@ -101,6 +105,77 @@ #define SDW_ALH_STRMZCFG_DMAT GENMASK(7, 0) #define SDW_ALH_STRMZCFG_CHN GENMASK(19, 16) =20 +/********************************************************************* + * ACE2.x definitions for SHIM registers - only accessible when the + * HDAudio extended link LCTL.SPA/CPA =3D 1. + *********************************************************************/ +/* x variable is link index */ +#define SDW_SHIM2_GENERIC_BASE(x) (0x00030000 + 0x8000 * (x)) +#define SDW_IP_BASE(x) (0x00030100 + 0x8000 * (x)) +#define SDW_SHIM2_VS_BASE(x) (0x00036000 + 0x8000 * (x)) + +/* SHIM2 Generic Registers */ +/* Read-only capabilities */ +#define SDW_SHIM2_LECAP 0x00 +#define SDW_SHIM2_LECAP_HDS BIT(0) /* unset -> Host mode */ +#define SDW_SHIM2_LECAP_MLC GENMASK(3, 1) /* Number of Lanes */ + +/* PCM Stream capabilities */ +#define SDW_SHIM2_PCMSCAP 0x10 +#define SDW_SHIM2_PCMSCAP_ISS GENMASK(3, 0) /* Input-only streams */ +#define SDW_SHIM2_PCMSCAP_OSS GENMASK(7, 4) /* Output-only streams */ +#define SDW_SHIM2_PCMSCAP_BSS GENMASK(12, 8) /* Bidirectional streams */ + +/* Read-only PCM Stream Channel Count, y variable is stream */ +#define SDW_SHIM2_PCMSYCHC(y) (0x14 + (0x4 * (y))) +#define SDW_SHIM2_PCMSYCHC_CS GENMASK(3, 0) /* Channels Supported */ + +/* PCM Stream Channel Map */ +#define SDW_SHIM2_PCMSYCHM(y) (0x16 + (0x4 * (y))) +#define SDW_SHIM2_PCMSYCHM_LCHAN GENMASK(3, 0) /* Lowest channel used by t= he FIFO port */ +#define SDW_SHIM2_PCMSYCHM_HCHAN GENMASK(7, 4) /* Lowest channel used by t= he FIFO port */ +#define SDW_SHIM2_PCMSYCHM_STRM GENMASK(13, 8) /* HDaudio stream tag */ +#define SDW_SHIM2_PCMSYCHM_DIR BIT(15) /* HDaudio stream direction */ + +/* SHIM2 vendor-specific registers */ +#define SDW_SHIM2_INTEL_VS_LVSCTL 0x04 +#define SDW_SHIM2_INTEL_VS_LVSCTL_FCG BIT(26) +#define SDW_SHIM2_INTEL_VS_LVSCTL_MLCS GENMASK(29, 27) +#define SDW_SHIM2_INTEL_VS_LVSCTL_DCGD BIT(30) +#define SDW_SHIM2_INTEL_VS_LVSCTL_ICGD BIT(31) + +#define SDW_SHIM2_MLCS_XTAL_CLK 0x0 +#define SDW_SHIM2_MLCS_CARDINAL_CLK 0x1 +#define SDW_SHIM2_MLCS_AUDIO_PLL_CLK 0x2 +#define SDW_SHIM2_MLCS_MCLK_INPUT_CLK 0x3 +#define SDW_SHIM2_MLCS_WOV_RING_OSC_CLK 0x4 + +#define SDW_SHIM2_INTEL_VS_WAKEEN 0x08 +#define SDW_SHIM2_INTEL_VS_WAKEEN_PWE BIT(0) + +#define SDW_SHIM2_INTEL_VS_WAKESTS 0x0A +#define SDW_SHIM2_INTEL_VS_WAKEEN_PWS BIT(0) + +#define SDW_SHIM2_INTEL_VS_IOCTL 0x0C +#define SDW_SHIM2_INTEL_VS_IOCTL_MIF BIT(0) +#define SDW_SHIM2_INTEL_VS_IOCTL_CO BIT(1) +#define SDW_SHIM2_INTEL_VS_IOCTL_COE BIT(2) +#define SDW_SHIM2_INTEL_VS_IOCTL_DO BIT(3) +#define SDW_SHIM2_INTEL_VS_IOCTL_DOE BIT(4) +#define SDW_SHIM2_INTEL_VS_IOCTL_BKE BIT(5) +#define SDW_SHIM2_INTEL_VS_IOCTL_WPDD BIT(6) +#define SDW_SHIM2_INTEL_VS_IOCTL_ODC BIT(7) +#define SDW_SHIM2_INTEL_VS_IOCTL_CIBD BIT(8) +#define SDW_SHIM2_INTEL_VS_IOCTL_DIBD BIT(9) +#define SDW_SHIM2_INTEL_VS_IOCTL_HAMIFD BIT(10) + +#define SDW_SHIM2_INTEL_VS_ACTMCTL 0x0E +#define SDW_SHIM2_INTEL_VS_ACTMCTL_DACTQE BIT(0) +#define SDW_SHIM2_INTEL_VS_ACTMCTL_DODS BIT(1) +#define SDW_SHIM2_INTEL_VS_ACTMCTL_DODSE BIT(2) +#define SDW_SHIM2_INTEL_VS_ACTMCTL_DOAIS GENMASK(4, 3) +#define SDW_SHIM2_INTEL_VS_ACTMCTL_DOAISE BIT(5) + /** * struct sdw_intel_stream_params_data: configuration passed during * the @params_stream callback, e.g. for interaction with DSP --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96FCCC6FD1C for ; Thu, 23 Mar 2023 05:30:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbjCWFau (ORCPT ); Thu, 23 Mar 2023 01:30:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbjCWFag (ORCPT ); Thu, 23 Mar 2023 01:30:36 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 538F12211B for ; Wed, 22 Mar 2023 22:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549417; x=1711085417; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QfbLjJIQPJg7lVSuxR7cbrpfZiSh+vhV76tbkAhqcic=; b=SRy8m4PnMQEK2DDZm2PqgXuaQOU5QDBGmlXNj+E0+Uf9hyKmfZV4wsRN TCyBj603elTq48KKGwS5pIqHdU5uQeqhuHRvIkp67NXtsWTO+KbdkrS40 VEbNi0ImdV7U3M4EhTeFJbnJ9+syX6N+O/EFCp3quv8yV2T5nV7Heau6X 0ndEyi/ve6Vuq6A72ZpLGPeGbLfM/h5BhZ5livPLXRE1A89BsekO0Zs8X etoi9NZ5M2NspReiMrjXEfLkiKNqbkWxRnxwwyDelFwTUVnmSKHQVvzIv kitxk3HUyH9ZSj0uOVxJ2BnrOJo2n+mcWchTG0fIYMHTcnA/VflIIT/T0 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779297" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779297" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:29:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675566992" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675566992" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:29:55 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 03/20] soundwire: intel_ace2x: add empty new ops for LunarLake Date: Thu, 23 Mar 2023 13:44:35 +0800 Message-Id: <20230323054452.1543233-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart The register map and programming sequences for the ACE2.x IP are completely different and need to be abstracted with a different set of callbacks. This initial patch adds a new file, follow-up patches will add each required callback. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/Makefile | 2 +- drivers/soundwire/intel_ace2x.c | 19 +++++++++++++++++++ include/linux/soundwire/sdw_intel.h | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 drivers/soundwire/intel_ace2x.c diff --git a/drivers/soundwire/Makefile b/drivers/soundwire/Makefile index 8038e840ac5b..d7212777a927 100644 --- a/drivers/soundwire/Makefile +++ b/drivers/soundwire/Makefile @@ -20,7 +20,7 @@ soundwire-cadence-y :=3D cadence_master.o obj-$(CONFIG_SOUNDWIRE_CADENCE) +=3D soundwire-cadence.o =20 #Intel driver -soundwire-intel-y :=3D intel.o intel_auxdevice.o intel_init.o dmi-quirks.o= \ +soundwire-intel-y :=3D intel.o intel_ace2x.o intel_auxdevice.o intel_init= .o dmi-quirks.o \ intel_bus_common.o obj-$(CONFIG_SOUNDWIRE_INTEL) +=3D soundwire-intel.o =20 diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c new file mode 100644 index 000000000000..623e4fd7db91 --- /dev/null +++ b/drivers/soundwire/intel_ace2x.c @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// Copyright(c) 2023 Intel Corporation. All rights reserved. + +/* + * Soundwire Intel ops for LunarLake + */ + +#include +#include +#include +#include +#include +#include "cadence_master.h" +#include "bus.h" +#include "intel.h" + +const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { +}; +EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL); diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index 8e6183e029fa..66687e83a94f 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -419,5 +419,6 @@ struct sdw_intel_hw_ops { }; =20 extern const struct sdw_intel_hw_ops sdw_intel_cnl_hw_ops; +extern const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops; =20 #endif --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 755B9C76196 for ; Thu, 23 Mar 2023 05:30:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230367AbjCWFaz (ORCPT ); Thu, 23 Mar 2023 01:30:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230282AbjCWFah (ORCPT ); Thu, 23 Mar 2023 01:30:37 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3116B222F8 for ; Wed, 22 Mar 2023 22:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549419; x=1711085419; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PSkxVbe47xbUsq7avOoYR8upNoWBv4uK3aM/asFJSEA=; b=TJH7MxmDgLy9N7rxTVfE6M+uszLK5LYTlsBPnH8sTYGXTJHPaXz2At8f yrUeijr4hBfnouts/YI3Po9w7sUW7ip/OrsdVLTEDbcU8q7YJSA4Rv+ow mL9ka/LNaMFFA8MJDA+bT+L0JWBJvx/JPuejJakfI9qTDfIbLm5ilhMR2 c0sFLz7kKjs9HCDyon+aP7+GtFOlwUnTzzhbJoqRca/G2phuQWW4ub2wx hh6iKH8617FX/HoC4MmV4MrW5FOxe2PX9XoHIx7R6HbcPB2lq9yqvDbpS 10L/mb4uZwoJ/xcU3yFLpoac0YOab0qBbMGewRoqzBB+UbnoOo/kGQv8k Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779308" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779308" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675566998" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675566998" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:29:58 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 04/20] soundwire/ASOC: Intel: update offsets for LunarLake Date: Thu, 23 Mar 2023 13:44:36 +0800 Message-Id: <20230323054452.1543233-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart The previous settings are not applicable, use a flag to determine what the register layout is. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Acked-by: Mark Brown --- drivers/soundwire/intel.h | 2 ++ drivers/soundwire/intel_init.c | 14 ++++++++++---- include/linux/soundwire/sdw_intel.h | 2 ++ sound/soc/sof/intel/hda.c | 21 +++++++++++++++++---- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h index 09d479f2c77b..51aa42a5a824 100644 --- a/drivers/soundwire/intel.h +++ b/drivers/soundwire/intel.h @@ -11,6 +11,7 @@ * @mmio_base: mmio base of SoundWire registers * @registers: Link IO registers base * @shim: Audio shim pointer + * @shim_vs: Audio vendor-specific shim pointer * @alh: ALH (Audio Link Hub) pointer * @irq: Interrupt line * @ops: Shim callback ops @@ -28,6 +29,7 @@ struct sdw_intel_link_res { void __iomem *mmio_base; /* not strictly needed, useful for debug */ void __iomem *registers; void __iomem *shim; + void __iomem *shim_vs; void __iomem *alh; int irq; const struct sdw_intel_ops *ops; diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index cbe56b993c6c..e0023af9e0e1 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -63,10 +63,16 @@ static struct sdw_intel_link_dev *intel_link_dev_regist= er(struct sdw_intel_res * link =3D &ldev->link_res; link->hw_ops =3D res->hw_ops; link->mmio_base =3D res->mmio_base; - link->registers =3D res->mmio_base + SDW_LINK_BASE - + (SDW_LINK_SIZE * link_id); - link->shim =3D res->mmio_base + res->shim_base; - link->alh =3D res->mmio_base + res->alh_base; + if (!res->ext) { + link->registers =3D res->mmio_base + SDW_LINK_BASE + + (SDW_LINK_SIZE * link_id); + link->shim =3D res->mmio_base + res->shim_base; + link->alh =3D res->mmio_base + res->alh_base; + } else { + link->registers =3D res->mmio_base + SDW_IP_BASE(link_id); + link->shim =3D res->mmio_base + SDW_SHIM2_GENERIC_BASE(link_id); + link->shim_vs =3D res->mmio_base + SDW_SHIM2_VS_BASE(link_id); + } =20 link->ops =3D res->ops; link->dev =3D res->dev; diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index 66687e83a94f..88eb5bf98140 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -323,6 +323,7 @@ struct sdw_intel_ctx { * DSP driver. The quirks are common for all links for now. * @shim_base: sdw shim base. * @alh_base: sdw alh base. + * @ext: extended HDaudio link support */ struct sdw_intel_res { const struct sdw_intel_hw_ops *hw_ops; @@ -337,6 +338,7 @@ struct sdw_intel_res { u32 clock_stop_quirks; u32 shim_base; u32 alh_base; + bool ext; }; =20 /* diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 81c697e20108..db103524be4f 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -198,6 +198,7 @@ static int hda_sdw_acpi_scan(struct snd_sof_dev *sdev) =20 static int hda_sdw_probe(struct snd_sof_dev *sdev) { + const struct sof_intel_dsp_desc *chip; struct sof_intel_hda_dev *hdev; struct sdw_intel_res res; void *sdw; @@ -206,10 +207,22 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev) =20 memset(&res, 0, sizeof(res)); =20 - res.hw_ops =3D &sdw_intel_cnl_hw_ops; - res.mmio_base =3D sdev->bar[HDA_DSP_BAR]; - res.shim_base =3D hdev->desc->sdw_shim_base; - res.alh_base =3D hdev->desc->sdw_alh_base; + chip =3D get_chip_info(sdev->pdata); + if (chip->hw_ip_version < SOF_INTEL_ACE_2_0) { + res.mmio_base =3D sdev->bar[HDA_DSP_BAR]; + res.hw_ops =3D &sdw_intel_cnl_hw_ops; + res.shim_base =3D hdev->desc->sdw_shim_base; + res.alh_base =3D hdev->desc->sdw_alh_base; + res.ext =3D false; + } else { + res.mmio_base =3D sdev->bar[HDA_DSP_HDA_BAR]; + /* + * the SHIM and SoundWire register offsets are link-specific + * and will be determined when adding auxiliary devices + */ + res.hw_ops =3D &sdw_intel_lnl_hw_ops; + res.ext =3D true; + } res.irq =3D sdev->ipc_irq; res.handle =3D hdev->info.handle; res.parent =3D sdev->dev; --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87A29C6FD1C for ; Thu, 23 Mar 2023 05:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230323AbjCWFbD (ORCPT ); Thu, 23 Mar 2023 01:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229945AbjCWFas (ORCPT ); Thu, 23 Mar 2023 01:30:48 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA70F1F5F6 for ; Wed, 22 Mar 2023 22:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549433; x=1711085433; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+/puymD/Mrlt+6NzEm6hJ2HiO/2wdXeQEMmwt5RGD7o=; b=eHHtpKfT84MXE09OpuNB3HOIxy7VtUM+rv/RU/GzXkH9GgdFtka+JWBb j5saCuQ5Hgt+MugjY9tovrmkzzrFIdai/l+6xGse9+dvYgH/IdCJ9kc+y izknRQIwC//+HqssWidyH9mgNEHBeITVA+HV7xyShDe4Ery3MCagGPdqu 6cYNa0FKktt8xPjQ80/OTTehAxPiDTfd/SzQ9aifgabr6tnmB+poB1se7 4M3Yo1GJ4Le0Lwtgg/9kbfrvjI5V2lEZNhiblMj2owJ+ZuM8m8BPMzIxH PZm0TzkJ+btYobsw27KTa89E7rnEPNNcLjshYW1+q364X3PWq/LNRprJ7 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779320" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779320" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567014" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567014" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:00 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 05/20] soundwire: intel/cadence: set ip_offset at run-time Date: Thu, 23 Mar 2023 13:44:37 +0800 Message-Id: <20230323054452.1543233-6-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Select relevant ip-offset depending on hardware version. This offset is used to access MCP_ or IP_MCP_ registers with a fixed offset. For existing platforms, the offset is exactly zero. Starting with LunarLake, the offset is 0x4000. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/cadence_master.h | 2 ++ drivers/soundwire/intel.h | 2 ++ drivers/soundwire/intel_auxdevice.c | 1 + drivers/soundwire/intel_init.c | 2 ++ 4 files changed, 7 insertions(+) diff --git a/drivers/soundwire/cadence_master.h b/drivers/soundwire/cadence= _master.h index b653734085d9..b0f0bf90640b 100644 --- a/drivers/soundwire/cadence_master.h +++ b/drivers/soundwire/cadence_master.h @@ -14,6 +14,8 @@ */ #define CDNS_MCP_IP_MAX_CMD_LEN 32 =20 +#define SDW_CADENCE_MCP_IP_OFFSET 0x4000 + /** * struct sdw_cdns_pdi: PDI (Physical Data Interface) instance * diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h index 51aa42a5a824..1b23292bb8be 100644 --- a/drivers/soundwire/intel.h +++ b/drivers/soundwire/intel.h @@ -10,6 +10,7 @@ * @hw_ops: platform-specific ops * @mmio_base: mmio base of SoundWire registers * @registers: Link IO registers base + * @ip_offset: offset for MCP_IP registers * @shim: Audio shim pointer * @shim_vs: Audio vendor-specific shim pointer * @alh: ALH (Audio Link Hub) pointer @@ -28,6 +29,7 @@ struct sdw_intel_link_res { =20 void __iomem *mmio_base; /* not strictly needed, useful for debug */ void __iomem *registers; + u32 ip_offset; void __iomem *shim; void __iomem *shim_vs; void __iomem *alh; diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_= auxdevice.c index 5021be0f4158..b02cef4f4b66 100644 --- a/drivers/soundwire/intel_auxdevice.c +++ b/drivers/soundwire/intel_auxdevice.c @@ -144,6 +144,7 @@ static int intel_link_probe(struct auxiliary_device *au= xdev, sdw->link_res =3D &ldev->link_res; cdns->dev =3D dev; cdns->registers =3D sdw->link_res->registers; + cdns->ip_offset =3D sdw->link_res->ip_offset; cdns->instance =3D sdw->instance; cdns->msg_count =3D 0; =20 diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index e0023af9e0e1..43d339c6bcee 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -66,10 +66,12 @@ static struct sdw_intel_link_dev *intel_link_dev_regist= er(struct sdw_intel_res * if (!res->ext) { link->registers =3D res->mmio_base + SDW_LINK_BASE + (SDW_LINK_SIZE * link_id); + link->ip_offset =3D 0; link->shim =3D res->mmio_base + res->shim_base; link->alh =3D res->mmio_base + res->alh_base; } else { link->registers =3D res->mmio_base + SDW_IP_BASE(link_id); + link->ip_offset =3D SDW_CADENCE_MCP_IP_OFFSET; link->shim =3D res->mmio_base + SDW_SHIM2_GENERIC_BASE(link_id); link->shim_vs =3D res->mmio_base + SDW_SHIM2_VS_BASE(link_id); } --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31109C6FD1D for ; Thu, 23 Mar 2023 05:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230419AbjCWFbG (ORCPT ); Thu, 23 Mar 2023 01:31:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbjCWFat (ORCPT ); Thu, 23 Mar 2023 01:30:49 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 911C620A11 for ; Wed, 22 Mar 2023 22:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549436; x=1711085436; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yWd/ohEBxlz+ikb3Ien04/YoMLYTHRZPHh64E+lRlNo=; b=mq6DzXdhUIrNEC/ox9ZeggoD4KKN60+8KXPNa/f5Gfhmhnh6Oh2W3+Yk bgrVlUwU6wP72xzcbabAiYSx2NsVTwuWVP4wMdSUzsGV0uwTGh3S5Yt1G NxQipK7rOd1YSvXBIWUIUY2gzQZR2paeDVPTTwpjS1CUJVScqT6Bxjiwn o8+5gWrhdrsUai2x7Xa4Sre12FxWH65BIyr+7E2G5I52monNrRaisJqZ/ 1jYlZWDjHyVLdJJtjy/RsxrMeQCCVytkiFjn622gzJlyCBwDhsGlV3iLX 1cov93almavCTHwVK8OFNx+L/Cu/gYbzSO5W0Z+mlmkzsZUfu2RC0X+r8 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779334" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779334" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567025" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567025" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:03 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 06/20] ASoC/soundwire: intel: pass hdac_bus pointer for link management Date: Thu, 23 Mar 2023 13:44:38 +0800 Message-Id: <20230323054452.1543233-7-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart The hdac_bus pointer is used to access the extended link information and handle power management. Pass it from the SOF driver down to the auxiliary devices. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Acked-by: Mark Brown --- drivers/soundwire/intel.h | 4 ++++ drivers/soundwire/intel_init.c | 2 ++ include/linux/soundwire/sdw_intel.h | 4 ++++ sound/soc/sof/intel/hda.c | 1 + 4 files changed, 11 insertions(+) diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h index 1b23292bb8be..cf9db4906de4 100644 --- a/drivers/soundwire/intel.h +++ b/drivers/soundwire/intel.h @@ -4,6 +4,8 @@ #ifndef __SDW_INTEL_LOCAL_H #define __SDW_INTEL_LOCAL_H =20 +struct hdac_bus; + /** * struct sdw_intel_link_res - Soundwire Intel link resource structure, * typically populated by the controller driver. @@ -23,6 +25,7 @@ * @link_mask: global mask needed for power-up/down sequences * @cdns: Cadence master descriptor * @list: used to walk-through all masters exposed by the same controller + * @hbus: hdac_bus pointer, needed for power management */ struct sdw_intel_link_res { const struct sdw_intel_hw_ops *hw_ops; @@ -42,6 +45,7 @@ struct sdw_intel_link_res { u32 link_mask; struct sdw_cdns *cdns; struct list_head list; + struct hdac_bus *hbus; }; =20 struct sdw_intel { diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index 43d339c6bcee..c918d2b81cc3 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -84,6 +84,8 @@ static struct sdw_intel_link_dev *intel_link_dev_register= (struct sdw_intel_res * link->shim_mask =3D &ctx->shim_mask; link->link_mask =3D ctx->link_mask; =20 + link->hbus =3D res->hbus; + /* now follow the two-step init/add sequence */ ret =3D auxiliary_device_init(auxdev); if (ret < 0) { diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index 88eb5bf98140..c4281aa06e2e 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -269,6 +269,8 @@ struct sdw_intel_slave_id { struct sdw_slave_id id; }; =20 +struct hdac_bus; + /** * struct sdw_intel_ctx - context allocated by the controller * driver probe @@ -324,6 +326,7 @@ struct sdw_intel_ctx { * @shim_base: sdw shim base. * @alh_base: sdw alh base. * @ext: extended HDaudio link support + * @hbus: hdac_bus pointer, needed for power management */ struct sdw_intel_res { const struct sdw_intel_hw_ops *hw_ops; @@ -339,6 +342,7 @@ struct sdw_intel_res { u32 shim_base; u32 alh_base; bool ext; + struct hdac_bus *hbus; }; =20 /* diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index db103524be4f..22eba57bb3e6 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -229,6 +229,7 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev) res.ops =3D &sdw_callback; res.dev =3D sdev->dev; res.clock_stop_quirks =3D sdw_clock_stop_quirks; + res.hbus =3D sof_to_bus(sdev); =20 /* * ops and arg fields are not populated for now, --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65F84C6FD1C for ; Thu, 23 Mar 2023 05:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbjCWFbK (ORCPT ); Thu, 23 Mar 2023 01:31:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230294AbjCWFat (ORCPT ); Thu, 23 Mar 2023 01:30:49 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 214A520D04 for ; Wed, 22 Mar 2023 22:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549437; x=1711085437; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xKsOmGgpfRTaoYi/C0Rex9lD4JYFMvLzVqkjtEvqo9k=; b=fe/uTfUezvkcNRFqw+G61L1hrEw/ZoGFcKh+V7ldpZPaY3OqqCIoW0js +gIruqpJTD2VcVXjNJSjWQ6eak265wLCIwzv7qzKtTlO+bNLrGEsdai5l CoDsCrEoJStvCsTNggAajj7Ua/168SjXPrNELTTVHxQrtDNpNDCcEUcje r9vtszwD8p6pujz5OccUaydn3CDKbHp/xMK6/ssT0ZK5idIr2NFu4abbL S9/NTft7LzIXys3cbfbdj1qatiSmRZnn5juRgGuw8ycA+TmaeEbzYiANA HGPBOFNqZUgi1mFtYTxBltuyX6Ore5n/1LTqfco+bCfH/Zf8egUu4QVoJ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779351" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779351" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567039" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567039" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:05 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 07/20] soundwire: intel: add eml_lock in the interface for new platforms Date: Thu, 23 Mar 2023 13:44:39 +0800 Message-Id: <20230323054452.1543233-8-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart In existing Intel/SoundWire systems, all the SoundWire configuration is 'self-contained', with the 'shim_lock' mutex used to protect access to shared registers in multi-link configurations. With the move of part of the SoundWire registers to the HDaudio multi-link structure, we need a unified lock. The hda-mlink implementation provides an 'eml_lock' that is used to protect shared registers such as LCTL and LSYNC, we can pass it to the SoundWire side. There is no issue with possible dangling pointers since the SoundWire auxiliary devices are children of the PCI device, so the 'eml_lock' cannot be removed while the SoundWire side is in use. This patch only adds the interface for now. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- include/linux/soundwire/sdw_intel.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index c4281aa06e2e..bafc6f2554b0 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -327,6 +327,8 @@ struct sdw_intel_ctx { * @alh_base: sdw alh base. * @ext: extended HDaudio link support * @hbus: hdac_bus pointer, needed for power management + * @eml_lock: mutex protecting shared registers in the HDaudio multi-link + * space */ struct sdw_intel_res { const struct sdw_intel_hw_ops *hw_ops; @@ -343,6 +345,7 @@ struct sdw_intel_res { u32 alh_base; bool ext; struct hdac_bus *hbus; + struct mutex *eml_lock; }; =20 /* --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B65CC6FD1D for ; Thu, 23 Mar 2023 05:31:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230387AbjCWFbS (ORCPT ); Thu, 23 Mar 2023 01:31:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230374AbjCWFaz (ORCPT ); Thu, 23 Mar 2023 01:30:55 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFF1D22119 for ; Wed, 22 Mar 2023 22:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549448; x=1711085448; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TZ+6Ux/vWHTp7+2fBxz2s/j5BxjCv70QKxkw1tIhFkw=; b=GHsjtBTOxfMgiFv8Yf0JjqlDtNlK4smNm1ct+KsC38fJe0Rv9mcUF8eT 8qQsV8U9S83HqHqswh29bZPzPrmkdXBEaEMcMCz6La4J/ueT6lvF/gMCe +DJQXRRrMoqgjKT8q4x0eoi6Do3SikrRi5l3TY0qtMyXhgUtd6bfOWw1j hvLSTIJVnjWY3JN8i9ugu7hrOrIq6nhGnBwWzqoVt9ARfBZIA6dyvv9gl GptjFWg1e/hR2Bkl6Fm8uN3rpslnTfOZ/X5pNooaGlOirwJDt9RLBKFdi FSYPPlo4b1K5v/cfRJsHQe22MscKHT8alckOmB6VC4bYr1qmt1Xyesszr A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779370" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779370" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567055" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567055" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:08 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 08/20] ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer Date: Thu, 23 Mar 2023 13:44:40 +0800 Message-Id: <20230323054452.1543233-9-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Use new helper and interface to make sure the HDaudio and SoundWire parts use the same mutex when accessing shared registers. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Acked-by: Mark Brown --- sound/soc/sof/intel/hda.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 22eba57bb3e6..f8cd5a9ebad1 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -215,6 +215,15 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev) res.alh_base =3D hdev->desc->sdw_alh_base; res.ext =3D false; } else { + /* + * retrieve eml_lock needed to protect shared registers + * in the HDaudio multi-link areas + */ + res.eml_lock =3D hdac_bus_eml_get_mutex(sof_to_bus(sdev), true, + AZX_REG_ML_LEPTR_ID_SDW); + if (!res.eml_lock) + return -ENODEV; + res.mmio_base =3D sdev->bar[HDA_DSP_HDA_BAR]; /* * the SHIM and SoundWire register offsets are link-specific --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 066A2C76196 for ; Thu, 23 Mar 2023 05:31:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230396AbjCWFbV (ORCPT ); Thu, 23 Mar 2023 01:31:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbjCWFaz (ORCPT ); Thu, 23 Mar 2023 01:30:55 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DB4D22113 for ; Wed, 22 Mar 2023 22:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549450; x=1711085450; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dypjg8PFg6rfCWgJzAX1z/pRx6Y007Vaip829IVJOYA=; b=TZkcS3iwz0QtE1UXsmvdETBnMn9O9224P2UCSI74RqyU57TsrLRQq8u3 FztCS4JjeZH9pX/YPxBAV7vWIMvU6eZFG/vdsLGPtPruhwnQqlyQZtEAM EM7K6xDMciJ5JsJbVLeertTDMjQ2PX/Bj1eEBfQ9weN5ULFZgp4l0p2LE aa/vtL2od1xXlXgrD2rfCvmpVVqWOP9EjWCZaZMobZEGQ5ME0ocIipgPy Nr7hFk7vC/8nvv7ixBLBx1hyAViScOadI130fsArCbkyApXj5jVxm8wfK SYkam1mfdWQqeCWW4kOVYCNI32mTGQYOdhmOZ0Bm0JA/rxUaaN4hab7PG Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779384" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779384" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567073" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567073" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:10 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 09/20] soundwire: intel_init: use eml_lock parameter Date: Thu, 23 Mar 2023 13:44:41 +0800 Message-Id: <20230323054452.1543233-10-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Now that the ASoC/SOF/HDAudio parts has retrieved the mutex and set the parameter, we can use it to share the same synchronization across the two domains. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index c918d2b81cc3..534c8795e7e8 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -69,18 +69,19 @@ static struct sdw_intel_link_dev *intel_link_dev_regist= er(struct sdw_intel_res * link->ip_offset =3D 0; link->shim =3D res->mmio_base + res->shim_base; link->alh =3D res->mmio_base + res->alh_base; + link->shim_lock =3D &ctx->shim_lock; } else { link->registers =3D res->mmio_base + SDW_IP_BASE(link_id); link->ip_offset =3D SDW_CADENCE_MCP_IP_OFFSET; link->shim =3D res->mmio_base + SDW_SHIM2_GENERIC_BASE(link_id); link->shim_vs =3D res->mmio_base + SDW_SHIM2_VS_BASE(link_id); + link->shim_lock =3D res->eml_lock; } =20 link->ops =3D res->ops; link->dev =3D res->dev; =20 link->clock_stop_quirks =3D res->clock_stop_quirks; - link->shim_lock =3D &ctx->shim_lock; link->shim_mask =3D &ctx->shim_mask; link->link_mask =3D ctx->link_mask; =20 --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D61CC6FD1D for ; Thu, 23 Mar 2023 05:31:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230463AbjCWFbY (ORCPT ); Thu, 23 Mar 2023 01:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230378AbjCWFa4 (ORCPT ); Thu, 23 Mar 2023 01:30:56 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DC042211B for ; Wed, 22 Mar 2023 22:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549450; x=1711085450; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i8UIQbcY1RfdSYTZStIqpYEudpa7eTQXB2/ovkpVbLI=; b=gOL2dY5fTa11N6fjpp/N4dUM4uz5QgpdIOZS4+gSdEGdDL/PV5egT32H lBrKxmslsPSxupiaAginn1pPf4MAPaCLhKm2Jk/z4UWHoHqmh4czP881S Kut0wPAcS/JKZrjGUhXodqZQwaOeNmCZezoJhibY+QkDzeIy18pg7u8g2 Vtye7tqBYyjnyL7gejfK6oDwh4aAx9OwhqK91A9C5h26MSR9A28yk/LVF AiTFuJLOoxJ7JlO1vJNkTOyaGp0dPK2VgYWI8VKLZuzbLiN8xgVSCBJ9B /GyeToS/PMotQMCcTKP7b5MTjSi1fKr6x+6zpZtcc9tIF9w0DrqlxNKUh w==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779398" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779398" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567094" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567094" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:13 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 10/20] soundwire: intel_ace2x: add debugfs support Date: Thu, 23 Mar 2023 13:44:42 +0800 Message-Id: <20230323054452.1543233-11-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Add access to registers in SHIM and SHIM_VS (vendor-specific) areas. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/Makefile | 3 +- drivers/soundwire/intel.h | 8 ++ drivers/soundwire/intel_ace2x.c | 2 + drivers/soundwire/intel_ace2x_debugfs.c | 147 ++++++++++++++++++++++++ 4 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 drivers/soundwire/intel_ace2x_debugfs.c diff --git a/drivers/soundwire/Makefile b/drivers/soundwire/Makefile index d7212777a927..c57571c82e04 100644 --- a/drivers/soundwire/Makefile +++ b/drivers/soundwire/Makefile @@ -20,7 +20,8 @@ soundwire-cadence-y :=3D cadence_master.o obj-$(CONFIG_SOUNDWIRE_CADENCE) +=3D soundwire-cadence.o =20 #Intel driver -soundwire-intel-y :=3D intel.o intel_ace2x.o intel_auxdevice.o intel_init= .o dmi-quirks.o \ +soundwire-intel-y :=3D intel.o intel_ace2x.o intel_ace2x_debugfs.o \ + intel_auxdevice.o intel_init.o dmi-quirks.o \ intel_bus_common.o obj-$(CONFIG_SOUNDWIRE_INTEL) +=3D soundwire-intel.o =20 diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h index cf9db4906de4..511932c55216 100644 --- a/drivers/soundwire/intel.h +++ b/drivers/soundwire/intel.h @@ -95,6 +95,14 @@ static inline void intel_writew(void __iomem *base, int = offset, u16 value) (sdw)->link_res->hw_ops->cb) #define SDW_INTEL_OPS(sdw, cb) ((sdw)->link_res->hw_ops->cb) =20 +#ifdef CONFIG_DEBUG_FS +void intel_ace2x_debugfs_init(struct sdw_intel *sdw); +void intel_ace2x_debugfs_exit(struct sdw_intel *sdw); +#else +static inline void intel_ace2x_debugfs_init(struct sdw_intel *sdw) {} +static inline void intel_ace2x_debugfs_exit(struct sdw_intel *sdw) {} +#endif + static inline void sdw_intel_debugfs_init(struct sdw_intel *sdw) { if (SDW_INTEL_CHECK_OPS(sdw, debugfs_init)) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 623e4fd7db91..1c47bb2adb93 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -15,5 +15,7 @@ #include "intel.h" =20 const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { + .debugfs_init =3D intel_ace2x_debugfs_init, + .debugfs_exit =3D intel_ace2x_debugfs_exit, }; EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL); diff --git a/drivers/soundwire/intel_ace2x_debugfs.c b/drivers/soundwire/in= tel_ace2x_debugfs.c new file mode 100644 index 000000000000..3d24661ffd37 --- /dev/null +++ b/drivers/soundwire/intel_ace2x_debugfs.c @@ -0,0 +1,147 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright(c) 2023 Intel Corporation. All rights reserved. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "bus.h" +#include "cadence_master.h" +#include "intel.h" + +/* + * debugfs + */ +#ifdef CONFIG_DEBUG_FS + +#define RD_BUF (2 * PAGE_SIZE) + +static ssize_t intel_sprintf(void __iomem *mem, bool l, + char *buf, size_t pos, unsigned int reg) +{ + int value; + + if (l) + value =3D intel_readl(mem, reg); + else + value =3D intel_readw(mem, reg); + + return scnprintf(buf + pos, RD_BUF - pos, "%4x\t%4x\n", reg, value); +} + +static int intel_reg_show(struct seq_file *s_file, void *data) +{ + struct sdw_intel *sdw =3D s_file->private; + void __iomem *s =3D sdw->link_res->shim; + void __iomem *vs_s =3D sdw->link_res->shim_vs; + ssize_t ret; + u32 pcm_cap; + int pcm_bd; + char *buf; + int j; + + buf =3D kzalloc(RD_BUF, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ret =3D scnprintf(buf, RD_BUF, "Register Value\n"); + ret +=3D scnprintf(buf + ret, RD_BUF - ret, "\nShim\n"); + + ret +=3D intel_sprintf(s, true, buf, ret, SDW_SHIM2_LECAP); + ret +=3D intel_sprintf(s, false, buf, ret, SDW_SHIM2_PCMSCAP); + + pcm_cap =3D intel_readw(s, SDW_SHIM2_PCMSCAP); + pcm_bd =3D FIELD_GET(SDW_SHIM2_PCMSCAP_BSS, pcm_cap); + + for (j =3D 0; j < pcm_bd; j++) { + ret +=3D intel_sprintf(s, false, buf, ret, + SDW_SHIM2_PCMSYCHM(j)); + ret +=3D intel_sprintf(s, false, buf, ret, + SDW_SHIM2_PCMSYCHC(j)); + } + + ret +=3D scnprintf(buf + ret, RD_BUF - ret, "\nVS CLK controls\n"); + ret +=3D intel_sprintf(vs_s, true, buf, ret, SDW_SHIM2_INTEL_VS_LVSCTL); + + ret +=3D scnprintf(buf + ret, RD_BUF - ret, "\nVS Wake registers\n"); + ret +=3D intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_WAKEEN); + ret +=3D intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_WAKESTS); + + ret +=3D scnprintf(buf + ret, RD_BUF - ret, "\nVS IOCTL, ACTMCTL\n"); + ret +=3D intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_IOCTL); + ret +=3D intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_ACTMCTL); + + seq_printf(s_file, "%s", buf); + kfree(buf); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(intel_reg); + +static int intel_set_m_datamode(void *data, u64 value) +{ + struct sdw_intel *sdw =3D data; + struct sdw_bus *bus =3D &sdw->cdns.bus; + + if (value > SDW_PORT_DATA_MODE_STATIC_1) + return -EINVAL; + + /* Userspace changed the hardware state behind the kernel's back */ + add_taint(TAINT_USER, LOCKDEP_STILL_OK); + + bus->params.m_data_mode =3D value; + + return 0; +} +DEFINE_DEBUGFS_ATTRIBUTE(intel_set_m_datamode_fops, NULL, + intel_set_m_datamode, "%llu\n"); + +static int intel_set_s_datamode(void *data, u64 value) +{ + struct sdw_intel *sdw =3D data; + struct sdw_bus *bus =3D &sdw->cdns.bus; + + if (value > SDW_PORT_DATA_MODE_STATIC_1) + return -EINVAL; + + /* Userspace changed the hardware state behind the kernel's back */ + add_taint(TAINT_USER, LOCKDEP_STILL_OK); + + bus->params.s_data_mode =3D value; + + return 0; +} +DEFINE_DEBUGFS_ATTRIBUTE(intel_set_s_datamode_fops, NULL, + intel_set_s_datamode, "%llu\n"); + +void intel_ace2x_debugfs_init(struct sdw_intel *sdw) +{ + struct dentry *root =3D sdw->cdns.bus.debugfs; + + if (!root) + return; + + sdw->debugfs =3D debugfs_create_dir("intel-sdw", root); + + debugfs_create_file("intel-registers", 0400, sdw->debugfs, sdw, + &intel_reg_fops); + + debugfs_create_file("intel-m-datamode", 0200, sdw->debugfs, sdw, + &intel_set_m_datamode_fops); + + debugfs_create_file("intel-s-datamode", 0200, sdw->debugfs, sdw, + &intel_set_s_datamode_fops); + + sdw_cdns_debugfs_init(&sdw->cdns, sdw->debugfs); +} + +void intel_ace2x_debugfs_exit(struct sdw_intel *sdw) +{ + debugfs_remove_recursive(sdw->debugfs); +} +#endif /* CONFIG_DEBUG_FS */ --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F989C6FD1C for ; Thu, 23 Mar 2023 05:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbjCWFbc (ORCPT ); Thu, 23 Mar 2023 01:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbjCWFbD (ORCPT ); Thu, 23 Mar 2023 01:31:03 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B2492D151 for ; Wed, 22 Mar 2023 22:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549454; x=1711085454; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zfPDFAUHD0yEFTAl6FmNYsvKI40bPenFTeUs36GSzIY=; b=ahm0ncEEFKg/f2Cm3I46zkUeVUyq7gh0yzGrkJgELws71us6SAGazhJx b51L36b55YKh+Et3syTGAKs/sVQfdzxNopDXGM66FpJnVzjMCZs9NE4H6 2Z5DvufYxa2NzC8OTsFoU+tGHZcduLMf54XAdsz51JFIKEvYtoYWlYhHG vX0lRRheqqbXZ7M2KeTs7oEehyLhntdqPpM3leRj/xlTIC/jWrAZFaTUc kIWb4TOxIECnAAQwaeauO5QPqGYeNPMlYx46hqzM62m8PKvg/hAUYijiT mzlLobryrRn5j2WW8It8h8emihh1wOroqgyUtvxQgA8XHGvJ1oRiCLY56 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779408" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779408" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567117" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567117" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:16 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 11/20] soundwire: intel_ace2x: add link power-up/down helpers Date: Thu, 23 Mar 2023 13:44:43 +0800 Message-Id: <20230323054452.1543233-12-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart only power-up/down for now, the frequency is not set. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 1c47bb2adb93..5b6a608e63ba 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -10,12 +10,62 @@ #include #include #include +#include #include "cadence_master.h" #include "bus.h" #include "intel.h" =20 +static int intel_link_power_up(struct sdw_intel *sdw) +{ + int ret; + + mutex_lock(sdw->link_res->shim_lock); + + ret =3D hdac_bus_eml_sdw_power_up_unlocked(sdw->link_res->hbus, sdw->inst= ance); + if (ret < 0) { + dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_up failed: %d\n", + __func__, ret); + goto out; + } + + sdw->cdns.link_up =3D true; +out: + mutex_unlock(sdw->link_res->shim_lock); + + return ret; +} + +static int intel_link_power_down(struct sdw_intel *sdw) +{ + int ret; + + mutex_lock(sdw->link_res->shim_lock); + + sdw->cdns.link_up =3D false; + + ret =3D hdac_bus_eml_sdw_power_down_unlocked(sdw->link_res->hbus, sdw->in= stance); + if (ret < 0) { + dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_down failed: %d\n", + __func__, ret); + + /* + * we leave the sdw->cdns.link_up flag as false since we've disabled + * the link at this point and cannot handle interrupts any longer. + */ + } + + mutex_unlock(sdw->link_res->shim_lock); + + return ret; +} + const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .debugfs_init =3D intel_ace2x_debugfs_init, .debugfs_exit =3D intel_ace2x_debugfs_exit, + + .link_power_up =3D intel_link_power_up, + .link_power_down =3D intel_link_power_down, }; EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL); + +MODULE_IMPORT_NS(SND_SOC_SOF_HDA_MLINK); --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC1B5C76196 for ; Thu, 23 Mar 2023 05:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbjCWFbg (ORCPT ); Thu, 23 Mar 2023 01:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230331AbjCWFbF (ORCPT ); Thu, 23 Mar 2023 01:31:05 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18BC022797 for ; Wed, 22 Mar 2023 22:30:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549456; x=1711085456; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aNL2KliVK/W0PGGaQa+13McnVurhskx2OOU+yOO7uSY=; b=ALhUWyojgqzHzE6KZpUEEJgv2r6amjn/APoDkMzpbwHmI2Ev+5f0wGkL GrQ1EeYTsQGiaArk4Se0fDL4P7Xwjp/rABdqYaK6BXjU1Wbgrdlyykfkp BWTijKAFWhhrYc2t8gRwFsp2l3fZDVW4skpvsWXy3bqJ2EnB7YFhRHtA7 XGuGkkRdKRZfXeXpi4ig3/KeLpEr6D1oD8ySB+b8SGQSc3LSZR/y+MisP N+ZC8dkWQB2HegBJfn0Z8cKqLCY+hgwE5r/Wi1kY8pKx67rlYxUhZX5zi St3A+hK6xOt5xJSdroWfcHVUU9UN60TM6J0WWh8WpM441bU3OfwRVwosE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779422" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779422" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567132" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567132" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:18 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 12/20] soundwire: intel_ace2x: set SYNCPRD before powering-up Date: Thu, 23 Mar 2023 13:44:44 +0800 Message-Id: <20230323054452.1543233-13-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart The registers used for multi-link synchronization are no longer in the SHIM but in the HDaudio multi-link capability space. Use helpers to configure the SYNCPRD value, and wait for SYNCPU to change after powering-up. Note that the SYNCPRD value is shared between all sublinks, for obvious reasons if those links are supposed to be synchronized. The value of SYNCPRD is programmed only once for all sublinks. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 42 +++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 5b6a608e63ba..01668246b7ba 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -17,17 +17,51 @@ =20 static int intel_link_power_up(struct sdw_intel *sdw) { + struct sdw_bus *bus =3D &sdw->cdns.bus; + struct sdw_master_prop *prop =3D &bus->prop; + u32 *shim_mask =3D sdw->link_res->shim_mask; + unsigned int link_id =3D sdw->instance; + u32 syncprd; int ret; =20 mutex_lock(sdw->link_res->shim_lock); =20 - ret =3D hdac_bus_eml_sdw_power_up_unlocked(sdw->link_res->hbus, sdw->inst= ance); + if (!*shim_mask) { + /* we first need to program the SyncPRD/CPU registers */ + dev_dbg(sdw->cdns.dev, "first link up, programming SYNCPRD\n"); + + if (prop->mclk_freq % 6000000) + syncprd =3D SDW_SHIM_SYNC_SYNCPRD_VAL_38_4; + else + syncprd =3D SDW_SHIM_SYNC_SYNCPRD_VAL_24; + + ret =3D hdac_bus_eml_sdw_set_syncprd_unlocked(sdw->link_res->hbus, sync= prd); + if (ret < 0) { + dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_set_syncprd failed: %d\n", + __func__, ret); + goto out; + } + } + + ret =3D hdac_bus_eml_sdw_power_up_unlocked(sdw->link_res->hbus, link_id); if (ret < 0) { dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_up failed: %d\n", __func__, ret); goto out; } =20 + if (!*shim_mask) { + /* SYNCPU will change once link is active */ + ret =3D hdac_bus_eml_sdw_wait_syncpu_unlocked(sdw->link_res->hbus); + if (ret < 0) { + dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_wait_syncpu failed: %d\n", + __func__, ret); + goto out; + } + } + + *shim_mask |=3D BIT(link_id); + sdw->cdns.link_up =3D true; out: mutex_unlock(sdw->link_res->shim_lock); @@ -37,13 +71,17 @@ static int intel_link_power_up(struct sdw_intel *sdw) =20 static int intel_link_power_down(struct sdw_intel *sdw) { + u32 *shim_mask =3D sdw->link_res->shim_mask; + unsigned int link_id =3D sdw->instance; int ret; =20 mutex_lock(sdw->link_res->shim_lock); =20 sdw->cdns.link_up =3D false; =20 - ret =3D hdac_bus_eml_sdw_power_down_unlocked(sdw->link_res->hbus, sdw->in= stance); + *shim_mask &=3D ~BIT(link_id); + + ret =3D hdac_bus_eml_sdw_power_down_unlocked(sdw->link_res->hbus, link_id= ); if (ret < 0) { dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_down failed: %d\n", __func__, ret); --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79A38C6FD1C for ; Thu, 23 Mar 2023 05:31:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbjCWFbp (ORCPT ); Thu, 23 Mar 2023 01:31:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbjCWFbI (ORCPT ); Thu, 23 Mar 2023 01:31:08 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 226F12FCDD for ; Wed, 22 Mar 2023 22:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549457; x=1711085457; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kjKTx32w9YdnZJ7K83qEoOALY8hrbkCtcZcfoAY0U2Q=; b=k9obHCSBJGVTlbzQTWH+z6BQ9SfmfuOtE7sODlUer8Z2DdgGMWg+VXJg ijJUK2D9n9CUNiQ1590qmuHTnvDZe84z6VHMdNUfbaeNHDRg/NWIEAHTL sQmWtF2F2iGskjt4UICebzY/lmfrQox80bK1e5rUGbs2xtrTFYBLNZ4yt VSy8Kvm2Rlq0luPLR9cdFBdl049Ns43TVXw0+da8lerU+Bjdh/5dphQzs D4zJ0Q33UyEltxEAPBvpb53EhsKImkoJIvvAJ1ylCOMzcnbBDD/pVjIsk dECT0NtYGPJ5zb0locTRtTiC/78FQ7mPF7qpa5mECQHZtFGLO8q4ukmp4 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779434" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779434" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567149" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567149" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:21 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 13/20] soundwire: intel_ace2x: configure link PHY Date: Thu, 23 Mar 2023 13:44:45 +0800 Message-Id: <20230323054452.1543233-14-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Unlike previous hardware generations, the glue-to-master transition is not managed by software, instead the transitions are managed as part of the power-up/down sequences controlled by SPA/CPA bits. The only thing that's required is to configure the link PHY for 'normal' operation instead of the PHY test mode. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 01668246b7ba..5deff32976f1 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -15,6 +15,22 @@ #include "bus.h" #include "intel.h" =20 +/* + * shim vendor-specific (vs) ops + */ + +static void intel_shim_vs_init(struct sdw_intel *sdw) +{ + void __iomem *shim_vs =3D sdw->link_res->shim_vs; + u16 act =3D 0; + + u16p_replace_bits(&act, 0x1, SDW_SHIM2_INTEL_VS_ACTMCTL_DOAIS); + act |=3D SDW_SHIM2_INTEL_VS_ACTMCTL_DACTQE; + act |=3D SDW_SHIM2_INTEL_VS_ACTMCTL_DODS; + intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_ACTMCTL, act); + usleep_range(10, 15); +} + static int intel_link_power_up(struct sdw_intel *sdw) { struct sdw_bus *bus =3D &sdw->cdns.bus; @@ -63,6 +79,9 @@ static int intel_link_power_up(struct sdw_intel *sdw) *shim_mask |=3D BIT(link_id); =20 sdw->cdns.link_up =3D true; + + intel_shim_vs_init(sdw); + out: mutex_unlock(sdw->link_res->shim_lock); =20 --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A576C6FD1D for ; Thu, 23 Mar 2023 05:32:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230493AbjCWFcB (ORCPT ); Thu, 23 Mar 2023 01:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230305AbjCWFb3 (ORCPT ); Thu, 23 Mar 2023 01:31:29 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5334120A06 for ; Wed, 22 Mar 2023 22:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549464; x=1711085464; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+NUsvy+Y8PVO2h/Op18ecWWhry3F8Mgpf7FkeQTkvn0=; b=n2FDgvrV1iebTHYlgP0QE1dFADl6Kj7V1Z9FnO+kMuF/bCtpPy5B/yhN VBfLAH80EBLZyKtJiptnyjr3V1SrTdMWaKS40O5HWZM4MEU3uOLbZGaJd y0X4pf+J+wPAH9zOyKLuAAebQ8BkUDotAni4fNn84eP0WdjQo3N785DAv kkM/6fvwBdKibK5BLGcREjsTVBq1jY6wlnxuPfzpFbhj7S36+xpeZZKsi WfQV7D04gurF/RcTGoNFNAiahSWvhaViH7nCK9ZHE3pznstkHbf7bUAyG AzRbBsMBCBzZJDYDTchugk0/ovsy+enTAbbMKbMcO0psEAMCrB5kj9KPF Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779448" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779448" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567177" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567177" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:23 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 14/20] soundwire: intel_ace2x: add DAI registration Date: Thu, 23 Mar 2023 13:44:46 +0800 Message-Id: <20230323054452.1543233-15-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart The code is similar to the previous implementation, the only difference is that the PDI descriptors are now in different areas. Using common helpers proves tricky with multiple changed registers, workarounds that are no longer necessary. It's simpler to duplicate the intel_register_dai() function rather than try to add multiple levels of abstraction and indirections. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 161 ++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 5deff32976f1..d6d5e6e070f4 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -116,10 +116,171 @@ static int intel_link_power_down(struct sdw_intel *s= dw) return ret; } =20 +/* + * DAI operations + */ +static const struct snd_soc_dai_ops intel_pcm_dai_ops =3D { +}; + +static const struct snd_soc_component_driver dai_component =3D { + .name =3D "soundwire", +}; + +/* + * PDI routines + */ +static void intel_pdi_init(struct sdw_intel *sdw, + struct sdw_cdns_stream_config *config) +{ + void __iomem *shim =3D sdw->link_res->shim; + int pcm_cap; + + /* PCM Stream Capability */ + pcm_cap =3D intel_readw(shim, SDW_SHIM2_PCMSCAP); + + config->pcm_bd =3D FIELD_GET(SDW_SHIM2_PCMSCAP_BSS, pcm_cap); + config->pcm_in =3D FIELD_GET(SDW_SHIM2_PCMSCAP_ISS, pcm_cap); + config->pcm_out =3D FIELD_GET(SDW_SHIM2_PCMSCAP_ISS, pcm_cap); + + dev_dbg(sdw->cdns.dev, "PCM cap bd:%d in:%d out:%d\n", + config->pcm_bd, config->pcm_in, config->pcm_out); +} + +static int +intel_pdi_get_ch_cap(struct sdw_intel *sdw, unsigned int pdi_num) +{ + void __iomem *shim =3D sdw->link_res->shim; + + /* zero based values for channel count in register */ + return intel_readw(shim, SDW_SHIM2_PCMSYCHC(pdi_num)) + 1; +} + +static void intel_pdi_get_ch_update(struct sdw_intel *sdw, + struct sdw_cdns_pdi *pdi, + unsigned int num_pdi, + unsigned int *num_ch) +{ + int ch_count =3D 0; + int i; + + for (i =3D 0; i < num_pdi; i++) { + pdi->ch_count =3D intel_pdi_get_ch_cap(sdw, pdi->num); + ch_count +=3D pdi->ch_count; + pdi++; + } + + *num_ch =3D ch_count; +} + +static void intel_pdi_stream_ch_update(struct sdw_intel *sdw, + struct sdw_cdns_streams *stream) +{ + intel_pdi_get_ch_update(sdw, stream->bd, stream->num_bd, + &stream->num_ch_bd); + + intel_pdi_get_ch_update(sdw, stream->in, stream->num_in, + &stream->num_ch_in); + + intel_pdi_get_ch_update(sdw, stream->out, stream->num_out, + &stream->num_ch_out); +} + +static int intel_create_dai(struct sdw_cdns *cdns, + struct snd_soc_dai_driver *dais, + enum intel_pdi_type type, + u32 num, u32 off, u32 max_ch) +{ + int i; + + if (!num) + return 0; + + for (i =3D off; i < (off + num); i++) { + dais[i].name =3D devm_kasprintf(cdns->dev, GFP_KERNEL, + "SDW%d Pin%d", + cdns->instance, i); + if (!dais[i].name) + return -ENOMEM; + + if (type =3D=3D INTEL_PDI_BD || type =3D=3D INTEL_PDI_OUT) { + dais[i].playback.channels_min =3D 1; + dais[i].playback.channels_max =3D max_ch; + } + + if (type =3D=3D INTEL_PDI_BD || type =3D=3D INTEL_PDI_IN) { + dais[i].capture.channels_min =3D 1; + dais[i].capture.channels_max =3D max_ch; + } + + dais[i].ops =3D &intel_pcm_dai_ops; + } + + return 0; +} + +static int intel_register_dai(struct sdw_intel *sdw) +{ + struct sdw_cdns_dai_runtime **dai_runtime_array; + struct sdw_cdns_stream_config config; + struct sdw_cdns *cdns =3D &sdw->cdns; + struct sdw_cdns_streams *stream; + struct snd_soc_dai_driver *dais; + int num_dai; + int ret; + int off =3D 0; + + /* Read the PDI config and initialize cadence PDI */ + intel_pdi_init(sdw, &config); + ret =3D sdw_cdns_pdi_init(cdns, config); + if (ret) + return ret; + + intel_pdi_stream_ch_update(sdw, &sdw->cdns.pcm); + + /* DAIs are created based on total number of PDIs supported */ + num_dai =3D cdns->pcm.num_pdi; + + dai_runtime_array =3D devm_kcalloc(cdns->dev, num_dai, + sizeof(struct sdw_cdns_dai_runtime *), + GFP_KERNEL); + if (!dai_runtime_array) + return -ENOMEM; + cdns->dai_runtime_array =3D dai_runtime_array; + + dais =3D devm_kcalloc(cdns->dev, num_dai, sizeof(*dais), GFP_KERNEL); + if (!dais) + return -ENOMEM; + + /* Create PCM DAIs */ + stream =3D &cdns->pcm; + + ret =3D intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pcm.num_in, + off, stream->num_ch_in); + if (ret) + return ret; + + off +=3D cdns->pcm.num_in; + ret =3D intel_create_dai(cdns, dais, INTEL_PDI_OUT, cdns->pcm.num_out, + off, stream->num_ch_out); + if (ret) + return ret; + + off +=3D cdns->pcm.num_out; + ret =3D intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pcm.num_bd, + off, stream->num_ch_bd); + if (ret) + return ret; + + return devm_snd_soc_register_component(cdns->dev, &dai_component, + dais, num_dai); +} + const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .debugfs_init =3D intel_ace2x_debugfs_init, .debugfs_exit =3D intel_ace2x_debugfs_exit, =20 + .register_dai =3D intel_register_dai, + .link_power_up =3D intel_link_power_up, .link_power_down =3D intel_link_power_down, }; --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59DC1C6FD1C for ; Thu, 23 Mar 2023 05:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230488AbjCWFcF (ORCPT ); Thu, 23 Mar 2023 01:32:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbjCWFbe (ORCPT ); Thu, 23 Mar 2023 01:31:34 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED7F22031 for ; Wed, 22 Mar 2023 22:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549465; x=1711085465; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wsFbcSJtx/AlSmGIw0DdUSJEopY6I39DINuaH9UuTy0=; b=K8QJDfehQh970xxe9MsJjbb/TOWmkqFr6R0S2+OtPUKfPovkuslMdJCG +WiJOOpCuLaOfrrG2B0nT7nbYqs4/5CnfH+Sl+2GvnvAO9KUX/SEPEGnw HHIYsDjMj9Om6SanktA2qMlTrEAsgd+ceoZ1+yR8hX6122k/qJI4YpHsd v4xDFTKOnbbaoKhsSo4S91jS5iPMup8ui5qavnGEazF9DWJmR/fCx09Dp IohZHYP8UaO1ndwAxmZIxOiBrY46OjW7cLHM46WCmSBq00bsJqkXoqkYu /Q8HaEadSfbDCW2g93FWBYyI2ii8qrDP4hjBQevMGz5XyAQ/4vIQUqPEk A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779460" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779460" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567197" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567197" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:26 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 15/20] soundwire: intel_ace2x: add sync_arm/sync_go helpers Date: Thu, 23 Mar 2023 13:44:47 +0800 Message-Id: <20230323054452.1543233-16-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Same functionality as before, but with the registers moved to the HDaudio multi-link area. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index d6d5e6e070f4..20b8806f7de6 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -116,6 +116,41 @@ static int intel_link_power_down(struct sdw_intel *sdw) return ret; } =20 +static void intel_sync_arm(struct sdw_intel *sdw) +{ + unsigned int link_id =3D sdw->instance; + + mutex_lock(sdw->link_res->shim_lock); + + hdac_bus_eml_sdw_sync_arm_unlocked(sdw->link_res->hbus, link_id); + + mutex_unlock(sdw->link_res->shim_lock); +} + +static int intel_sync_go_unlocked(struct sdw_intel *sdw) +{ + int ret; + + ret =3D hdac_bus_eml_sdw_sync_go_unlocked(sdw->link_res->hbus); + if (ret < 0) + dev_err(sdw->cdns.dev, "%s: SyncGO clear failed: %d\n", __func__, ret); + + return ret; +} + +static int intel_sync_go(struct sdw_intel *sdw) +{ + int ret; + + mutex_lock(sdw->link_res->shim_lock); + + ret =3D intel_sync_go_unlocked(sdw); + + mutex_unlock(sdw->link_res->shim_lock); + + return ret; +} + /* * DAI operations */ @@ -283,6 +318,10 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D= { =20 .link_power_up =3D intel_link_power_up, .link_power_down =3D intel_link_power_down, + + .sync_arm =3D intel_sync_arm, + .sync_go_unlocked =3D intel_sync_go_unlocked, + .sync_go =3D intel_sync_go, }; EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL); =20 --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5718CC6FD1D for ; Thu, 23 Mar 2023 05:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230489AbjCWFcN (ORCPT ); Thu, 23 Mar 2023 01:32:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbjCWFbo (ORCPT ); Thu, 23 Mar 2023 01:31:44 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C9AE212A9 for ; Wed, 22 Mar 2023 22:31:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549468; x=1711085468; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q80CBcxn2QOQK8sFpcJ2zT5Gn5sp4JMMdHxIOJazfZ4=; b=lJTvWVUstMjMBb0jeCDsoQIZukw3dI/GGzt7ltKqkuptKrOME2a4vG29 GRy3eGiTQxhfS+6ECvvCXxQ8ePBWi6dBbKy4ynXBovIrGGlc1l+aRyPZ5 W9mBjBOC7qZIo8WOFk+R4zXh8JFbgZUu94fTf/CrVPFOZOox/XYeiMy7C ZNCPpxe1EGYWgTijm7gZCQXVde6KZP8mxOLAdBHU7KdJIcqD5SIbWmNoL Cavak/lL3vYJLcj8hqo6F68tDYKwG1tGTFGnMY10QErcqsAXFi4InVeVX 9ms5Fe+qfSDphee++OlHwQ7SFzaRX7Gw7leuJqhAG9eK7xdZtVYEeyl+N A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779468" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779468" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567220" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567220" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:28 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 16/20] soundwire: intel_ace2x: use common helpers for bus start/stop Date: Thu, 23 Mar 2023 13:44:48 +0800 Message-Id: <20230323054452.1543233-17-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart The sequences are so far identical, so the abstraction is a bit over-engineered. In time we will simplify if there is no need to special case or work-around programming sequences. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 20b8806f7de6..2e33e8a00b55 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -316,6 +316,12 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D= { =20 .register_dai =3D intel_register_dai, =20 + .check_clock_stop =3D intel_check_clock_stop, + .start_bus =3D intel_start_bus, + .start_bus_after_reset =3D intel_start_bus_after_reset, + .start_bus_after_clock_stop =3D intel_start_bus_after_clock_stop, + .stop_bus =3D intel_stop_bus, + .link_power_up =3D intel_link_power_up, .link_power_down =3D intel_link_power_down, =20 --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C7D9C6FD1C for ; Thu, 23 Mar 2023 05:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbjCWFcj (ORCPT ); Thu, 23 Mar 2023 01:32:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230492AbjCWFcB (ORCPT ); Thu, 23 Mar 2023 01:32:01 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD82E31BD2 for ; Wed, 22 Mar 2023 22:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549483; x=1711085483; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zulnEGWCaE/ce7on2AHJOrEISXuutjX2aua9tmM2yVE=; b=P8rk4T1nDolSbVLSQmIHuiMGPFWQleRgDCqyVLt0FTKIb+H9VM5VpRuf tbhPc81S4e04hiQiZuo1/wrtiENIfAcbfXM3buhKknpjbecnGQQKJLTug jGvUVBvM/Y3K4XTlHdDhZTEm70V7R4XcHm+6IeAxvdexW6TVSYfVmdLl7 ce1ovynWcHxdcUhyaY74vprtup0nNiniE7LjkWl2P5xAJiNaEQczbtSJm eQf3JAfJVgPCoQTj06SBhWAC3tX4LtIYD1FG3gxG7w8Ds6/8QTt/tLSI8 ivws77o6S8/6Jas6TB4VF4/aq5wfx+MI93wICIsQFUFmEey2t4FNykkyA A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779480" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779480" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567238" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567238" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:31 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 17/20] soundwire: intel_ace2x: enable wake support Date: Thu, 23 Mar 2023 13:44:49 +0800 Message-Id: <20230323054452.1543233-18-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart The WAKEEN and WAKESTS registers were moved to the per-link SHIM_VS area. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 2e33e8a00b55..fe950b3ea3bc 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -31,6 +31,41 @@ static void intel_shim_vs_init(struct sdw_intel *sdw) usleep_range(10, 15); } =20 +static int intel_shim_check_wake(struct sdw_intel *sdw) +{ + void __iomem *shim_vs; + u16 wake_sts; + + shim_vs =3D sdw->link_res->shim_vs; + wake_sts =3D intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_WAKESTS); + + return wake_sts & SDW_SHIM2_INTEL_VS_WAKEEN_PWS; +} + +static void intel_shim_wake(struct sdw_intel *sdw, bool wake_enable) +{ + void __iomem *shim_vs =3D sdw->link_res->shim_vs; + u16 wake_en; + u16 wake_sts; + + wake_en =3D intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_WAKEEN); + + if (wake_enable) { + /* Enable the wakeup */ + wake_en |=3D SDW_SHIM2_INTEL_VS_WAKEEN_PWE; + intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_WAKEEN, wake_en); + } else { + /* Disable the wake up interrupt */ + wake_en &=3D ~SDW_SHIM2_INTEL_VS_WAKEEN_PWE; + intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_WAKEEN, wake_en); + + /* Clear wake status (W1C) */ + wake_sts =3D intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_WAKESTS); + wake_sts |=3D SDW_SHIM2_INTEL_VS_WAKEEN_PWS; + intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_WAKESTS, wake_sts); + } +} + static int intel_link_power_up(struct sdw_intel *sdw) { struct sdw_bus *bus =3D &sdw->cdns.bus; @@ -325,6 +360,9 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .link_power_up =3D intel_link_power_up, .link_power_down =3D intel_link_power_down, =20 + .shim_check_wake =3D intel_shim_check_wake, + .shim_wake =3D intel_shim_wake, + .sync_arm =3D intel_sync_arm, .sync_go_unlocked =3D intel_sync_go_unlocked, .sync_go =3D intel_sync_go, --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B57DDC76196 for ; Thu, 23 Mar 2023 05:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231151AbjCWFcl (ORCPT ); Thu, 23 Mar 2023 01:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230353AbjCWFcC (ORCPT ); Thu, 23 Mar 2023 01:32:02 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7449B31E2F for ; Wed, 22 Mar 2023 22:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549486; x=1711085486; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SbHuuXPdMaBgfOruu1bZggLsJuDVCwmXsFFke6IavfA=; b=VkFCs20SelT4nM33U1OqgJ8PAbgJWwk3BvEaOjmjx633pVpJ3dJhFVsu f51RBqPWnJSh5JucJv3JBV3Hmg8iobwqCUMF9MF5BPLdsVcnhac3RXuma YAWxVZ/LIufJL6kff+Er4hzu5zPwiXq/S1HqBrU1Syr1HQahSXdKj0tBp LkZqS22GMQCSnaC4I5vVzTu8rzX0K9JiDNdwvUwSP0n8SeEcYQ3/ht8M/ e8DligFsVuk4SvLb8vKkGm/vsE3gOg0vzIHzctIBQqDkJE4q19Wl2Pwc6 1Y+qG068/K81D8/3EA7N5Exj2N1sTsBhU49VZC9OdEJo92Qv8nK0Ll8O1 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779491" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779491" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567258" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567258" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:33 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 18/20] soundwire: intel_ace2x: add check_cmdsync_unlocked helper Date: Thu, 23 Mar 2023 13:44:50 +0800 Message-Id: <20230323054452.1543233-19-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart This is the last callback needed for all bus management routines on new hardware. Same concept as before, just different register. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index fe950b3ea3bc..a12fee8a5bfa 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -186,6 +186,11 @@ static int intel_sync_go(struct sdw_intel *sdw) return ret; } =20 +static bool intel_check_cmdsync_unlocked(struct sdw_intel *sdw) +{ + return hdac_bus_eml_sdw_check_cmdsync_unlocked(sdw->link_res->hbus); +} + /* * DAI operations */ @@ -366,6 +371,7 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .sync_arm =3D intel_sync_arm, .sync_go_unlocked =3D intel_sync_go_unlocked, .sync_go =3D intel_sync_go, + .sync_check_cmdsync_unlocked =3D intel_check_cmdsync_unlocked, }; EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL); =20 --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 453E3C6FD1D for ; Thu, 23 Mar 2023 05:32:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231194AbjCWFc4 (ORCPT ); Thu, 23 Mar 2023 01:32:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230487AbjCWFcZ (ORCPT ); Thu, 23 Mar 2023 01:32:25 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFAB631BE4 for ; Wed, 22 Mar 2023 22:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549489; x=1711085489; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gtkWDGGprYUCa/NujUo+nrfpqYowlmMRMlh2EJAtBoc=; b=F/vVsqcsOIYBCZKC6fYc8SSuRNavVLDZn3teRJJo0U/O33x9Zy5wUys8 8wuJw5krE2kzNjKp/Zwq1h/ple0yW27Uo2LnNvtlJivK3tRrZqSemXi6u 09SoSDW89ifsN6xMNfzaYwIa1Mg85ZL4V9CdFj66Qw/SNaJhzGkpM+4Hc +lrPxkdPn+cq+0W76XeMR3lVYIOCFSbaZ3dMGozCa4Ol0SrXHBkqGjCKy ggpYXoalXngkuh12PIOev4FR2chefy5BP6QxU8xDgR1vnsy8M2uo7Puy6 DwxFXStkxI1cd1SreB7zOTCGPWd/70gu23Fvc4bPB7ztsOjfjMaoBcWFQ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779505" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779505" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567269" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567269" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:36 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 19/20] soundwire: bus: add new manager callback to deal with peripheral enumeration Date: Thu, 23 Mar 2023 13:44:51 +0800 Message-Id: <20230323054452.1543233-20-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart When a peripheral reports as ATTACHED, the manager may need to follow a programming sequence, e.g. to assign DMA resources and/or assign a command queue for that peripheral. This patch adds an optional callback, which will be invoked every time the peripheral attaches. This might be overkill in some scenarios, and one could argue that this should be invoked only on the first attachment. The bus does not however track this first attachment with any existing state-mirroring variable, and using dev_num_sticky would not work across suspend-resume cycles. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/bus.c | 3 +++ include/linux/soundwire/sdw.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index b6aca59c3130..35f49bcc53e5 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -716,6 +716,9 @@ static int sdw_assign_device_num(struct sdw_slave *slav= e) /* After xfer of msg, restore dev_num */ slave->dev_num =3D slave->dev_num_sticky; =20 + if (bus->ops && bus->ops->new_peripheral_assigned) + bus->ops->new_peripheral_assigned(bus, dev_num); + return 0; } =20 diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index ef645de13ae9..c076a3f879b3 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -846,6 +846,7 @@ struct sdw_defer { * @post_bank_switch: Callback for post bank switch * @read_ping_status: Read status from PING frames, reported with two bits= per Device. * Bits 31:24 are reserved. + * @new_peripheral_assigned: Callback to handle enumeration of new periphe= ral. */ struct sdw_master_ops { int (*read_prop)(struct sdw_bus *bus); @@ -860,7 +861,7 @@ struct sdw_master_ops { int (*pre_bank_switch)(struct sdw_bus *bus); int (*post_bank_switch)(struct sdw_bus *bus); u32 (*read_ping_status)(struct sdw_bus *bus); - + void (*new_peripheral_assigned)(struct sdw_bus *bus, int dev_num); }; =20 /** --=20 2.25.1 From nobody Sun Feb 8 15:41:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83419C6FD1C for ; Thu, 23 Mar 2023 05:33:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbjCWFdM (ORCPT ); Thu, 23 Mar 2023 01:33:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbjCWFcd (ORCPT ); Thu, 23 Mar 2023 01:32:33 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C848632E69 for ; Wed, 22 Mar 2023 22:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549501; x=1711085501; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R3GyCN8p+cJBxO9BTibcqpeTRWzFQliw1LPEGnZdocY=; b=VMZ3Wyb/VSSzKrOPiOwT7pc5BwcZQuDv0PoaGz9TZsUpT59uXeQd1sbv +7O/tB9b03s6Ss62knNnx4jGubyLTMoUC0WSLFoJvoNpMYWAdN4PPjlgY BMN+rAvA44Bqj3K788wDANuL0qKElPpSf+Ezcf8IikZfEb+h3aKEOhI82 3qisOA14Y/SLxfrl8rIv8ZnRndMeDFZa3j3k7M98I2BFG5Fhe0Cl3Od+8 ODznk2zSdkrpS5wkgN8RCas8Khhln0ZC3kE+UzjPUlWoJcxWT48GmNY84 0QXcsUCs1go7QadRFT04IeFFbYS2fPdFmj3BsnzCjwomXfMf8s9LgTiXQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779513" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779513" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567305" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567305" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:39 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 20/20] soundwire: intel_ace2x: add new_peripheral_assigned callback Date: Thu, 23 Mar 2023 13:44:52 +0800 Message-Id: <20230323054452.1543233-21-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Add the abstraction needed to only program the LSDIID registers for the HDaudio extended links. It's perfectly fine to program this register multiple times in case devices lose sync and reattach. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 12 ++++++++++++ drivers/soundwire/intel_auxdevice.c | 16 ++++++++++++++++ include/linux/soundwire/sdw_intel.h | 3 +++ 3 files changed, 31 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index a12fee8a5bfa..65deb4345354 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -350,6 +350,16 @@ static int intel_register_dai(struct sdw_intel *sdw) dais, num_dai); } =20 +static void intel_program_sdi(struct sdw_intel *sdw, int dev_num) +{ + int ret; + + ret =3D hdac_bus_eml_sdw_set_lsdiid(sdw->link_res->hbus, sdw->instance, d= ev_num); + if (ret < 0) + dev_err(sdw->cdns.dev, "%s: could not set lsdiid for link %d %d\n", + __func__, sdw->instance, dev_num); +} + const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .debugfs_init =3D intel_ace2x_debugfs_init, .debugfs_exit =3D intel_ace2x_debugfs_exit, @@ -372,6 +382,8 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .sync_go_unlocked =3D intel_sync_go_unlocked, .sync_go =3D intel_sync_go, .sync_check_cmdsync_unlocked =3D intel_check_cmdsync_unlocked, + + .program_sdi =3D intel_program_sdi, }; EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL); =20 diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_= auxdevice.c index b02cef4f4b66..6e02782ef211 100644 --- a/drivers/soundwire/intel_auxdevice.c +++ b/drivers/soundwire/intel_auxdevice.c @@ -60,6 +60,21 @@ static int generic_post_bank_switch(struct sdw_bus *bus) return sdw->link_res->hw_ops->post_bank_switch(sdw); } =20 +static void generic_new_peripheral_assigned(struct sdw_bus *bus, int dev_n= um) +{ + struct sdw_cdns *cdns =3D bus_to_cdns(bus); + struct sdw_intel *sdw =3D cdns_to_intel(cdns); + + /* paranoia check, this should never happen */ + if (dev_num < INTEL_DEV_NUM_IDA_MIN || dev_num > SDW_MAX_DEVICES) { + dev_err(bus->dev, "%s: invalid dev_num %d\n", __func__, dev_num); + return; + } + + if (sdw->link_res->hw_ops->program_sdi) + sdw->link_res->hw_ops->program_sdi(sdw, dev_num); +} + static int sdw_master_read_intel_prop(struct sdw_bus *bus) { struct sdw_master_prop *prop =3D &bus->prop; @@ -117,6 +132,7 @@ static struct sdw_master_ops sdw_intel_ops =3D { .pre_bank_switch =3D generic_pre_bank_switch, .post_bank_switch =3D generic_post_bank_switch, .read_ping_status =3D cdns_read_ping_status, + .new_peripheral_assigned =3D generic_new_peripheral_assigned, }; =20 /* diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index bafc6f2554b0..1a8f32059cd8 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -399,6 +399,7 @@ struct sdw_intel; * @sync_go: helper for multi-link synchronization * @sync_check_cmdsync_unlocked: helper for multi-link synchronization * and bank switch - shim_lock is assumed to be locked at higher level + * @program_sdi: helper for codec command/control based on dev_num */ struct sdw_intel_hw_ops { void (*debugfs_init)(struct sdw_intel *sdw); @@ -425,6 +426,8 @@ struct sdw_intel_hw_ops { int (*sync_go_unlocked)(struct sdw_intel *sdw); int (*sync_go)(struct sdw_intel *sdw); bool (*sync_check_cmdsync_unlocked)(struct sdw_intel *sdw); + + void (*program_sdi)(struct sdw_intel *sdw, int dev_num); }; =20 extern const struct sdw_intel_hw_ops sdw_intel_cnl_hw_ops; --=20 2.25.1