From nobody Sun Feb 8 13:45:48 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 AF82CC77B7D for ; Mon, 15 May 2023 06:50:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240111AbjEOGu1 (ORCPT ); Mon, 15 May 2023 02:50:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239097AbjEOGuY (ORCPT ); Mon, 15 May 2023 02:50:24 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAB818F for ; Sun, 14 May 2023 23:50: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=1684133423; x=1715669423; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ulAOPJpFKU1kbrYfiKz1ABKjFv/hYupKOQurQHC/rd0=; b=N97dpRR1MiDhi1Vydoi8otmJatInDRA/mskAFBGQuslNhrt03WAV2e9k EAn7vOQ2XpUMeXO+jP98XihdIQYSRpfegBaT2uiqQ5HbbZfpS41Zi+wfs XmY+Q/KIw2YWTZq6z4aeqwnYVPPCZcXO8iOqD0KSIkQSajXb4x1ZDHTqz iXI8OeU97IZUcQnwCrQmPpMFpmqOjziT7qIV/eRfSf3NsZ8o9hbc45OU8 bYWe7pPdkP19YhYJl9NOoCXkvLi2v7UcBHCOqlLsmcmoyAfqfdUbvosgZ 5p/vlBoN61WEYJl1OvRo7UhhvOzL1Vy/zzX75H48s09sY4p3RcmS2yrMs A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966250" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966250" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908576" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908576" 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; 14 May 2023 23:50:21 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 01/26] ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake Date: Mon, 15 May 2023 15:10:17 +0800 Message-Id: <20230515071042.2038-2-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 A1AECC77B7D for ; Mon, 15 May 2023 06:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240118AbjEOGub (ORCPT ); Mon, 15 May 2023 02:50:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239097AbjEOGu2 (ORCPT ); Mon, 15 May 2023 02:50:28 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD1BFE71 for ; Sun, 14 May 2023 23:50: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=1684133426; x=1715669426; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yZvrzQd70YjHlJlmhsCqEtarCH/SM9v+ndjTDzenB98=; b=kpCJI9b9pJBj8t6ZtHkcaJB5mdcYYlhzZg2OkEF/tslXwD5HJOfWkRM1 RegfLP1Xr2dvUQYEVx/lVGXMwMDuFna58gtrSpMwEtTmLIXBbH+rQ8QNc 1um6mc36yr/qhfX2GbGO9DpGkcxvgW4fziJdrCrzenhHtCcQGuBP0J8K5 uof7dwIIyvJxOg5cULqTlo3IElicGJywNHq75UkL2UA7ttAfuKAXCijWv QHDYojaypa5C44sCWU49F1F2kD1Nt6OvxUDm1ZZzTfoDbNvT++IimNzeg mVUihhis5/QpzbIsG5ILD1fhMAJvVBjzReRCSxwvC1G8lmTvCi1z6f88q w==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966273" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966273" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908595" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908595" 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; 14 May 2023 23:50:23 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 02/26] soundwire: intel: add ACE2.x SHIM definitions Date: Mon, 15 May 2023 15:10:18 +0800 Message-Id: <20230515071042.2038-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 B999BC77B7D for ; Mon, 15 May 2023 06:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240125AbjEOGue (ORCPT ); Mon, 15 May 2023 02:50:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240120AbjEOGua (ORCPT ); Mon, 15 May 2023 02:50:30 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E457C2 for ; Sun, 14 May 2023 23:50: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=1684133429; x=1715669429; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8qoVMqaRyRfqkzBoyYI1vRz26d5h32BGobLS43A08RI=; b=N6Z7XoIMGyCWCuLOWheLG2Qa9nvBJRgvmhtSmIxDLEnoRvod7d9A7YFR A31DNoxNzaf//JTEoM9xqraH0Jcbm+AEtv9ojWxmWKTLxKjGN7ETSkQZc Ofn6NJH/LqTYbn29OIoiKYdNFIzEecvMBzmDv2o/VVff+c4pVC5dDVJ+4 ofu2Nx0ZU63fISX7zpIiDKAKJY4ApUtgWLPTQbtg2PTTuFFvwmZo0Eu9q b3NJgksVG5i7vLvMVWdXVPjVbaCbZew1SAGCNl2lsYwGyAUwBPp5vIYQd /GHk/SYbkly5LGEO5ezhdl1Ie3eNLAyZkvJm5RPusX3wPJB+Z7iskUctD g==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966288" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966288" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908603" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908603" 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; 14 May 2023 23:50:26 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 03/26] soundwire: intel_ace2x: add empty new ops for LunarLake Date: Mon, 15 May 2023 15:10:19 +0800 Message-Id: <20230515071042.2038-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 925566ff4272..5d612c9b6362 100644 --- a/drivers/soundwire/Makefile +++ b/drivers/soundwire/Makefile @@ -24,7 +24,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 13:45:48 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 14AFDC77B75 for ; Mon, 15 May 2023 06:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240194AbjEOGuj (ORCPT ); Mon, 15 May 2023 02:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240145AbjEOGue (ORCPT ); Mon, 15 May 2023 02:50:34 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC61D10EF for ; Sun, 14 May 2023 23:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133431; x=1715669431; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kmDbCUIES+5ZVKXI71LGbR/AUG9G2hwf5/ixjyhOExs=; b=Cqe9DJftSm9NWlLYnOPKR/KfhojTVNW8jicZkte96+tbyLyr0kjnOG+v N7k2dXcsnORXhbhHIJ3VM13eaBxerQP4lZrtKadnAmdER5K4z2aacfA/d jEyzoNxDZev7gS6FZ8v9bwS3tJcH6J+KTbkwR8qMmoubZtgQowg/oGbdE hgpoyPJ4hTgeoIzeYWoihV7E60c3/pArGi32i1MpfE/yPFvmcJRfXSX13 cWEEDQM0Z9fSLsr4iDGSQIhlQZZk9aGLq0kBshHNe9aX9n+bIL1wZOX5g g+7x6Lufxjh7+YdBzPmXUOr2VYSqjMbt1vYdap+Lpi+qnyi2GRY2fV/Hq g==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966301" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966301" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908617" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908617" 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; 14 May 2023 23:50:28 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 04/26] soundwire/ASOC: Intel: update offsets for LunarLake Date: Mon, 15 May 2023 15:10:20 +0800 Message-Id: <20230515071042.2038-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 3153e21f100a..793baf60c78b 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -158,6 +158,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; @@ -166,10 +167,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 13:45:48 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 51E74C77B7D for ; Mon, 15 May 2023 06:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240206AbjEOGus (ORCPT ); Mon, 15 May 2023 02:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240197AbjEOGul (ORCPT ); Mon, 15 May 2023 02:50:41 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 257C7173F for ; Sun, 14 May 2023 23:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133434; x=1715669434; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jzpdfZmzNrU6pw0ISN0oU8vFcN6tRPXs+SPemPddfJg=; b=VEak6Fosbpog38/D+V1nBYZantSpZ5Qwqi0jt2etvleSDHJNby4e3UBs wYwhFwhFe+UQv3GFcLSQYNYU1m4KXKP12jKiTdi0QDL9M5cxl7NBUTdi1 ccI/l4Z5tPPqBVTBA0NbXH2paphEL3NXLXxWAZItEQlLpeolQYDp8OxC+ 8HNqFNbphcGhWoovsBbbIJDawbvqATH4stiHiTaSReTLkBipLZsJyJy5G JFbRGt3BDhMTBwf5oi7TgC8tmyaTI3fIaKCveycUWVF91hj78i1tEtpro 2NJOrTgHM1cnECRYUUhGhqBfeM08Zb9nF0bn+G7BcNDWWNTgaM0+XY3bx w==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966308" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966308" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908629" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908629" 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; 14 May 2023 23:50:31 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 05/26] soundwire: intel/cadence: set ip_offset at run-time Date: Mon, 15 May 2023 15:10:21 +0800 Message-Id: <20230515071042.2038-6-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 27c56274217f..86a450b1cbda 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 b21e86084f7b..fcdf4f2d60e3 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 13:45:48 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 9D8C3C77B7D for ; Mon, 15 May 2023 06:50:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240249AbjEOGu4 (ORCPT ); Mon, 15 May 2023 02:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240241AbjEOGur (ORCPT ); Mon, 15 May 2023 02:50:47 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5728E1BE4 for ; Sun, 14 May 2023 23:50: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=1684133436; x=1715669436; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aAq1nEu0w9jquwDbM8Ql9Dgc92dfowXErHtU9iHqtg8=; b=TxaZ0l8wg/g2jE/7zo9RI6M0iFjVo5bXlw3Hveecx4e3ZlwzGMXyZQJ0 47JjznsyZTyoE1doqL5agoWLlfRVrBnZyDGCwfaHMW+b4lhb2w2iZuubM dVztqYchRLcEMcYwgFbQPJ47C6nuwx6zESnyTKCz4XAxzQYBskrIX8RT0 SnHOtlkaG1obMLVDny7hDjP/gkFEK2CvsFw1Lo4Rsv0NzatosQeX6oMAU C7Y/RS4y8Lu4Di6kht2Iid0RKRCEPUKJ65+w/muv6oT2boGhVrsOj6Mg4 Jx3HmQ65monnG3E6nA5h+L/mrgmfvvgNiKYP1ghy9O0U4Iil0z41IAS5u A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966321" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966321" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908635" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908635" 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; 14 May 2023 23:50:33 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 06/26] ASoC/soundwire: intel: pass hdac_bus pointer for link management Date: Mon, 15 May 2023 15:10:22 +0800 Message-Id: <20230515071042.2038-7-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 793baf60c78b..4d48f4018617 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -189,6 +189,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 13:45:48 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 1AB39C77B75 for ; Mon, 15 May 2023 06:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240273AbjEOGu7 (ORCPT ); Mon, 15 May 2023 02:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240170AbjEOGus (ORCPT ); Mon, 15 May 2023 02:50:48 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CDE72699 for ; Sun, 14 May 2023 23:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133438; x=1715669438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xKsOmGgpfRTaoYi/C0Rex9lD4JYFMvLzVqkjtEvqo9k=; b=G9lxGxSw372a26MCw7DfcNPWonstBGIqWG1Rvv0liJ+h1tginpiDrVKY YVbasQqng62u0zT33XIEtAB/KoJdN1goq3YFListrqGYT/EXNoVOUXSd7 h5dtdFVl2wETI1ymY1yQZdmFlf9OZ7XejBMVJzQIUXzWWuHN7HxIeNbsE ZkU0Fh/z3/OAjzSZZGfaxxLkC0X4uaXMGwjdaDZYbQb/wn0qbIANCRzif 3Br/5IVqnsF+fZkoHINikTUfsLZg1n/yACQmO5PPvT/lToI1/NIZHfnA2 LuLlKa0jj/LGI8Q3s7DeOg98iBh0o1s3cLbmR32f37Xq14AV3qMytz13a A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966331" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966331" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908641" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908641" 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; 14 May 2023 23:50:35 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 07/26] soundwire: intel: add eml_lock in the interface for new platforms Date: Mon, 15 May 2023 15:10:23 +0800 Message-Id: <20230515071042.2038-8-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 B7099C77B75 for ; Mon, 15 May 2023 06:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240267AbjEOGvQ (ORCPT ); Mon, 15 May 2023 02:51:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240308AbjEOGu6 (ORCPT ); Mon, 15 May 2023 02:50:58 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98DAB2D45 for ; Sun, 14 May 2023 23:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133443; x=1715669443; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nQ5bs2pm3yyJqyCctssYUsybKhCJPd02FInwiNQFhys=; b=Ku+Jk3cpmKBW7YdsC390nU5nJxA1iLNaMF4K1Als9La6rR18PGOCJdDV qpGK3keqMzWf3GV2emWwhGArEy6p8mJ2vb5a5NTI/TbOdUH+jB9JlRiip aifLn5KFLtR0ZpkOXEmmNArxgRgOWCKt6cMcI95cABBjrDc8KZv01hjr4 6M3wjnkY6YOx+5FviQp1GT1BaXFGCrimHD0IPpflouuIC1F9LO5zUXWsP j+8Cej99ncBQFO4Z9tTSILX9G39Lh/ulOQ+r+ZUQNA7C3OXnnNwp0V506 DIuN1qsRwVeKAZw1Np7x0eNteyd9u4m2ZbFk81DFse76G5BeLst+hyoZF Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966344" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966344" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908651" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908651" 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; 14 May 2023 23:50:38 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 08/26] ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer Date: Mon, 15 May 2023 15:10:24 +0800 Message-Id: <20230515071042.2038-9-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 4d48f4018617..388e41057172 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -175,6 +175,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 13:45:48 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 9A4B9C77B7D for ; Mon, 15 May 2023 06:51:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240347AbjEOGv0 (ORCPT ); Mon, 15 May 2023 02:51:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240214AbjEOGvJ (ORCPT ); Mon, 15 May 2023 02:51:09 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FB891986 for ; Sun, 14 May 2023 23:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133446; x=1715669446; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dypjg8PFg6rfCWgJzAX1z/pRx6Y007Vaip829IVJOYA=; b=jmf9OMQ7uKtPrWJNxaXvo2FyfcUbeIRE3Ui7j71r0Wd/nvVyNpVljkKp eIUnZNiMzfSZGvPx8sVlzQondHdWDWQBR1d4mI95YbiyHYrQQ2SAPCwy2 jE50s84+RZU9DUNFUa6z7Qhcu+JIa0D4RGIUdqmzAjHobVjlG3EocidDn 84xFGSEuH9M7lw/LCdrUDzI0WaVfnQKM/LDrqu9FoBYvL9Qgh8DCVbDNr DU9hnzO5Cje+8Ry57RY8Bf0xAJq0HYcSFeLENjbh7xGASeYa0XLI71spa BFE/Ss2ypkspST5TTPt2c6HERvNahIafSrIiAj/fM2Xv8Z7ptUmPIQrVn Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966358" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966358" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908670" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908670" 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; 14 May 2023 23:50:40 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 09/26] soundwire: intel_init: use eml_lock parameter Date: Mon, 15 May 2023 15:10:25 +0800 Message-Id: <20230515071042.2038-10-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 DC451C77B7D for ; Mon, 15 May 2023 06:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240325AbjEOGvf (ORCPT ); Mon, 15 May 2023 02:51:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240313AbjEOGvT (ORCPT ); Mon, 15 May 2023 02:51:19 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6354E6A for ; Sun, 14 May 2023 23:50: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=1684133454; x=1715669454; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XvfbnjlaB9am2ZcV6awW54L+055YaQ1c356nRelvRBE=; b=IEBtRTUFI7ECuLyh940lMPK4IuGiyCWkA8Wv2HbojdfE09EHcyJjEvxY TPup89r7SZd4v8C9NC8o26uAgQ6V3CnSjOg+zrxiM3XM++1ycfo+mutOs UGnXc3/sWlSC4HUsQf8IpDOAYcbeZW3n/ehocYGfUqs0g7QAI/Jo8n9gB uOry/qH7lZu+JHKFeiTkJ0oUqddE8mgt/cjLU/TJdHyeNQoplDVjahyfS jnVvbvLdtBMqMoj2Q+dqTgzyTZ84bWn14OeSFwXQDaQcpCG9QrkZzjw9W Z6CxKYtyi/7r40nAIf2ojH6aJFioRO3ZwTh6njkBu3v6EsMXTOUror9rU w==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966370" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966370" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908683" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908683" 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; 14 May 2023 23:50:42 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 10/26] soundwire: intel_ace2x: add debugfs support Date: Mon, 15 May 2023 15:10:26 +0800 Message-Id: <20230515071042.2038-11-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 5d612c9b6362..c3d3ab3262d3 100644 --- a/drivers/soundwire/Makefile +++ b/drivers/soundwire/Makefile @@ -24,7 +24,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 13:45:48 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 9604CC77B7D for ; Mon, 15 May 2023 06:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238527AbjEOGvj (ORCPT ); Mon, 15 May 2023 02:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240366AbjEOGvY (ORCPT ); Mon, 15 May 2023 02:51:24 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE5512684 for ; Sun, 14 May 2023 23:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133458; x=1715669458; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zfPDFAUHD0yEFTAl6FmNYsvKI40bPenFTeUs36GSzIY=; b=Jdxs3TBck9QVe9l8Y9bzOVtPFLEbll9RrBaJ6UaNWVxy85WG1U1haccE eMf0Y0FcSlvoNo7iJY5vjs1vBCJi2+nfunSv/qGr/jLukmqpCKCGluz+E 2buV0+4uEMrg72GaOkNamEpoZ1i2AUcrVTwzvrcMUjH3z0aJKOcflA4nJ 4mSTnBmTOOI0rFkIaCqROjSNAo5SFRCih99N+gVygr6Q3p7Xmfw1DkyuZ KVj5fnnAM1RmQja+irj/bAW5lGTdBOp0UX4A0s+zz7A+RNX0qN9jRgV0E RniUYmcg5WPd4dLXmFayVSHNuXevun+JjZuLZ6gfQaa0RmCOKGHz+fMxO A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966377" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966377" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908697" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908697" 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; 14 May 2023 23:50:45 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 11/26] soundwire: intel_ace2x: add link power-up/down helpers Date: Mon, 15 May 2023 15:10:27 +0800 Message-Id: <20230515071042.2038-12-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 CAF50C77B75 for ; Mon, 15 May 2023 06:51:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240370AbjEOGvs (ORCPT ); Mon, 15 May 2023 02:51:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240355AbjEOGv3 (ORCPT ); Mon, 15 May 2023 02:51:29 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98AA72D7F for ; Sun, 14 May 2023 23:51: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=1684133465; x=1715669465; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aNL2KliVK/W0PGGaQa+13McnVurhskx2OOU+yOO7uSY=; b=Jyb9vydAHkPvidL3mW6nWVqQt+eC6/rkl3l/LwJ24StHAjz9q6s1l2kX 2VXSoXSXXDJz5yAAkJtVAz3SWx0iqtVKxeq79hptwzTUWfwJUB9tdTeg6 aC2Pc35LhLU1eO5fgv0q+4LOzoyCH5PnRyT0G4YGPgBnS58wQ+egVo1Xt NXxPHp8sG0CjpGmLeLXpMukulznFsX5dA3Jc33IZV1QJRwH/aVJU8GTV2 fD16utJpen7huF4KwByKHZmEiE7Mador/9Aqwmd+LnOtY5PoVdgcm3h/E EC5Mn0c6CWWr5n/zke/Mxxa13a7+Cdh0hHCn3BC/N7D5ij1oJPkuHUsTn w==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966393" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966393" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908711" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908711" 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; 14 May 2023 23:50:47 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 12/26] soundwire: intel_ace2x: set SYNCPRD before powering-up Date: Mon, 15 May 2023 15:10:28 +0800 Message-Id: <20230515071042.2038-13-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 BC4BCC77B7D for ; Mon, 15 May 2023 06:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240448AbjEOGwE (ORCPT ); Mon, 15 May 2023 02:52:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240381AbjEOGvn (ORCPT ); Mon, 15 May 2023 02:51:43 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D05826A0 for ; Sun, 14 May 2023 23:51: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=1684133479; x=1715669479; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kjKTx32w9YdnZJ7K83qEoOALY8hrbkCtcZcfoAY0U2Q=; b=XOoAOqhASP1RI3fzose7GyGXWxHigv1+KNYVl6Q8/c7BR7ePF2dnbJHl ySW1+Y8++rLTUsudUdTj8xRj6PmboT+KuDOZS6Swq0arFv8kJD5j/uewC IBDdYMv1/REb69pLfjqOMeiG2K42Of94xvqMGsJHMqRHAXWe+HV81gYoB QrZtK3S4xXCchER7OK/bJ2l8eR6y44djpt+Q3LdfX6bUdLehHMiwqN4zo eI/Cf1vMXzlBiUqa/3KEXuWYnO8WSxeuAIfMujymvMcLkoH2nOOKIPa4u Utt/EUkNDFFnD7vNjgtFOyGXX7bnS4f4AUMK0kpKCWBgQanyueOi+JkTU Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966408" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966408" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908716" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908716" 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; 14 May 2023 23:50:49 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 13/26] soundwire: intel_ace2x: configure link PHY Date: Mon, 15 May 2023 15:10:29 +0800 Message-Id: <20230515071042.2038-14-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 8476CC77B75 for ; Mon, 15 May 2023 06:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240308AbjEOGwM (ORCPT ); Mon, 15 May 2023 02:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240275AbjEOGvr (ORCPT ); Mon, 15 May 2023 02:51:47 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AE031BC2 for ; Sun, 14 May 2023 23:51: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=1684133484; x=1715669484; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+NUsvy+Y8PVO2h/Op18ecWWhry3F8Mgpf7FkeQTkvn0=; b=oARujuJ+JNIYigcwMM9TinWyrrchY4iTywsHA4KrBm4aIDoWLarJoJL8 1a/5vkkh6pg4i++D/eTSvah2MFVm9j9wciu4b9ZSmF/TQlW2YiFey+Nyy N1fUzfEFcX2eEDL+zmQYO8iySB0Nk/j7dFk5qgVRBWH/sSciWHiQZkFQt 1amy+QAX9HYwJ6+Q2Ilc3AhiS+jOkSuXFagPQUm0qJoeGuF0mKnjyUIJp Y8AudIgok3E6qQX1kon7MNNuNKzF+wS8BjtfQxLHWWOGKcsBUv8HVilr8 ArHL9GTYKZ3SfqYIIXr4W7IRDIu98FmebmZz/iagltB+QYRtZ/Tk+aDTw g==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966431" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966431" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908730" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908730" 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; 14 May 2023 23:50:52 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 14/26] soundwire: intel_ace2x: add DAI registration Date: Mon, 15 May 2023 15:10:30 +0800 Message-Id: <20230515071042.2038-15-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 5B27FC77B7D for ; Mon, 15 May 2023 06:52:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240366AbjEOGwP (ORCPT ); Mon, 15 May 2023 02:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240315AbjEOGvv (ORCPT ); Mon, 15 May 2023 02:51:51 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7115171C for ; Sun, 14 May 2023 23:51: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=1684133489; x=1715669489; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wsFbcSJtx/AlSmGIw0DdUSJEopY6I39DINuaH9UuTy0=; b=S+NrvFbR0iDHJ5XGAcV6zcKUC6rqeVW1EuFQ5OBbsxGdvV3APGPQ+x/1 6h61y+zXBu6FZF536cbf5q9HBckn6uEXsubRnmaF6IDRtyjlXE1BpD1h1 hzOdysSETzY7UWw014WBKYtZRZ7/7JToO3EQ7NEBdYETZzef1JaXXH4iN w1V4pdsTQERQNGdf0nfq3mWul7lC3bIUigsbQk8KpSaxkUL0gWLzepxRb IMNpd3Ibw4nSswvB20i9fO4w+E8vLrF+kKZXbW1Qs6MHOV3jcj4xapuNU 9uApUMCyxHyiMn1MS8S3xtjZSi3s1j0G5CJQQOq2A0Hjv80sivUiSnOpM g==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966445" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966445" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908736" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908736" 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; 14 May 2023 23:50:54 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 15/26] soundwire: intel_ace2x: add sync_arm/sync_go helpers Date: Mon, 15 May 2023 15:10:31 +0800 Message-Id: <20230515071042.2038-16-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 BBB77C77B7D for ; Mon, 15 May 2023 06:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240437AbjEOGw1 (ORCPT ); Mon, 15 May 2023 02:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238487AbjEOGwE (ORCPT ); Mon, 15 May 2023 02:52:04 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD3E52D51 for ; Sun, 14 May 2023 23:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133503; x=1715669503; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q80CBcxn2QOQK8sFpcJ2zT5Gn5sp4JMMdHxIOJazfZ4=; b=g4EB1dP6Opf3Znpafx6Mv0zO7rPg7lCCS/N8lK25F3wAO3UChXTHE0BW 8rRItxImrUeQ5DbiHhlVkrYk4uOSFiyKySGyyBKHUSCwq6S6eBAMkccS9 G9XL5a0253+fVyoFWSVydximG5vDrwsm623KaztyyfNcSU3fO+vVoPpQS fy2BC6hUqSq6T6fUc9GNMkCMpPXbb/RPsljdxvJWKH9XXAMa8hpeWRes0 iV7ZHoc+fkeEBaeSqUTSMwqpawx+VSQNHnlMSobBfaMIb6evKlzcLUYev VJ8oYAfaieqDEQQtItWPPl88DdYIyInuarJLjsYJ0sKk4khPWPHYBqFYc A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966459" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966459" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908742" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908742" 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; 14 May 2023 23:50:57 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 16/26] soundwire: intel_ace2x: use common helpers for bus start/stop Date: Mon, 15 May 2023 15:10:32 +0800 Message-Id: <20230515071042.2038-17-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 52B66C7EE24 for ; Mon, 15 May 2023 06:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240451AbjEOGwc (ORCPT ); Mon, 15 May 2023 02:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240454AbjEOGwK (ORCPT ); Mon, 15 May 2023 02:52:10 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D892101 for ; Sun, 14 May 2023 23:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133507; x=1715669507; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zulnEGWCaE/ce7on2AHJOrEISXuutjX2aua9tmM2yVE=; b=WT6/sr+GjCk608Rgj65IJ2nebMUTwi178AL1Kp1f0n6v2MbpwaJEP69+ D97nwjSW6Nlv1JgEVQmmxBxYIRL6AaXmG9w3DJY1CL29wkSezALDU+zg/ ugze5Gt+PwEkCGMTX7A25yAw38flW3MjVsSmFgNlc1c/f4SzpiAMtvyKV GdVyQ5RSedoL/+7HziQ1dA9j9dntWeHwi6ntCTCoO2sBRdutciErm+XTT tzlo6SYj6xo4nGji2zm7u9TfJ6+oEupsU687RI48adLWrrweIq4Kk5Smw hC5SiIA7JOdrDLBKNDHptdJ4mG4UL3jA+aIAvEioEMdFAJFOnnHaLfyZz g==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966479" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966479" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908748" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908748" 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; 14 May 2023 23:50:59 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 17/26] soundwire: intel_ace2x: enable wake support Date: Mon, 15 May 2023 15:10:33 +0800 Message-Id: <20230515071042.2038-18-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 EEDC0C77B7D for ; Mon, 15 May 2023 06:52:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240498AbjEOGwf (ORCPT ); Mon, 15 May 2023 02:52:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240298AbjEOGwL (ORCPT ); Mon, 15 May 2023 02:52:11 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7589826A1 for ; Sun, 14 May 2023 23:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133511; x=1715669511; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SbHuuXPdMaBgfOruu1bZggLsJuDVCwmXsFFke6IavfA=; b=f8nvBV/cox3pzavCbuJ3tJVc39Ag23i/StR2+B4Buw8xWX97pSjQi0/H eBfjEBJS8mZa9wvRwrXSx/I+6EtSWot73Jyhgy/QJL10u3zRDuG+kvqUe u4HHpvd//jHYaU4MfDLFTu4H6sns0fF0Q64qzMGJXfDsdMOn+nUHd/FYr ySNyGvLmLU5VXi/BVQ5WOUtjMjIEpPJopiOnJ8GE1IGxMrDs0tpDzaThH c3mFXGxEZwj50sRa0VpQzFZPPoI7IV0k0r7iXSC3PU8vr+3Exp8QOcHI/ 0lhmGta2N9Whg16ZZ+xPhuxmKlSg91hlRsNvk2MYVLz/jVQ/BWemuWeAk w==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966491" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966491" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908759" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908759" 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; 14 May 2023 23:51:01 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 18/26] soundwire: intel_ace2x: add check_cmdsync_unlocked helper Date: Mon, 15 May 2023 15:10:34 +0800 Message-Id: <20230515071042.2038-19-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 13:45:48 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 0ADEBC7EE24 for ; Mon, 15 May 2023 06:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240240AbjEOGwy (ORCPT ); Mon, 15 May 2023 02:52:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240155AbjEOGw0 (ORCPT ); Mon, 15 May 2023 02:52:26 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919C7CF for ; Sun, 14 May 2023 23:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133522; x=1715669522; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tzzjYf0orwaeoCq1YKwuJr6YmoUY5TgIK1ZLlpL2MUE=; b=eVbEupJDGvAFj9nZGf29U+K8mEsbKo3LQAdB5o3NKexwNHwuk6cYcGR0 1w74edPsabg7jitGmDqpZ/RVHZ/Biztw4B+MrHJf/x/JwX6JVzW215Mpw YuiY6T3HmUM6DEY4qHBgNCdWDckOg3/wNt/69D/IgsauNtdrAm/fKebT3 +RDkyBs1omgV2BNhV8emy6MBdMySndqxycw+IVIaN44/6MyU4Etyuh/rR BMZoa9nh9q6Pp2kzfBzjt4lTxQrFNdnIxLzEgbA+T4rCzZ4VcfJiT6Fhz wX/dBSADbJEWqHYsAGyUVYQifIa40iZANgW7QaqbNXnzcZaeSdxzKEbdQ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966503" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966503" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908767" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908767" 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; 14 May 2023 23:51:04 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 19/26] soundwire: bus: add new manager callback to deal with peripheral enumeration Date: Mon, 15 May 2023 15:10:35 +0800 Message-Id: <20230515071042.2038-20-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 338f4f0b5d0c..b44f8d0affa6 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -769,6 +769,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 13:45:48 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 D5CD8C77B75 for ; Mon, 15 May 2023 06:53:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239906AbjEOGxE (ORCPT ); Mon, 15 May 2023 02:53:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240488AbjEOGwe (ORCPT ); Mon, 15 May 2023 02:52:34 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B480272A for ; Sun, 14 May 2023 23:52:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133529; x=1715669529; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TlqOeHgkbXdW2xoR4RiQV11K0x6UxVbL1lj2WJsghI8=; b=aytix35Rc8UhIgIBHKjVwwQ+gNL3bkL4NpnK516DnVuCcXofYdJcvKLg H9yb2G8eadKzW0XMC5BoMuSZB7cNzqI2/u8rQYY/TSYqWYXrp3ktBfbly 9149z+vixYvxteeB1y/83c270oyzi7Thap4uQVYFwd+7EwJw/k8LjxfLV XWjyrkg/Z0W+E7O81PJ+jthCo2jrEetptQCXAKmJc+EweO7ZihTIuUyuS MZ7+45fMIlWLlnCKs7BBhNRbn99YnAF7u6q1vmqlmodkqR5m0nbiizjDA BokUCT2iw/exTBxOTQvCxWH1WOddTfL0s0riSH64gNTbuxd56tcmseHtD A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966520" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966520" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908776" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908776" 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; 14 May 2023 23:51:06 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 20/26] soundwire: intel_ace2x: add new_peripheral_assigned callback Date: Mon, 15 May 2023 15:10:36 +0800 Message-Id: <20230515071042.2038-21-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-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 fcdf4f2d60e3..0daa6ca9a224 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 From nobody Sun Feb 8 13:45:48 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 F398EC77B75 for ; Mon, 15 May 2023 06:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240404AbjEOGxI (ORCPT ); Mon, 15 May 2023 02:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240313AbjEOGwl (ORCPT ); Mon, 15 May 2023 02:52:41 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9D4B1A6 for ; Sun, 14 May 2023 23:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133530; x=1715669530; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dP4H8fKlSakREtkAjsQMf+bbkPa/9U74r38JynphR7o=; b=jwdIjSu91vfWInVMxJLeGaYGs2yJFvCDK3eUbiimzWAtlmcNJT57oXOu Sh0biYabg2NhxmRmMlkzV/aEDF2Kr1QpeVg1MdfRUomXfZWIPPiYPPAP/ SsB85NbI2P1JqVnw5OrSSAFRdDl+Wb4qIKoIYEUtjwct7YhrpzugpNa01 IDxWT7AJCWu8ujJnOQfuLpCIM6kbrrP9Ygfa0Tu9dCZL2aMgpAJRK42pr CzHcEsxmmTK3c32Kaq7GQ8dKxRt7sISuoea52IBlFa9IXEu8IybmX+GBp wJuzThexOGwpRkp6tkkBV7zCmWWB7IomaPCR+L3VjXjVNWzEa59fIVov9 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966535" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966535" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908779" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908779" 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; 14 May 2023 23:51:08 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 21/26] soundwire: intel_ace2x: add pre/post bank switch callbacks Date: Mon, 15 May 2023 15:10:37 +0800 Message-Id: <20230515071042.2038-22-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The .pre_ and .post_switch callbacks are mandatory. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 65deb4345354..1be0bea5f40f 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -378,6 +378,9 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .shim_check_wake =3D intel_shim_check_wake, .shim_wake =3D intel_shim_wake, =20 + .pre_bank_switch =3D intel_pre_bank_switch, + .post_bank_switch =3D intel_post_bank_switch, + .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 13:45:48 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 E4B82C77B7D for ; Mon, 15 May 2023 06:53:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240453AbjEOGxZ (ORCPT ); Mon, 15 May 2023 02:53:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240388AbjEOGw5 (ORCPT ); Mon, 15 May 2023 02:52:57 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1FAD213A for ; Sun, 14 May 2023 23:52: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=1684133546; x=1715669546; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HnNtbwiDrZNBgzzJYA3WKKwmdCK9fTg/aHcJpktUXV0=; b=NBo7hZ3ca/ingSBlOPS7/FsOE+suGQJNhHVnjrj14Nf6VbWsA4VbziDW SQH/M67C3G5RpnZFlumtZ7p09Mv+AqbwmYkG+Z0IgzT79t2IsZNaRYamS kXvlyi+HjFhIwySMWQK5FZeQUIJ7CiJgfG+4ENY5uZUwXD9US5Ow03ZNn 9eoDPZeYgVi/zu/gRyFoNYOydGBaBV8Zy9ygF7+g+DxgdKobMOKIEsVjM Nc8B1dr/70tvobSfPRtnmDQEMSYGzDp3+bGF7otcILJffsO51k2vlOdvA vPRzU7wF/e4C1LfoxQ03h/Wo2oZK1WsoFvYPfMXmx0kqFIR4KkfnTubLQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966545" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966545" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908784" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908784" 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; 14 May 2023 23:51:11 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 22/26] ASoC: SOF/soundwire: re-add substream in params_stream structure Date: Mon, 15 May 2023 15:10:38 +0800 Message-Id: <20230515071042.2038-23-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart An earlier simplification to only pass the direction is no longer suitable, all the ACE2.x HDaudio DMA management relies on access to the substream structure. This patch is an iso-functionality change, the HDaudio DMA parts will be provided separately. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 8 ++++---- include/linux/soundwire/sdw_intel.h | 2 +- sound/soc/sof/intel/hda.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 238acf5c97a9..c8eb1ec512c4 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -643,7 +643,7 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct s= dw_cdns_pdi *pdi) } =20 static int intel_params_stream(struct sdw_intel *sdw, - int stream, + struct snd_pcm_substream *substream, struct snd_soc_dai *dai, struct snd_pcm_hw_params *hw_params, int link_id, int alh_stream_id) @@ -651,7 +651,7 @@ static int intel_params_stream(struct sdw_intel *sdw, struct sdw_intel_link_res *res =3D sdw->link_res; struct sdw_intel_stream_params_data params_data; =20 - params_data.stream =3D stream; /* direction */ + params_data.substream =3D substream; params_data.dai =3D dai; params_data.hw_params =3D hw_params; params_data.link_id =3D link_id; @@ -727,7 +727,7 @@ static int intel_hw_params(struct snd_pcm_substream *su= bstream, dai_runtime->pdi =3D pdi; =20 /* Inform DSP about PDI stream number */ - ret =3D intel_params_stream(sdw, substream->stream, dai, params, + ret =3D intel_params_stream(sdw, substream, dai, params, sdw->instance, pdi->intel_alh_id); if (ret) @@ -804,7 +804,7 @@ static int intel_prepare(struct snd_pcm_substream *subs= tream, sdw_cdns_config_stream(cdns, ch, dir, dai_runtime->pdi); =20 /* Inform DSP about PDI stream number */ - ret =3D intel_params_stream(sdw, substream->stream, dai, + ret =3D intel_params_stream(sdw, substream, dai, hw_params, sdw->instance, dai_runtime->pdi->intel_alh_id); diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index 1a8f32059cd8..ccb228eebc65 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -182,7 +182,7 @@ * firmware. */ struct sdw_intel_stream_params_data { - int stream; + struct snd_pcm_substream *substream; struct snd_soc_dai *dai; struct snd_pcm_hw_params *hw_params; int link_id; diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 388e41057172..511c927b6696 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -94,7 +94,7 @@ static int sdw_params_stream(struct device *dev, struct sdw_intel_stream_params_data *params_data) { struct snd_soc_dai *d =3D params_data->dai; - struct snd_soc_dapm_widget *w =3D snd_soc_dai_get_widget(d, params_data->= stream); + struct snd_soc_dapm_widget *w =3D snd_soc_dai_get_widget(d, params_data->= substream->stream); struct snd_sof_dai_config_data data =3D { 0 }; =20 data.dai_index =3D (params_data->link_id << 8) | d->id; --=20 2.25.1 From nobody Sun Feb 8 13:45:48 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 08E90C77B7D for ; Mon, 15 May 2023 06:53:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239049AbjEOGxe (ORCPT ); Mon, 15 May 2023 02:53:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240332AbjEOGxF (ORCPT ); Mon, 15 May 2023 02:53:05 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75FDDC2 for ; Sun, 14 May 2023 23:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133554; x=1715669554; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=P4I4WMgNIQxYQ334Q+vWNS1kymuWnkPuLaU0h554R2Q=; b=aDZrahoO9qnOb+BaXAlTuzRLwfI0qVsAhDMdk3DOkMQ+zWXbiHXcvsQq M0UjSt5pC86fuXEOMggx53gb6Pk4EgpRM78Zj1b44M4yxoOG/hPurNwuf GqA5cKqbQZkktwl0ErBMj1nfwACrJtpPOzC/EdjICw7DB2mw0/NZzWTBD spg1CRZ5/jUEOuJd8anikyLzCPNlQ8CFlFywLdxfOwdUMmxt17EB9VgVR QRF+zHVySEFIL4f2/zX4z++rHar90OC1zQ/AiM+8SfVX0a+VDMD/AdqcU pwvvrBl1T1K5c4blIW3gmZsNvWnVruq43WKcypxOUPKQbNtJmbfTEZcez Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966555" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966555" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908791" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908791" 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; 14 May 2023 23:51:13 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 23/26] soundwire: intel: remove .trigger callback implementation Date: Mon, 15 May 2023 15:10:39 +0800 Message-Id: <20230515071042.2038-24-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The interface is not needed for IPC3 solutions but will be needed with an updated parameter list for ACE2.x+IPC4 combinations. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index c8eb1ec512c4..15cecd2e062d 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -872,18 +872,9 @@ static int intel_trigger(struct snd_pcm_substream *sub= stream, int cmd, struct sn { struct sdw_cdns *cdns =3D snd_soc_dai_get_drvdata(dai); struct sdw_intel *sdw =3D cdns_to_intel(cdns); - struct sdw_intel_link_res *res =3D sdw->link_res; struct sdw_cdns_dai_runtime *dai_runtime; int ret =3D 0; =20 - /* - * The .trigger callback is used to send required IPC to audio - * firmware. The .free_stream callback will still be called - * by intel_free_stream() in the TRIGGER_SUSPEND case. - */ - if (res->ops && res->ops->trigger) - res->ops->trigger(dai, cmd, substream->stream); - dai_runtime =3D cdns->dai_runtime_array[dai->id]; if (!dai_runtime) { dev_err(dai->dev, "failed to get dai runtime in %s\n", --=20 2.25.1 From nobody Sun Feb 8 13:45:48 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 5ECCEC77B7D for ; Mon, 15 May 2023 06:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239899AbjEOGxh (ORCPT ); Mon, 15 May 2023 02:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240396AbjEOGxF (ORCPT ); Mon, 15 May 2023 02:53:05 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14323272C for ; Sun, 14 May 2023 23:52:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133555; x=1715669555; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gTWQz2QeQjn75D2vv5OELRJszUtDKAo2vigeJ7CoI54=; b=XeTbCYq8S5ugbHl1ncKcdJRry9kAVdMaj7U6j+XiR3rwloSgPNBL7HFL /YXWZoZ2L+1rPUwDCJKYzORxD013HZUoOcruFhblcgv9td113QhLb0oEg JXpUf86DNexExhnWefZKnXGXeVTKTyr4QCgKISiyvgPZa3mW6dQTQINaj jGjWq+BxnpPincjwS9BCQpnRAAoQylUQyZBhd47P6eoT2BN6t/PzOBFHV I3TiJ2GFhXvhWyi19xDZ+lGelt+Nm9/BZpoiOXYzaILrQB3zFA05jK+xB HLSu/IrPEyXdw5qOhmJYcGpt8fxr5ua05sl3Ew7APcCdgQfZVBxzLIIz3 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966565" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966565" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908797" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908797" 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; 14 May 2023 23:51:15 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 24/26] soundwire: intel: use substream for .trigger callback Date: Mon, 15 May 2023 15:10:40 +0800 Message-Id: <20230515071042.2038-25-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The interface is not needed for IPC3 but will be needed for ACE2.x+IPC4 combinations, with the substream information passed as a parameter. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- include/linux/soundwire/sdw_intel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index ccb228eebc65..9bd6885ee34d 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -209,7 +209,7 @@ struct sdw_intel_ops { struct sdw_intel_stream_params_data *params_data); int (*free_stream)(struct device *dev, struct sdw_intel_stream_free_data *free_data); - int (*trigger)(struct snd_soc_dai *dai, int cmd, int stream); + int (*trigger)(struct snd_pcm_substream *substream, int cmd, struct snd_s= oc_dai *dai); }; =20 /** --=20 2.25.1 From nobody Sun Feb 8 13:45:48 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 ED596C77B7D for ; Mon, 15 May 2023 06:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240328AbjEOGyN (ORCPT ); Mon, 15 May 2023 02:54:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240483AbjEOGxV (ORCPT ); Mon, 15 May 2023 02:53:21 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83E3C199F for ; Sun, 14 May 2023 23:52: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=1684133573; x=1715669573; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7HU4GkkFBUz3CDwO3kK4aBa3k7/H20TmG32LVN6IOSQ=; b=edVJDUa+ozApmZ2dERc0R4BRi5Dt1XdVlwX2sVzxniuvnZxz22mHFQcR eaO+BQo8T0SvTULrLvUdwTGM/R5bKDmVYXC31uUgLZ3bcf46rsHw/ngBx 0txhXo39e4JKwuZSfoNGr5sIxS3Zl37a52VTwUbxVCYnmX4DF/dEqKPsj TujTdq4fzbyhqlAbGmEF653wdhmEM05Vm/TDL+McVVefmKXPypHNHnDip hTARD7cd1QXtgQaePgxc3PIQSNvJ5zUCSSIt0qcIh8UhiobPKSb2MmG2U qUC5zYjLNheuMWrkyUxlKYEwKcPESDu8TJRIyqp/rTV1fV+XcBErNFL5p A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966573" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966573" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908802" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908802" 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; 14 May 2023 23:51:18 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 25/26] soundwire: intel: remove .free callback implementation Date: Mon, 15 May 2023 15:10:41 +0800 Message-Id: <20230515071042.2038-26-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The interface is not needed for IPC3 solution but will be needed with an updated parameter list for ACE2.x+IPC4 combinations. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 15cecd2e062d..f52167aa48db 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -663,25 +663,6 @@ static int intel_params_stream(struct sdw_intel *sdw, return -EIO; } =20 -static int intel_free_stream(struct sdw_intel *sdw, - int stream, - struct snd_soc_dai *dai, - int link_id) -{ - struct sdw_intel_link_res *res =3D sdw->link_res; - struct sdw_intel_stream_free_data free_data; - - free_data.stream =3D stream; /* direction */ - free_data.dai =3D dai; - free_data.link_id =3D link_id; - - if (res->ops && res->ops->free_stream && res->dev) - return res->ops->free_stream(res->dev, - &free_data); - - return 0; -} - /* * DAI routines */ @@ -817,7 +798,6 @@ static int intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct sdw_cdns *cdns =3D snd_soc_dai_get_drvdata(dai); - struct sdw_intel *sdw =3D cdns_to_intel(cdns); struct sdw_cdns_dai_runtime *dai_runtime; int ret; =20 @@ -838,12 +818,6 @@ intel_hw_free(struct snd_pcm_substream *substream, str= uct snd_soc_dai *dai) return ret; } =20 - ret =3D intel_free_stream(sdw, substream->stream, dai, sdw->instance); - if (ret < 0) { - dev_err(dai->dev, "intel_free_stream: failed %d\n", ret); - return ret; - } - dai_runtime->pdi =3D NULL; =20 return 0; @@ -871,7 +845,6 @@ static void *intel_get_sdw_stream(struct snd_soc_dai *d= ai, static int intel_trigger(struct snd_pcm_substream *substream, int cmd, str= uct snd_soc_dai *dai) { struct sdw_cdns *cdns =3D snd_soc_dai_get_drvdata(dai); - struct sdw_intel *sdw =3D cdns_to_intel(cdns); struct sdw_cdns_dai_runtime *dai_runtime; int ret =3D 0; =20 @@ -894,7 +867,6 @@ static int intel_trigger(struct snd_pcm_substream *subs= tream, int cmd, struct sn =20 dai_runtime->suspended =3D true; =20 - ret =3D intel_free_stream(sdw, substream->stream, dai, sdw->instance); break; =20 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: @@ -940,9 +912,7 @@ static int intel_component_dais_suspend(struct snd_soc_= component *component) */ for_each_component_dais(component, dai) { struct sdw_cdns *cdns =3D snd_soc_dai_get_drvdata(dai); - struct sdw_intel *sdw =3D cdns_to_intel(cdns); struct sdw_cdns_dai_runtime *dai_runtime; - int ret; =20 dai_runtime =3D cdns->dai_runtime_array[dai->id]; =20 @@ -952,13 +922,8 @@ static int intel_component_dais_suspend(struct snd_soc= _component *component) if (dai_runtime->suspended) continue; =20 - if (dai_runtime->paused) { + if (dai_runtime->paused) dai_runtime->suspended =3D true; - - ret =3D intel_free_stream(sdw, dai_runtime->direction, dai, sdw->instan= ce); - if (ret < 0) - return ret; - } } =20 return 0; --=20 2.25.1 From nobody Sun Feb 8 13:45:48 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 C77D2C77B75 for ; Mon, 15 May 2023 06:54:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240449AbjEOGyT (ORCPT ); Mon, 15 May 2023 02:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240357AbjEOGxd (ORCPT ); Mon, 15 May 2023 02:53:33 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF1092D44 for ; Sun, 14 May 2023 23:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133580; x=1715669580; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QYZAt1KxA3N+7/ATQML8jtFQmvmyxEPDPbTILteD9jY=; b=HiBHaOit5S2w0qS3Oi90tDLT5TXhL+F3Pxc713JrW8y6Lv6PEV+RN6Fg YKHVKPFBWSqNeETiMlN0JDz0p7kJnz4SIAXWxbG6StexiXCjeDLtb4B7x 3gL6GUe9PanLau7YyBEP/BJwC2wAqKnMD5+422uwZPXcdvT4pRhE1fC4P eheCb2l60HOoKleCeAB/euAOmF8Q/CBC3EBcFYMR87GaJ1O0wo59GAJcL v7G8rE86/dNuIrpTEJuN5QMP8X/jeQSlsT89A2nADcXjD7E8t89KJbodn ID/362MC6Tqgk+MbziNNkrm9A1W21n/9YaXWODDhxAeOX4igwvwm21wdU A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966586" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966586" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908807" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908807" 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; 14 May 2023 23:51:20 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 26/26] soundwire: intel: use substream for .free callback Date: Mon, 15 May 2023 15:10:42 +0800 Message-Id: <20230515071042.2038-27-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The interface is not needed for IPC3 but will be needed for ACE2.x+IPC4 combinations, with the substream information passed as a parameter. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- include/linux/soundwire/sdw_intel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index 9bd6885ee34d..11fc88fb0d78 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -195,7 +195,7 @@ struct sdw_intel_stream_params_data { * firmware. */ struct sdw_intel_stream_free_data { - int stream; + struct snd_pcm_substream *substream; struct snd_soc_dai *dai; int link_id; }; --=20 2.25.1