From patchwork Wed Jan 22 17:54:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947581 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ABE9214802 for ; Wed, 22 Jan 2025 17:40:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567644; cv=none; b=gBXoLpBPJTv2juWDDK1j4iVWSPBDX4jLWUKGp0kBCZByTrLz4Sf3AYnEegP5uqhJswGKFn0r0RNkOObZ/CCy/V3AiMhev3kyLE0Fm3KDCxJB13RzlzjwSG9/2UwWJtwAKuKq/pLtBtoukkzKuJDS+7DB+84tzo+EJvy2ttKEsDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567644; c=relaxed/simple; bh=PqG3ZBpKC7whP9e1RnMw4SJw/XVO/fWuN3obFwVNTV4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pY2voK8mXh5l6ohre0SNnpZF1irIlZNvTpeTInhXs6T6QIqRutkjbofTI/c+Jx8P52gMftGVwhT8NjYJgqk+SnZNvZUYxISYd6vmQKtargNIBBfCljYifrCP+Ui1vHdJPfUywptosW/PFaHZse93piO2WNFlFd4AgNj3GGXC5Yc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=m62QszPp; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="m62QszPp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567643; x=1769103643; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PqG3ZBpKC7whP9e1RnMw4SJw/XVO/fWuN3obFwVNTV4=; b=m62QszPpBYwItnZ9F2l0kZ/224PcwLYT9Mu3H2XsDbpCrxtXshRrE0bD qyMFL28mEuQ4pN9X61zHflY7GomVJk+SBfkHI/K6XKgXCwwgH6+v8Pn81 Lm9itkLhN4ePsVSTMg2mkJ731TCgxWIuZsziOl+7Y6ar0BSA5FMS5Wn7D BKOWmGJ8895IrRMC/GRzX/1rOsiiUs0JgvvHSEaXiDMaaQcBFpK9HAYON sOl/GV63yT/uChfeLP9a2zYEas1oKYPgxhtBf5qkHWJ7udb0uKU11zSoz ovPcgTBRPBS2mbL8g/62TWzn0NP4ZRzqMcut4cyDk2sbA0AAl3NLMAUVl g==; X-CSE-ConnectionGUID: HJ5wA6KsQhydjmyiWco1cg== X-CSE-MsgGUID: MOVORIanRfm3kV4HqUsciw== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434721" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434721" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:40:42 -0800 X-CSE-ConnectionGUID: JUVhB2q5SCGTSf43E9iO3w== X-CSE-MsgGUID: ORbyResxS+6g0J+Laz6Y8Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185205" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:40:40 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 01/11] ASoC: codecs: pcm3168a: Add ACPI match table Date: Wed, 22 Jan 2025 18:54:16 +0100 Message-Id: <20250122175426.1369059-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Support ACPI-based systems by adding relevant match table. Signed-off-by: Cezary Rojewski --- sound/soc/codecs/pcm3168a-i2c.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/soc/codecs/pcm3168a-i2c.c b/sound/soc/codecs/pcm3168a-i2c.c index 7052cc0c97d1..4da608ba514d 100644 --- a/sound/soc/codecs/pcm3168a-i2c.c +++ b/sound/soc/codecs/pcm3168a-i2c.c @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -37,6 +38,13 @@ static const struct i2c_device_id pcm3168a_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, pcm3168a_i2c_id); +static const struct acpi_device_id pcm3168a_acpi_match[] = { + { "PCM3168A" }, + { "104C3168" }, + {} +}; +MODULE_DEVICE_TABLE(acpi, pcm3168a_acpi_match); + static const struct of_device_id pcm3168a_of_match[] = { { .compatible = "ti,pcm3168a", }, { } @@ -49,6 +57,7 @@ static struct i2c_driver pcm3168a_i2c_driver = { .id_table = pcm3168a_i2c_id, .driver = { .name = "pcm3168a", + .acpi_match_table = pcm3168a_acpi_match, .of_match_table = pcm3168a_of_match, .pm = &pcm3168a_pm_ops, }, From patchwork Wed Jan 22 17:54:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947582 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8249214802 for ; Wed, 22 Jan 2025 17:40:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567646; cv=none; b=dLeRRXTjtCst/wgFctcTDM0URPu8Nxl1AUTbQzNdfHT3i+MGUFCxVZk78PUonRTIrrI0iz77dirsyWcAYgU8bvkKzuaRlApFFmN72bTS3G7LyB4Hk9cqNuleeUpbLt4z8W+qkUI4gF58gwpGxQdKYkN1H7CcebEO3iaue/wYgoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567646; c=relaxed/simple; bh=2HwFycZ0Oc3hA3qSQszAwsZKRAtBO7XsKQ2hvXcJvJ4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mv5qISZkBdZDsIlK3x8nMZcrqjZL6mF2DocGaRVrrzl5UajuyUvLNUwG1j+Y8IEmtgL+X7UAKyMyYSik3UtZOtS0KLhmY2o8lZCHRM/YxtI4W7M3i1vS5pbBZ5Ps4tJUK1oGgNLTZYaftMrk+MiwoJrP4u0x+Kpn12wlzG2I0yA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KGJXu0Io; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KGJXu0Io" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567645; x=1769103645; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2HwFycZ0Oc3hA3qSQszAwsZKRAtBO7XsKQ2hvXcJvJ4=; b=KGJXu0IoUxD0yfRJyUM17If2qaFCGjIhNQhlEKU1eRpC7TiqaKX2jsdl h0e6ACuji8rAEK4p7lURyf8aYQf3whwWHgnDQnztZ7q1WfycF//kFmr+E MPDmrZXBU0E3W2rRw5spA0wqY4/VfXL59TRcElNhvZkO+K8uhOTxJH2a3 Ck6WAtZineNooVCvU9EOxeNKq39SHACvyg4+vs0zKJsCCeXFvgKSn/aaI gDsc/NTCdErQjSsVhRjkJCo6+sQNZzLYJY+qJPmFV5JPUXYgh5dKzDzAi pk797R47Wlf5EK5ZS1gkAs6PHdxKdye+mRTSMzD/RO1A0vmVbnIMdOP5W g==; X-CSE-ConnectionGUID: eCm8eqmkSEyU8VyZeqsD4g== X-CSE-MsgGUID: oH6jD9JPSPaviITBhm/d0A== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434727" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434727" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:40:45 -0800 X-CSE-ConnectionGUID: 6E6PtgXeQdWBw9zWbAInuQ== X-CSE-MsgGUID: w3DiygyVRW6WtAEhKNzawg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185235" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:40:42 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 02/11] ASoC: codecs: pcm3168a: Relax probing conditions Date: Wed, 22 Jan 2025 18:54:17 +0100 Message-Id: <20250122175426.1369059-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On ACPI-based systems with Intel MalibouLake there is no "scki" clock entry defined. Make that initialization part optional and default to 24.576 MHz rate if not set. The rate is the default for both TI and Intel devices. Signed-off-by: Cezary Rojewski --- sound/soc/codecs/pcm3168a.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/pcm3168a.c b/sound/soc/codecs/pcm3168a.c index fac0617ab95b..43c0cb5e538e 100644 --- a/sound/soc/codecs/pcm3168a.c +++ b/sound/soc/codecs/pcm3168a.c @@ -743,7 +743,7 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) return dev_err_probe(dev, PTR_ERR(pcm3168a->gpio_rst), "failed to acquire RST gpio\n"); - pcm3168a->scki = devm_clk_get(dev, "scki"); + pcm3168a->scki = devm_clk_get_optional(dev, "scki"); if (IS_ERR(pcm3168a->scki)) return dev_err_probe(dev, PTR_ERR(pcm3168a->scki), "failed to acquire clock 'scki'\n"); @@ -755,6 +755,9 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) } pcm3168a->sysclk = clk_get_rate(pcm3168a->scki); + /* Fallback to the default if no clk entry available. */ + if (!pcm3168a->sysclk) + pcm3168a->sysclk = 24576000; for (i = 0; i < ARRAY_SIZE(pcm3168a->supplies); i++) pcm3168a->supplies[i].supply = pcm3168a_supply_names[i]; From patchwork Wed Jan 22 17:54:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947583 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F8DE214802 for ; Wed, 22 Jan 2025 17:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567648; cv=none; b=TEcmjOir45+yziuDWyYozypIrwRGBErFeLYYS1V7WBBEnQcTDAi/mTl6E6f1RF+LuFis+LtIt34nZETHXPa+JR3R3BHdy1sVZ+VNORB/YR70l3BO/XbNot6qszqu0Fy5gKKh0j7hxriA1gnPPk0AOEy2nqmS1tmb9/lRynrcD4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567648; c=relaxed/simple; bh=MJXmrdwNrmvQEeN+W+ekUyJcmdDLNGrGao1tIPCPey0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ohQgp3ItXpSWxQ3MxJwk9hy0IYVWeaZz6TJAQ1mlNRTYJG7VaUIHLjGRkurZfK10LimPW8w5wmH/mKJiL+SC+34FxPGJVVTUfgdHa02Xoc3bPzhI+mKAhPpVvYuPZRjMcj9j3HoMq/9be4w7NTCE/QJgVyu3mR7zz6No+1csHjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UWdE03F0; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UWdE03F0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567647; x=1769103647; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MJXmrdwNrmvQEeN+W+ekUyJcmdDLNGrGao1tIPCPey0=; b=UWdE03F0PHb03EZjx2i4o1DNInkt2ISk67YsLnt+KrQkzMrdn5qiWfY8 W3vztozlgEPP+Fytac4j2ecOcAEDNGvLw4Y2WQJdeKtIaGsQfxwIRi2IC BCBfU8quk+rO3JYG6ZQ1c59fw7b9b9xELIvnB4GfT6TQLCIw0VbBN6HEZ X/KNZeXRzDbPAuqI6HYBAnmDzvLFePKOJtyol3+Z0KM5ulyBDjaazLAi0 UUmz1JpSo8JLFT/+igCtsogbdRLqfJQglw0mVsYDSDIXeFf85L0fN+dLn WCBvle2VEiJHNv/aOWHIykFOQosIfyT/N+oVYnc4kq/1HOgo5EF49puTq Q==; X-CSE-ConnectionGUID: q5Qxc2PeRXqDl0Q+N9tpqA== X-CSE-MsgGUID: DBGd7Z++RjamSNX+Qx3EHw== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434733" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434733" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:40:47 -0800 X-CSE-ConnectionGUID: rKAQQHolTAqLgU07mFlRCQ== X-CSE-MsgGUID: ZRvuytQTQQWwaItw0OExXQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185254" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:40:45 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 03/11] ASoC: codecs: pcm3168a: Allow for 24-bit in provider mode Date: Wed, 22 Jan 2025 18:54:18 +0100 Message-Id: <20250122175426.1369059-4-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As per codec device specification, 24-bit is allowed in provider mode. Update the code to reflect that. Signed-off-by: Cezary Rojewski --- sound/soc/codecs/pcm3168a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/pcm3168a.c b/sound/soc/codecs/pcm3168a.c index 43c0cb5e538e..df6836a652ef 100644 --- a/sound/soc/codecs/pcm3168a.c +++ b/sound/soc/codecs/pcm3168a.c @@ -493,9 +493,9 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream, } break; case 24: - if (provider_mode || (format == SND_SOC_DAIFMT_DSP_A) || - (format == SND_SOC_DAIFMT_DSP_B)) { - dev_err(component->dev, "24-bit slots not supported in provider mode, or consumer mode using DSP\n"); + if (!provider_mode && ((format == SND_SOC_DAIFMT_DSP_A) || + (format == SND_SOC_DAIFMT_DSP_B))) { + dev_err(component->dev, "24-bit slots not supported in consumer mode using DSP\n"); return -EINVAL; } break; From patchwork Wed Jan 22 17:54:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947584 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2A75214802 for ; Wed, 22 Jan 2025 17:40:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567651; cv=none; b=XbUPO763wlM0chNO7ro5t5UK8QRJOrrQaztpBpGHVdc4vT2ZJY08ixRiylyGR8x4MblhoHQJRFJBQiffxBVyAk/V1ynU4MRUGxDrwaYb6XPwcx7XZrfb328Ic56HnnLVnHgYxmX7KYMJC/ns/Pd8beEZUZCHyQ8ogYDX/RIjR28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567651; c=relaxed/simple; bh=al2ZSdd43HJiM8vEjAjWDLTR8k7lH1ydqgzofjuLmOk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RJ7xi4bq2Sia/zFsCoDn2nZTakNjq3F41t2xXCG4GGyxobKONqRjSK5f8VVs1XnMjX0pnDJU1YomJQXKoHzHSSLmz8A+s0E450qIjQpeI3gndMtFHp1xsuYHeOtawWJcIqu4LMyjcuur6bDXVBwz9EOE43xdWBHlqGh49QxQILY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QUEOCvQv; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QUEOCvQv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567650; x=1769103650; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=al2ZSdd43HJiM8vEjAjWDLTR8k7lH1ydqgzofjuLmOk=; b=QUEOCvQvpD4+yXtliuKWaBiQVaP62UhvcK/NzcpEAaD7aMT6pab8R0we hO7MH9N6dxPUUZY+Zde4U2FjLJFn4jXmxM8yARpTrXcw1YZ1P03IPkr/k Tf3rFxzXfvC5SyVFQcrtZnQFe7UpqMQEvBzGZxIwnVDk/Rmyf/le/5LKA u82cMePrMm04iOC5Bpxevb/7EZ/8T4q0vjxrgkWPr+FNuxhfK2avQsh5W GDdZ9KD5d85Gi3HpMsMlgnPb/TnIKJN8IxVMrEIOD00P8QE+Ebw1FPapw IUOPsf4jD2kWTPudZUHxq2SahiKBtXJQ0TgrGGptZDZm18Em+QrRXVIeb w==; X-CSE-ConnectionGUID: KpJ7ue1mTZWMjDk+o9CkVQ== X-CSE-MsgGUID: 3UOHQIlVSbOiXs+8a0Udnw== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434739" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434739" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:40:50 -0800 X-CSE-ConnectionGUID: k+Y4BZuSTcaikFEe/nwXSA== X-CSE-MsgGUID: H82RdEqdQXSPRTArdY2DPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185260" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:40:47 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 04/11] ASoC: Intel: avs: Add pcm3168a machine board Date: Wed, 22 Jan 2025 18:54:19 +0100 Message-Id: <20250122175426.1369059-5-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To support AVS-pcm3168a configuration add machine board connecting AVS platform component driver with pcm3168a codec one. Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/Kconfig | 10 ++ sound/soc/intel/avs/boards/Makefile | 2 + sound/soc/intel/avs/boards/pcm3168a.c | 162 ++++++++++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 sound/soc/intel/avs/boards/pcm3168a.c diff --git a/sound/soc/intel/avs/boards/Kconfig b/sound/soc/intel/avs/boards/Kconfig index 00b0f6c176d6..ba4bee42124c 100644 --- a/sound/soc/intel/avs/boards/Kconfig +++ b/sound/soc/intel/avs/boards/Kconfig @@ -87,6 +87,16 @@ config SND_SOC_INTEL_AVS_MACH_NAU8825 Say Y or m if you have such a device. This is a recommended option. If unsure select "N". +config SND_SOC_INTEL_AVS_MACH_PCM3168A + tristate "pcm3168a I2S board" + depends on I2C + depends on MFD_INTEL_LPSS || COMPILE_TEST + select SND_SOC_PCM3168A_I2C + help + This adds support for AVS with PCM3168A I2C codec configuration. + Say Y or m if you have such a device. This is a recommended option. + If unsure select "N". + config SND_SOC_INTEL_AVS_MACH_PROBE tristate "Probing (data) board" depends on DEBUG_FS diff --git a/sound/soc/intel/avs/boards/Makefile b/sound/soc/intel/avs/boards/Makefile index 4fbd936ffb3e..a95256b94dc8 100644 --- a/sound/soc/intel/avs/boards/Makefile +++ b/sound/soc/intel/avs/boards/Makefile @@ -9,6 +9,7 @@ snd-soc-avs-max98927-y := max98927.o snd-soc-avs-max98357a-y := max98357a.o snd-soc-avs-max98373-y := max98373.o snd-soc-avs-nau8825-y := nau8825.o +snd-soc-avs-pcm3168a-y := pcm3168a.o snd-soc-avs-probe-y := probe.o snd-soc-avs-rt274-y := rt274.o snd-soc-avs-rt286-y := rt286.o @@ -27,6 +28,7 @@ obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98927) += snd-soc-avs-max98927.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98357A) += snd-soc-avs-max98357a.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98373) += snd-soc-avs-max98373.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_NAU8825) += snd-soc-avs-nau8825.o +obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_PCM3168A) += snd-soc-avs-pcm3168a.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_PROBE) += snd-soc-avs-probe.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o diff --git a/sound/soc/intel/avs/boards/pcm3168a.c b/sound/soc/intel/avs/boards/pcm3168a.c new file mode 100644 index 000000000000..ec6fb736d228 --- /dev/null +++ b/sound/soc/intel/avs/boards/pcm3168a.c @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// Copyright(c) 2024-2025 Intel Corporation +// +// Author: Cezary Rojewski +// + +#include +#include +#include +#include +#include +#include + +static const struct snd_soc_dapm_widget card_widgets[] = { + SND_SOC_DAPM_HP("CPB Stereo HP 1", NULL), + SND_SOC_DAPM_HP("CPB Stereo HP 2", NULL), + SND_SOC_DAPM_HP("CPB Stereo HP 3", NULL), + SND_SOC_DAPM_LINE("CPB Line Out", NULL), + SND_SOC_DAPM_MIC("CPB Stereo Mic 1", NULL), + SND_SOC_DAPM_MIC("CPB Stereo Mic 2", NULL), + SND_SOC_DAPM_LINE("CPB Line In", NULL), +}; + +static const struct snd_soc_dapm_route card_routes[] = { + { "CPB Stereo HP 1", NULL, "AOUT1L" }, + { "CPB Stereo HP 1", NULL, "AOUT1R" }, + { "CPB Stereo HP 2", NULL, "AOUT2L" }, + { "CPB Stereo HP 2", NULL, "AOUT2R" }, + { "CPB Stereo HP 3", NULL, "AOUT3L" }, + { "CPB Stereo HP 3", NULL, "AOUT3R" }, + { "CPB Line Out", NULL, "AOUT4L" }, + { "CPB Line Out", NULL, "AOUT4R" }, + + { "AIN1L", NULL, "CPB Stereo Mic 1" }, + { "AIN1R", NULL, "CPB Stereo Mic 1" }, + { "AIN2L", NULL, "CPB Stereo Mic 2" }, + { "AIN2R", NULL, "CPB Stereo Mic 2" }, + { "AIN3L", NULL, "CPB Line In" }, + { "AIN3R", NULL, "CPB Line In" }, +}; + +static int avs_pcm3168a_be_fixup(struct snd_soc_pcm_runtime *runtime, + struct snd_pcm_hw_params *params) +{ + struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); + + /* Set SSP to 24 bit. */ + snd_mask_none(fmt); + snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE); + + return 0; +} + +static int avs_pcm3168a_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); + int ret; + + ret = snd_soc_dai_set_sysclk(codec_dai, 0, 24576000, SND_SOC_CLOCK_IN); + if (ret < 0) + dev_err(rtd->dev, "Set codec sysclk failed: %d\n", ret); + + return ret; +} + +static const struct snd_soc_ops avs_pcm3168a_ops = { + .hw_params = avs_pcm3168a_hw_params, +}; + +SND_SOC_DAILINK_DEF(pcm3168a_dac, + DAILINK_COMP_ARRAY(COMP_CODEC("i2c-PCM3168A:00", "pcm3168a-dac"))); +SND_SOC_DAILINK_DEF(pcm3168a_adc, + DAILINK_COMP_ARRAY(COMP_CODEC("i2c-PCM3168A:00", "pcm3168a-adc"))); +SND_SOC_DAILINK_DEF(cpu_ssp0, DAILINK_COMP_ARRAY(COMP_CPU("SSP0 Pin"))); +SND_SOC_DAILINK_DEF(cpu_ssp2, DAILINK_COMP_ARRAY(COMP_CPU("SSP2 Pin"))); + +static int avs_create_dai_links(struct device *dev, struct snd_soc_dai_link **links, int *num_links) +{ + struct snd_soc_dai_link_component *platform; + struct snd_soc_dai_link *dl; + const int num_dl = 2; + + dl = devm_kcalloc(dev, num_dl, sizeof(*dl), GFP_KERNEL); + platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + if (!dl || !platform) + return -ENOMEM; + + platform->name = dev_name(dev); + dl[0].num_cpus = 1; + dl[0].num_codecs = 1; + dl[0].platforms = platform; + dl[0].num_platforms = 1; + dl[0].dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + dl[0].be_hw_params_fixup = avs_pcm3168a_be_fixup; + dl[0].nonatomic = 1; + dl[0].no_pcm = 1; + memcpy(&dl[1], &dl[0], sizeof(*dl)); + + dl[0].name = "SSP0-Codec-dac"; + dl[0].cpus = cpu_ssp0; + dl[0].codecs = pcm3168a_dac; + dl[0].playback_only = 1; + dl[1].name = "SSP2-Codec-adc"; + dl[1].cpus = cpu_ssp2; + dl[1].codecs = pcm3168a_adc; + dl[1].capture_only = 1; + + *links = dl; + *num_links = num_dl; + return 0; +} + +static int avs_pcm3168a_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct snd_soc_card *card; + int ret; + + card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + if (!card) + return -ENOMEM; + + ret = avs_create_dai_links(dev, &card->dai_link, &card->num_links); + if (ret) + return ret; + + card->name = "avs_pcm3168a"; + card->dev = dev; + card->owner = THIS_MODULE; + card->dapm_widgets = card_widgets; + card->num_dapm_widgets = ARRAY_SIZE(card_widgets); + card->dapm_routes = card_routes; + card->num_dapm_routes = ARRAY_SIZE(card_routes); + card->fully_routed = true; + + return devm_snd_soc_register_card(dev, card); +} + +static const struct platform_device_id avs_pcm3168a_driver_ids[] = { + { + .name = "avs_pcm3168a", + }, + {}, +}; +MODULE_DEVICE_TABLE(platform, avs_pcm3168a_driver_ids); + +static struct platform_driver avs_pcm3168a_driver = { + .probe = avs_pcm3168a_probe, + .driver = { + .name = "avs_pcm3168a", + .pm = &snd_soc_pm_ops, + }, + .id_table = avs_pcm3168a_driver_ids, +}; + +module_platform_driver(avs_pcm3168a_driver); + +MODULE_AUTHOR("Cezary Rojewski "); +MODULE_LICENSE("GPL"); From patchwork Wed Jan 22 17:54:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947585 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DCAD214802 for ; Wed, 22 Jan 2025 17:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567653; cv=none; b=UfZ2n8D8/8zypn4tufc3arXyUcPjspJKIjUrxX5dnpUoFVQcpF2FzrmAvpc59+V0oO5dfRH6XbK39L6JelEpZ7wfRCJ7Jj7eqbOTNdMXFeOETHktj284K6oG+cY+GEeTrWSASc2prk8bs8fH/01L8FHCLiSIKI8ouWttOcvvu+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567653; c=relaxed/simple; bh=Q2tTV+81G4/MIjWZ/sbni7M/iC9q+LSXApJ+OP1JbQ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r64tSmItLJukSG+bXHc1Jedv1w/YPddARd8Id718e70u9xRWn71mNKGXDpyzkM4vZEq6AVs/2K/TZ9r9NRQ6nZsOF4xAFs4zK4VCisYLYAu4BdzDNeGpo+3Q3pZNrcO5Cceq923jSDZgNAPzvUZ4+8aBAfi78TxmPKyK5/MvRnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QNFxvw0k; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QNFxvw0k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567652; x=1769103652; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q2tTV+81G4/MIjWZ/sbni7M/iC9q+LSXApJ+OP1JbQ0=; b=QNFxvw0k2+8oGIySngkLQXnwqpytlsZ9JiE78R5Tx8P8OpogvT5xDyt0 drfwVjSJ0z1Y5csIqCcG3OOplQLeEKuAnR/wUxG9XIEEdWYTKIwDmwjCe 1agwNNcfAMqqwyB1gWNTVZpUIIlFSr+v0SdIffWl411jCY5xqdNERsKnK EXjg4guwEzKAdK9VgW1vw2TsogsdpiR6AfHYJH8CL8mx9STHetBKgtqye iG1+koH/3YW4YAu5nfezrbt3nbDQGSy+EU/QtioJwFBncA9sc7ZWTvaQp 3axJn3fyJR4nE58f2QpCwTIvYstk0KaZDWZn8ZE7hs7Oagi/59sL2frZn A==; X-CSE-ConnectionGUID: AFt5ZPqKR6y3PPixaIq9Rw== X-CSE-MsgGUID: 89nQuuuoShOSOYdNDxK7Bw== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434744" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434744" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:40:52 -0800 X-CSE-ConnectionGUID: h3297QIvQhm6wOrjYAYn3A== X-CSE-MsgGUID: mQMaJq4ORHO4uLn9y1/Ucw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185272" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:40:50 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 05/11] ASoC: Intel: avs: pcm3168a board selection Date: Wed, 22 Jan 2025 18:54:20 +0100 Message-Id: <20250122175426.1369059-6-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Populate board table with avs_pcm3168a machine driver for RPL-M-based and ADL-N-based platforms with pcm3168a codec onboard to allow the sound card to enumerate. While at it, drop comma the terminator entries to align with the coding standard. Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/board_selection.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c index 0266edeafc19..2d706edcbf92 100644 --- a/sound/soc/intel/avs/board_selection.c +++ b/sound/soc/intel/avs/board_selection.c @@ -312,6 +312,18 @@ static struct snd_soc_acpi_mach avs_tgl_i2s_machines[] = { {}, }; +static struct snd_soc_acpi_mach avs_mbl_i2s_machines[] = { + { + .id = "PCM3168A", + .drv_name = "avs_pcm3168a", + .mach_params = { + .i2s_link_mask = AVS_SSP(0) | AVS_SSP(2), + }, + .tplg_filename = "pcm3168a-tplg.bin", + }, + {} +}; + static struct snd_soc_acpi_mach avs_test_i2s_machines[] = { { .drv_name = "avs_i2s_test", @@ -378,10 +390,11 @@ static const struct avs_acpi_boards i2s_boards[] = { AVS_MACH_ENTRY(HDA_ICL_LP, avs_icl_i2s_machines), AVS_MACH_ENTRY(HDA_TGL_LP, avs_tgl_i2s_machines), AVS_MACH_ENTRY(HDA_EHL_0, avs_tgl_i2s_machines), + AVS_MACH_ENTRY(HDA_ADL_N, avs_mbl_i2s_machines), AVS_MACH_ENTRY(HDA_ADL_P, avs_tgl_i2s_machines), AVS_MACH_ENTRY(HDA_RPL_P_0, avs_tgl_i2s_machines), - AVS_MACH_ENTRY(HDA_RPL_M, avs_tgl_i2s_machines), - {}, + AVS_MACH_ENTRY(HDA_RPL_M, avs_mbl_i2s_machines), + {} }; static const struct avs_acpi_boards *avs_get_i2s_boards(struct avs_dev *adev) From patchwork Wed Jan 22 17:54:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947586 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F85B214802 for ; Wed, 22 Jan 2025 17:40:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567656; cv=none; b=GaxkNroTIV+KVhcGMGok+whDeeOYBIr9UoVwowDisaiZP4xKFW+CEbg/H+o4HrqWHu1QbG+irGM6CS919GZ9q1TqEOArTXKYzDGYfm5WnfRfNOKqRC8Y9ZU3/nEcfMCzug7NY5gDErxCZLo0TGGKb538d4iyKda8llectpdJIXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567656; c=relaxed/simple; bh=WW8ypsnsHeYCqNbh1BRe3q9h4avF+3PZbincjq4qkBg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l93nEis31PbnfbeosWlYy8yOG3yoVYYbxxCvkiFJgbhNHOLJvuhex5d3f0biGshWYU5YQZOEFpc2+6bzLd/HNy+5MvvFq5ZIl7ZqYAA92dY+Sld5YB2iifJRFTD4Wmkqy6c6cA+NKQScoaEqKTQepQo43afm5E+MBi8Db/CLxNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=f1QIWvgR; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="f1QIWvgR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567655; x=1769103655; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WW8ypsnsHeYCqNbh1BRe3q9h4avF+3PZbincjq4qkBg=; b=f1QIWvgRdjsdM7ACapIgpfOgQixPrhAf3SJ9mHP4OTnUwsuJkgmMXfl+ q/+PugWLIUJ9gj0tPNIargrUKpTqI0CiCgZIaBBg4P/lbr7Xs27Nheq8Q Ikriuqz19naJCLzO5pXaORJekYRdSx2hBDMUuPlY2ISuYw8Wj8LNlKm3+ asxVsg96s/H+k+btPnrx2+5MtqnNB2RVArzYk/Soj9aWKkmTgP6YmgL21 Lizl7PuvezfKYzieP8WexCiNPodqC9TBYKiqGc/4ZbOEHXhTxqqQETuFt fJMvRrPzxM54Jz5XvI9q6CG7KzeB4mf2aJRHPwIlIUMxytRSv6kmc1rtw g==; X-CSE-ConnectionGUID: +olp5/qMQASgUXDL2Y0CYQ== X-CSE-MsgGUID: yTEtNWsXT6m/zlHZoTSmvQ== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434756" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434756" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:40:54 -0800 X-CSE-ConnectionGUID: VCTfTMqwSTWeNp5hXBAusw== X-CSE-MsgGUID: QanhuVowQ4+al9mMSt8A/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185305" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:40:52 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 06/11] ASoC: Intel: avs: Move DSP-boot steps into individual functions Date: Wed, 22 Jan 2025 18:54:21 +0100 Message-Id: <20250122175426.1369059-7-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To make DSP-boot code more readable, move each logical step into an individual function and add the configure step which will be utilized by follow up changes. To summarize, the steps are: loading the firmware code, configuring the base firmware and, allocating driver resources based on FW and HW capabilities. Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/avs.h | 1 + sound/soc/intel/avs/loader.c | 64 ++++++++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h index eca6ec0428bb..585543f872fc 100644 --- a/sound/soc/intel/avs/avs.h +++ b/sound/soc/intel/avs/avs.h @@ -51,6 +51,7 @@ struct avs_dsp_ops { int (* const load_basefw)(struct avs_dev *, struct firmware *); int (* const load_lib)(struct avs_dev *, struct firmware *, u32); int (* const transfer_mods)(struct avs_dev *, bool, struct avs_module_entry *, u32); + int (* const config_basefw)(struct avs_dev *); int (* const enable_logs)(struct avs_dev *, enum avs_log_enable, u32, u32, unsigned long, u32 *); int (* const log_buffer_offset)(struct avs_dev *, u32); diff --git a/sound/soc/intel/avs/loader.c b/sound/soc/intel/avs/loader.c index 9ff7818395cd..0b29941feb0e 100644 --- a/sound/soc/intel/avs/loader.c +++ b/sound/soc/intel/avs/loader.c @@ -603,7 +603,7 @@ static int avs_dsp_load_basefw(struct avs_dev *adev) return ret; } -int avs_dsp_boot_firmware(struct avs_dev *adev, bool purge) +static int avs_load_firmware(struct avs_dev *adev, bool purge) { struct avs_soc_component *acomp; int ret, i; @@ -657,28 +657,33 @@ int avs_dsp_boot_firmware(struct avs_dev *adev, bool purge) return 0; } -int avs_dsp_first_boot_firmware(struct avs_dev *adev) +static int avs_config_basefw(struct avs_dev *adev) { - int ret, i; + int ret; - if (avs_platattr_test(adev, CLDMA)) { - ret = hda_cldma_init(&code_loader, &adev->base.core, - adev->dsp_ba, AVS_CL_DEFAULT_BUFFER_SIZE); - if (ret < 0) { - dev_err(adev->dev, "cldma init failed: %d\n", ret); + if (adev->spec->dsp_ops->config_basefw) { + ret = avs_dsp_op(adev, config_basefw); + if (ret) return ret; - } } - ret = avs_dsp_core_disable(adev, AVS_MAIN_CORE_MASK); - if (ret < 0) - return ret; + return 0; +} + +int avs_dsp_boot_firmware(struct avs_dev *adev, bool purge) +{ + int ret; - ret = avs_dsp_boot_firmware(adev, true); - if (ret < 0) { - dev_err(adev->dev, "firmware boot failed: %d\n", ret); + ret = avs_load_firmware(adev, purge); + if (ret) return ret; - } + + return avs_config_basefw(adev); +} + +static int avs_dsp_alloc_resources(struct avs_dev *adev) +{ + int ret, i; ret = avs_ipc_get_hw_config(adev, &adev->hw_cfg); if (ret) @@ -705,6 +710,31 @@ int avs_dsp_first_boot_firmware(struct avs_dev *adev) strscpy(adev->lib_names[0], "BASEFW", AVS_LIB_NAME_SIZE); ida_init(&adev->ppl_ida); - return 0; } + +int avs_dsp_first_boot_firmware(struct avs_dev *adev) +{ + int ret; + + if (avs_platattr_test(adev, CLDMA)) { + ret = hda_cldma_init(&code_loader, &adev->base.core, + adev->dsp_ba, AVS_CL_DEFAULT_BUFFER_SIZE); + if (ret < 0) { + dev_err(adev->dev, "cldma init failed: %d\n", ret); + return ret; + } + } + + ret = avs_dsp_core_disable(adev, AVS_MAIN_CORE_MASK); + if (ret < 0) + return ret; + + ret = avs_dsp_boot_firmware(adev, true); + if (ret < 0) { + dev_err(adev->dev, "firmware boot failed: %d\n", ret); + return ret; + } + + return avs_dsp_alloc_resources(adev); +} From patchwork Wed Jan 22 17:54:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947587 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45DA6214802 for ; Wed, 22 Jan 2025 17:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567658; cv=none; b=XyWrmc0UjCPKVc39220fnjJNITd0oi1H/jSXU8y22MjUvvreAHGhqrGd82OR5W6orQTSS/TYB8bMpCjPpdbG+oJog6G3Z0eqyFEvBG1BzubwKXjUiStkjuK7XlsHKppgGqPA1wzntF3gX14KpIIuvDT/JyX3yUKfVphD1viBhuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567658; c=relaxed/simple; bh=s9wo7SLMtXruic1MhYBKouirxtYzQFaT+Dz+qbVSKXM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=f0NoukQyooNNBRiNJj0v+tj0ucMnycXSmV6pg+i0ZbJWN2cUSUyxb2u+IDCPGodNSTMViwgLouxRqBfWFA+8RlshuGm8QwUGVRyH6BSbzXvD/IAofLvB6aUcNTSqib3VDBbWVsToExkrWflQPE3PtvVormkKVzohDz70iYkmVgs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mfD+epcL; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mfD+epcL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567657; x=1769103657; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s9wo7SLMtXruic1MhYBKouirxtYzQFaT+Dz+qbVSKXM=; b=mfD+epcLPA9fGKunkbk6Q+vIAlW9thpRkhEYhDR4d5AI+pSpPgN1X9I7 ENfxa3wVFWXVZq0olyUDQyKshoZQYpw0Jb9Dw9aQW4ii4DxcyNu49KGk9 C37y5fUkt0Bh7YlCpPsujlxBxyc9pDjaEQ266SDwsWyR/lOjPziZt/6t6 LIFZz8e3Xy9ZcZfj2fy/FF/tp79mjoQbGgghZ4HvY+T08cDMa/v1jzhMj afY2IXpk/jyvSodP4lwkYh6TCTlBiNutOldk9vO3WoPLyIGmEuqIlefBd rtZ6pX3dZ98b2dRqc2YiY5tdYHQWIszNhc+Hgpll56pEtg+3qM7MO/DEW A==; X-CSE-ConnectionGUID: c8OEf7rSQnSEWXp/hKGi6w== X-CSE-MsgGUID: Xl6cb02YQwGADUxUYfdsZQ== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434763" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434763" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:40:57 -0800 X-CSE-ConnectionGUID: VyatG/mQSAOAcmAppzsslw== X-CSE-MsgGUID: mli6+iF8TcCEHb1xSP3NDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185310" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:40:55 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 07/11] ASoC: Intel: avs: Configure basefw on TGL-based platforms Date: Wed, 22 Jan 2025 18:54:22 +0100 Message-Id: <20250122175426.1369059-8-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Amadeusz Sławiński The AudioDSP firmware requires additional information about the configuration on selected devices. That information is unaccessible from the DSP side and shall be sent before any streaming starts. To achieve the goal, introduce FW_CONFIG_SET request. FW_CONFIG_SET message allows driver to modify firmware's configuration. Multiple parameters can be modified at once, thanks to payload being an array of TLVs. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/messages.c | 38 ++++++++++++++++++++++++++++++++++ sound/soc/intel/avs/messages.h | 9 ++++++++ sound/soc/intel/avs/tgl.c | 31 +++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/sound/soc/intel/avs/messages.c b/sound/soc/intel/avs/messages.c index 30b666f8909b..242a175381c2 100644 --- a/sound/soc/intel/avs/messages.c +++ b/sound/soc/intel/avs/messages.c @@ -510,6 +510,44 @@ int avs_ipc_get_fw_config(struct avs_dev *adev, struct avs_fw_cfg *cfg) return ret; } +int avs_ipc_set_fw_config(struct avs_dev *adev, size_t num_tlvs, ...) +{ + struct avs_tlv *tlv; + void *payload; + size_t offset; + va_list args; + int ret, i; + + payload = kzalloc(AVS_MAILBOX_SIZE, GFP_KERNEL); + if (!payload) + return -ENOMEM; + + va_start(args, num_tlvs); + for (offset = i = 0; i < num_tlvs && offset < AVS_MAILBOX_SIZE - sizeof(*tlv); i++) { + tlv = (struct avs_tlv *)(payload + offset); + tlv->type = va_arg(args, u32); + tlv->length = va_arg(args, u32); + + offset += sizeof(*tlv) + tlv->length; + if (offset > AVS_MAILBOX_SIZE) + break; + + memcpy(tlv->value, va_arg(args, u8*), tlv->length); + } + + if (i == num_tlvs) + ret = avs_ipc_set_large_config(adev, AVS_BASEFW_MOD_ID, AVS_BASEFW_INST_ID, + AVS_BASEFW_FIRMWARE_CONFIG, payload, offset); + else + ret = -ERANGE; + + va_end(args); + kfree(payload); + if (ret) + dev_err(adev->dev, "set fw cfg failed: %d\n", ret); + return ret; +} + int avs_ipc_get_hw_config(struct avs_dev *adev, struct avs_hw_cfg *cfg) { struct avs_tlv *tlv; diff --git a/sound/soc/intel/avs/messages.h b/sound/soc/intel/avs/messages.h index 0378633c7f96..84b0d4b69ecb 100644 --- a/sound/soc/intel/avs/messages.h +++ b/sound/soc/intel/avs/messages.h @@ -451,6 +451,8 @@ enum avs_fw_cfg_params { AVS_FW_CFG_RESERVED, AVS_FW_CFG_POWER_GATING_POLICY, AVS_FW_CFG_ASSERT_MODE, + AVS_FW_CFG_RESERVED2, + AVS_FW_CFG_BUS_HARDWARE_ID, }; struct avs_fw_cfg { @@ -475,7 +477,14 @@ struct avs_fw_cfg { u32 power_gating_policy; }; +struct avs_bus_hwid { + u32 device; + u32 subsystem; + u8 revision; +}; + int avs_ipc_get_fw_config(struct avs_dev *adev, struct avs_fw_cfg *cfg); +int avs_ipc_set_fw_config(struct avs_dev *adev, size_t num_tlvs, ...); enum avs_hw_cfg_params { AVS_HW_CFG_AVS_VER, diff --git a/sound/soc/intel/avs/tgl.c b/sound/soc/intel/avs/tgl.c index a9019ff5e3af..f18fa394aa53 100644 --- a/sound/soc/intel/avs/tgl.c +++ b/sound/soc/intel/avs/tgl.c @@ -6,7 +6,12 @@ // Amadeusz Slawinski // +#include +#include #include "avs.h" +#include "messages.h" + +#define CPUID_TSC_LEAF 0x15 static int avs_tgl_dsp_core_power(struct avs_dev *adev, u32 core_mask, bool power) { @@ -35,6 +40,31 @@ static int avs_tgl_dsp_core_stall(struct avs_dev *adev, u32 core_mask, bool stal return avs_dsp_core_stall(adev, core_mask, stall); } +static int avs_tgl_config_basefw(struct avs_dev *adev) +{ + struct pci_dev *pci = adev->base.pci; + struct avs_bus_hwid hwid; + unsigned int ecx; + int ret; + + ecx = cpuid_ecx(CPUID_TSC_LEAF); + if (ecx) { + ret = avs_ipc_set_fw_config(adev, 1, AVS_FW_CFG_XTAL_FREQ_HZ, sizeof(ecx), &ecx); + if (ret) + return AVS_IPC_RET(ret); + } + + hwid.device = pci->device; + hwid.subsystem = pci->subsystem_vendor | (pci->subsystem_device << 16); + hwid.revision = pci->revision; + + ret = avs_ipc_set_fw_config(adev, 1, AVS_FW_CFG_BUS_HARDWARE_ID, sizeof(hwid), &hwid); + if (ret) + return AVS_IPC_RET(ret); + + return 0; +} + const struct avs_dsp_ops avs_tgl_dsp_ops = { .power = avs_tgl_dsp_core_power, .reset = avs_tgl_dsp_core_reset, @@ -44,6 +74,7 @@ const struct avs_dsp_ops avs_tgl_dsp_ops = { .load_basefw = avs_icl_load_basefw, .load_lib = avs_hda_load_library, .transfer_mods = avs_hda_transfer_modules, + .config_basefw = avs_tgl_config_basefw, .log_buffer_offset = avs_icl_log_buffer_offset, .log_buffer_status = avs_apl_log_buffer_status, .coredump = avs_apl_coredump, From patchwork Wed Jan 22 17:54:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947588 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A3EF214802 for ; Wed, 22 Jan 2025 17:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567664; cv=none; b=ciDfbYJbV0tJ0uJXOrW9vULXU6mfbYb30Vmgrol0FcyxRGvNgFS2W7PsSdg6MMTmSe1KAOmQGKwQO5IwskVIVXyxXBkcEwNoj6riIk92uZgl19p4rBgqNR5OeNEicBdqFZ+UdgYI26PnljHxcohP/fnBGbyW+MtQX/JAoC0PdfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567664; c=relaxed/simple; bh=XSG6QkLd4N8rhs02fOL8CmoS+QHescTPBiUs8lCnmfg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=utQ3RUalu9r6b66ngOfU07lG4c12iUX28+sJCbVj3COun0aazfww5iZ+074/gzM7/drudFObI+Kpi3Y9S8Atq3bHhMGeot/HKqKt9pr8Ema3AuU+eH4XxhjULxAwNGZzQTLFeYxsarexiSj+2JA8HCKp2ypPYX7iBrYxJQ6wzYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nw12V/Yp; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nw12V/Yp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567660; x=1769103660; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XSG6QkLd4N8rhs02fOL8CmoS+QHescTPBiUs8lCnmfg=; b=nw12V/YpXZJaxO4QW+gHxCRsrdYCGoEp2628eBfGGjYybAcU8qXUeZN3 GYqzD3ex7p6XZ42TGY5QQgy5zbznBrYvDUNtmAIEJqeHT2P3Qjwdob1L6 BL1KyriqYVQwZKY3AmjaZrJ5ynw/a9C10RDxa6exDbMhhvXPaP45T6xSX Y+LtkXhlL0flbMQFtwLgyBhu+MXviUQEYovVyP9o3/9fauGPx4BjvsGCk fCzQ3fEmfjT8aCRXxGCnG0dDLFS7Zl5SQWLh0PnNfpuW9WZG8CneQGzsr qlJYgZyZOLya8BIuHc6kUcoHbI94nLivajYoZ9O8lhScKH7R7oHvFjnMp A==; X-CSE-ConnectionGUID: Vo2kDNUxREWqAJzykqc0Ug== X-CSE-MsgGUID: H8k5pkrSR5C1N6puSyNCjQ== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434769" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434769" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:40:59 -0800 X-CSE-ConnectionGUID: Hh7u0tktQcqQvwDa1EGURg== X-CSE-MsgGUID: Vqwo4qw+QumRJOtdkSkr8g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185315" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:40:57 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 08/11] ASoC: Intel: avs: New gateway configuration mechanism Date: Wed, 22 Jan 2025 18:54:23 +0100 Message-Id: <20250122175426.1369059-9-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Creation of a module which contains gateway configuration consists of few additional steps, namely: - assigning ID (node_id) for the gateway - attaching hardware configuration from the NHLT table (optional) By splitting the steps into separate functions code becomes easier to read and understand. Any redundancy created by this patch will be addressed by follow up changes. Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/path.c | 150 +++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c index f31d5e2caa7b..698a3d542244 100644 --- a/sound/soc/intel/avs/path.c +++ b/sound/soc/intel/avs/path.c @@ -115,6 +115,156 @@ avs_path_find_variant(struct avs_dev *adev, return NULL; } +static void avs_init_node_id(union avs_connector_node_id *node_id, + struct avs_tplg_modcfg_ext *te, u32 dma_id) +{ + node_id->val = 0; + node_id->dma_type = te->copier.dma_type; + + switch (node_id->dma_type) { + case AVS_DMA_DMIC_LINK_INPUT: + case AVS_DMA_I2S_LINK_OUTPUT: + case AVS_DMA_I2S_LINK_INPUT: + /* Gateway's virtual index is statically assigned in the topology. */ + node_id->vindex = te->copier.vindex.val; + break; + + case AVS_DMA_HDA_HOST_OUTPUT: + case AVS_DMA_HDA_HOST_INPUT: + /* Gateway's virtual index is dynamically assigned with DMA ID */ + node_id->vindex = dma_id; + break; + + case AVS_DMA_HDA_LINK_OUTPUT: + case AVS_DMA_HDA_LINK_INPUT: + node_id->vindex = te->copier.vindex.val | dma_id; + break; + + default: + *node_id = INVALID_NODE_ID; + break; + } +} + +/* Every BLOB contains at least gateway attributes. */ +static struct acpi_nhlt_config *default_blob = (struct acpi_nhlt_config *)&(u32[2]) {4}; + +static struct acpi_nhlt_config * +avs_nhlt_config_or_default(struct avs_dev *adev, struct avs_tplg_module *t) +{ + struct acpi_nhlt_format_config *fmtcfg; + struct avs_tplg_modcfg_ext *te; + struct avs_audio_format *fmt; + int link_type, dev_type; + int bus_id, dir; + + te = t->cfg_ext; + + switch (te->copier.dma_type) { + case AVS_DMA_I2S_LINK_OUTPUT: + link_type = ACPI_NHLT_LINKTYPE_SSP; + dev_type = ACPI_NHLT_DEVICETYPE_CODEC; + bus_id = te->copier.vindex.i2s.instance; + dir = SNDRV_PCM_STREAM_PLAYBACK; + fmt = te->copier.out_fmt; + break; + + case AVS_DMA_I2S_LINK_INPUT: + link_type = ACPI_NHLT_LINKTYPE_SSP; + dev_type = ACPI_NHLT_DEVICETYPE_CODEC; + bus_id = te->copier.vindex.i2s.instance; + dir = SNDRV_PCM_STREAM_CAPTURE; + fmt = t->in_fmt; + break; + + case AVS_DMA_DMIC_LINK_INPUT: + link_type = ACPI_NHLT_LINKTYPE_PDM; + dev_type = -1; /* ignored */ + bus_id = 0; + dir = SNDRV_PCM_STREAM_CAPTURE; + fmt = t->in_fmt; + break; + + default: + return default_blob; + } + + /* Override format selection if necessary. */ + if (te->copier.blob_fmt) + fmt = te->copier.blob_fmt; + + fmtcfg = acpi_nhlt_find_fmtcfg(link_type, dev_type, dir, bus_id, + fmt->num_channels, fmt->sampling_freq, fmt->valid_bit_depth, + fmt->bit_depth); + if (!fmtcfg) { + dev_warn(adev->dev, "Endpoint format configuration not found.\n"); + return ERR_PTR(-ENOENT); + } + + if (fmtcfg->config.capabilities_size < default_blob->capabilities_size) + return ERR_PTR(-ETOOSMALL); + /* The firmware expects the payload to be DWORD-aligned. */ + if (fmtcfg->config.capabilities_size % sizeof(u32)) + return ERR_PTR(-EINVAL); + + return &fmtcfg->config; +} + +static int avs_fill_gtw_config(struct avs_dev *adev, struct avs_copier_gtw_cfg *gtw, + struct avs_tplg_module *t, size_t *cfg_size) +{ + struct acpi_nhlt_config *blob; + size_t gtw_size; + + blob = avs_nhlt_config_or_default(adev, t); + if (IS_ERR(blob)) + return PTR_ERR(blob); + + gtw_size = blob->capabilities_size; + if (*cfg_size + gtw_size > AVS_MAILBOX_SIZE) + return -E2BIG; + + gtw->config_length = gtw_size / sizeof(u32); + memcpy(gtw->config.blob, blob->capabilities, blob->capabilities_size); + *cfg_size += gtw_size; + + return 0; +} + +static __maybe_unused int avs_copier_create2(struct avs_dev *adev, struct avs_path_module *mod) +{ + struct avs_tplg_module *t = mod->template; + struct avs_tplg_modcfg_ext *te; + struct avs_copier_cfg *cfg; + size_t cfg_size; + u32 dma_id; + int ret; + + te = t->cfg_ext; + cfg = adev->modcfg_buf; + dma_id = mod->owner->owner->dma_id; + cfg_size = offsetof(struct avs_copier_cfg, gtw_cfg.config); + + ret = avs_fill_gtw_config(adev, &cfg->gtw_cfg, t, &cfg_size); + if (ret) + return ret; + + cfg->base.cpc = t->cfg_base->cpc; + cfg->base.ibs = t->cfg_base->ibs; + cfg->base.obs = t->cfg_base->obs; + cfg->base.is_pages = t->cfg_base->is_pages; + cfg->base.audio_fmt = *t->in_fmt; + cfg->out_fmt = *te->copier.out_fmt; + cfg->feature_mask = te->copier.feature_mask; + avs_init_node_id(&cfg->gtw_cfg.node_id, te, dma_id); + cfg->gtw_cfg.dma_buffer_size = te->copier.dma_buffer_size; + mod->gtw_attrs = cfg->gtw_cfg.config.attrs; + + ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, t->core_id, + t->domain, cfg, cfg_size, &mod->instance_id); + return ret; +} + __maybe_unused static bool avs_dma_type_is_host(u32 dma_type) { From patchwork Wed Jan 22 17:54:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947589 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DD94215197 for ; Wed, 22 Jan 2025 17:41:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567664; cv=none; b=j3V3QroRl1crO4hg4UXRbjC5LwDzwwFEUWjIob0CylQXZdyIqIR+74C8CsJrlDL+NsS+2pJpZy11NpN9gDx1us7yet83PRemt/aiYAbijzuiLN3qHLQ/zYkoi7ictLgoRlzlcQa70/Z3VrA/rClYmzyu4JGEc8F86FGFvnRaTQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567664; c=relaxed/simple; bh=FaUdIe8pMgEeyYSpc0pzx+UXJIxA2QinYRqwfuII/NM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QZXDG41QThc2hLftaCrk8P3CUNUU9NwBNtVaBt5muBj0RQuN4U4t9YU/5aClCPCyhw6sOAzZrlZQ/A9IQQcYugqjZe78WBlodkdmbSUoR7WGMrZ692r12njW6lyHp2inbbd//ExTVeF5jSEnIgJh7oqZOtw6xniWBJgpslXXTUQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=leVTUq93; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="leVTUq93" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567662; x=1769103662; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FaUdIe8pMgEeyYSpc0pzx+UXJIxA2QinYRqwfuII/NM=; b=leVTUq93e4HvRHyeNI6mjp7oYRodJAIP8ZRVphiEPWh9WpFQL0t13HO+ zFiHghsmgC76zMKUw/mwQU2aBxK/tYKQPzTkaRehen8RoXUe2RWs8b6Hn E2mzEYU3G+AJU9trF33oVzs28RrAE1B5dswBseUolkgXrEef4DcKbfWyp K32uZd+Zi1fqsLumCeV+GOeNmkpSrsVq47sm3t73ODPv0TzWUPUFaB859 VTVkNqg6axb2TekXXEwC74RDwTezQwddyKdrLPCuebEV9+iF5ECPzO2ay D6j+veQOigisQSLv2CDL8eTrWJ5Bxf5EjzJbQ0vH5v0WcA4fJn6eeEhRS A==; X-CSE-ConnectionGUID: nY9KSHF9QBqfcUtO86LmUw== X-CSE-MsgGUID: p7WK41U2TMmW58sU6cBfjw== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434775" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434775" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:41:02 -0800 X-CSE-ConnectionGUID: 2Wjy/X1tTpG+NW806E5tlQ== X-CSE-MsgGUID: qNoOeqPmR2SU6hdYQ4JZ9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185327" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:41:00 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 09/11] ASoC: Intel: avs: Remove unused gateway configuration code Date: Wed, 22 Jan 2025 18:54:24 +0100 Message-Id: <20250122175426.1369059-10-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Switch to new copier module constructor and remove code that becomes unused because of that. Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/path.c | 149 +-------------------------------- sound/soc/intel/avs/topology.h | 2 - 2 files changed, 1 insertion(+), 150 deletions(-) diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c index 698a3d542244..cfa19e4820d2 100644 --- a/sound/soc/intel/avs/path.c +++ b/sound/soc/intel/avs/path.c @@ -231,7 +231,7 @@ static int avs_fill_gtw_config(struct avs_dev *adev, struct avs_copier_gtw_cfg * return 0; } -static __maybe_unused int avs_copier_create2(struct avs_dev *adev, struct avs_path_module *mod) +static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod) { struct avs_tplg_module *t = mod->template; struct avs_tplg_modcfg_ext *te; @@ -265,153 +265,6 @@ static __maybe_unused int avs_copier_create2(struct avs_dev *adev, struct avs_pa return ret; } -__maybe_unused -static bool avs_dma_type_is_host(u32 dma_type) -{ - return dma_type == AVS_DMA_HDA_HOST_OUTPUT || - dma_type == AVS_DMA_HDA_HOST_INPUT; -} - -__maybe_unused -static bool avs_dma_type_is_link(u32 dma_type) -{ - return !avs_dma_type_is_host(dma_type); -} - -__maybe_unused -static bool avs_dma_type_is_output(u32 dma_type) -{ - return dma_type == AVS_DMA_HDA_HOST_OUTPUT || - dma_type == AVS_DMA_HDA_LINK_OUTPUT || - dma_type == AVS_DMA_I2S_LINK_OUTPUT; -} - -__maybe_unused -static bool avs_dma_type_is_input(u32 dma_type) -{ - return !avs_dma_type_is_output(dma_type); -} - -static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod) -{ - struct avs_tplg_module *t = mod->template; - struct avs_copier_cfg *cfg; - struct acpi_nhlt_format_config *ep_blob; - struct acpi_nhlt_endpoint *ep; - union avs_connector_node_id node_id = {0}; - size_t cfg_size, data_size; - void *data = NULL; - u32 dma_type; - int ret; - - data_size = sizeof(cfg->gtw_cfg.config); - dma_type = t->cfg_ext->copier.dma_type; - node_id.dma_type = dma_type; - - switch (dma_type) { - struct avs_audio_format *fmt; - int direction; - - case AVS_DMA_I2S_LINK_OUTPUT: - case AVS_DMA_I2S_LINK_INPUT: - if (avs_dma_type_is_input(dma_type)) - direction = SNDRV_PCM_STREAM_CAPTURE; - else - direction = SNDRV_PCM_STREAM_PLAYBACK; - - if (t->cfg_ext->copier.blob_fmt) - fmt = t->cfg_ext->copier.blob_fmt; - else if (direction == SNDRV_PCM_STREAM_CAPTURE) - fmt = t->in_fmt; - else - fmt = t->cfg_ext->copier.out_fmt; - - ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_SSP, - ACPI_NHLT_DEVICETYPE_CODEC, direction, - t->cfg_ext->copier.vindex.i2s.instance); - ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq, - fmt->valid_bit_depth, fmt->bit_depth); - if (!ep_blob) { - dev_err(adev->dev, "no I2S ep_blob found\n"); - return -ENOENT; - } - - data = ep_blob->config.capabilities; - data_size = ep_blob->config.capabilities_size; - /* I2S gateway's vindex is statically assigned in topology */ - node_id.vindex = t->cfg_ext->copier.vindex.val; - - break; - - case AVS_DMA_DMIC_LINK_INPUT: - direction = SNDRV_PCM_STREAM_CAPTURE; - - if (t->cfg_ext->copier.blob_fmt) - fmt = t->cfg_ext->copier.blob_fmt; - else - fmt = t->in_fmt; - - ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, direction, 0); - ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq, - fmt->valid_bit_depth, fmt->bit_depth); - if (!ep_blob) { - dev_err(adev->dev, "no DMIC ep_blob found\n"); - return -ENOENT; - } - - data = ep_blob->config.capabilities; - data_size = ep_blob->config.capabilities_size; - /* DMIC gateway's vindex is statically assigned in topology */ - node_id.vindex = t->cfg_ext->copier.vindex.val; - - break; - - case AVS_DMA_HDA_HOST_OUTPUT: - case AVS_DMA_HDA_HOST_INPUT: - /* HOST gateway's vindex is dynamically assigned with DMA id */ - node_id.vindex = mod->owner->owner->dma_id; - break; - - case AVS_DMA_HDA_LINK_OUTPUT: - case AVS_DMA_HDA_LINK_INPUT: - node_id.vindex = t->cfg_ext->copier.vindex.val | - mod->owner->owner->dma_id; - break; - - case INVALID_OBJECT_ID: - default: - node_id = INVALID_NODE_ID; - break; - } - - cfg_size = offsetof(struct avs_copier_cfg, gtw_cfg.config) + data_size; - if (cfg_size > AVS_MAILBOX_SIZE) - return -EINVAL; - - cfg = adev->modcfg_buf; - memset(cfg, 0, cfg_size); - cfg->base.cpc = t->cfg_base->cpc; - cfg->base.ibs = t->cfg_base->ibs; - cfg->base.obs = t->cfg_base->obs; - cfg->base.is_pages = t->cfg_base->is_pages; - cfg->base.audio_fmt = *t->in_fmt; - cfg->out_fmt = *t->cfg_ext->copier.out_fmt; - cfg->feature_mask = t->cfg_ext->copier.feature_mask; - cfg->gtw_cfg.node_id = node_id; - cfg->gtw_cfg.dma_buffer_size = t->cfg_ext->copier.dma_buffer_size; - /* config_length in DWORDs */ - cfg->gtw_cfg.config_length = DIV_ROUND_UP(data_size, 4); - if (data) - memcpy(&cfg->gtw_cfg.config.blob, data, data_size); - - mod->gtw_attrs = cfg->gtw_cfg.config.attrs; - - ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, - t->core_id, t->domain, cfg, cfg_size, - &mod->instance_id); - return ret; -} - static struct avs_control_data *avs_get_module_control(struct avs_path_module *mod) { struct avs_tplg_module *t = mod->template; diff --git a/sound/soc/intel/avs/topology.h b/sound/soc/intel/avs/topology.h index 7892e3797f63..dcfc568081a3 100644 --- a/sound/soc/intel/avs/topology.h +++ b/sound/soc/intel/avs/topology.h @@ -74,8 +74,6 @@ struct avs_tplg_modcfg_ext { union avs_virtual_index vindex; u32 dma_type; u32 dma_buffer_size; - u32 config_length; - /* config_data part of priv data */ } copier; struct { u32 out_channel_config; From patchwork Wed Jan 22 17:54:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947590 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37C962153E5 for ; Wed, 22 Jan 2025 17:41:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567667; cv=none; b=Ikf201plrpck3TAsrAXM0hIG0ny8uLDRuNm1H99mqj9n7NHN6ZGsWn4Hq+Qdcv8MMJ59nyd5vkRo0zJ8JtjPS9jAwNWEVKfJRKK2JimXVgUibBjDurm0xIKbBVfeFHnzIBm99HPu9OS8j+sgICh/wFOe9AAs6WyMqs213Y5OEB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567667; c=relaxed/simple; bh=EwwB9HNJNYNP5dCk5zvTqDXbSbfqDwkE3llaOGnllDw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Lqc+IjdLcDo0j0ybUhvUXajXQd9nx7YWldc3S4F4Vw57Bjb/I0leKTGxQOwpSpaAUzdo2Gzd75cfqWpcHZZ6Va/ZGVQsN03UjbVpHZGr8NTA4SQZn+a3QgVQ3fP/ZHolPY/NNrXMiRaiyCt/QAAZGgifz/OgBE/EB14YH+RHHv0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=h+P8FZIY; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="h+P8FZIY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567665; x=1769103665; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EwwB9HNJNYNP5dCk5zvTqDXbSbfqDwkE3llaOGnllDw=; b=h+P8FZIYfXU2v6c9NkbdFMjbt+9eP+JvdgEsFJ6F93NuBtUofYSqaffR wkAEDPLc/4aM2H/F11tU+aAO8a/Kz6hOECNknzgeXpm7AL7x9XQefRFXW GEbwg+NdgRrZ/LMTX7bU7tCJPRuj3fAxkYRlnmHKuAlF+HWDXNLaMun1s +qCpdSQR2BekWsp5VBN/RdtciNyHtpxk1v5CompR+yFx8bWsvf0TVF9ci jGN9i5WgheD8NMcLaelt/ci1i90rroLxhVZt9IZuCBmbTLxor16isbl0f Ysj/QUYrNUjjy+EQMP1DyfPlt2fHvP4tqS1I+gHQ5lb4xKfiSe8vKh6ma g==; X-CSE-ConnectionGUID: iaJbGs75QmqZ33cFLfWV3Q== X-CSE-MsgGUID: 2Y1TQJyfQYCWA6IVbORFGg== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434785" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434785" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:41:05 -0800 X-CSE-ConnectionGUID: tiF8hW9bQiC9w0SSncnBaw== X-CSE-MsgGUID: 1g+CHGjjQFWCfkPW+9GUyg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185358" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:41:02 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski , Piotr Maziarz Subject: [PATCH 10/11] ASoC: Intel: avs: Add WHM module support Date: Wed, 22 Jan 2025 18:54:25 +0100 Message-Id: <20250122175426.1369059-11-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 WovHostModule (WHM) is used in wake-on-voice scenarios to optimize power consumption. It combines capabilities of Copier, KeyPhraseBuffer, WakeOnVoice and Muxer modules. Signed-off-by: Piotr Maziarz Signed-off-by: Cezary Rojewski --- include/uapi/sound/intel/avs/tokens.h | 7 +++++ sound/soc/intel/avs/messages.h | 13 +++++++++ sound/soc/intel/avs/path.c | 36 +++++++++++++++++++++++ sound/soc/intel/avs/topology.c | 42 +++++++++++++++++++++++++++ sound/soc/intel/avs/topology.h | 9 ++++++ 5 files changed, 107 insertions(+) diff --git a/include/uapi/sound/intel/avs/tokens.h b/include/uapi/sound/intel/avs/tokens.h index 3e3fb258dd54..06ff30537f47 100644 --- a/include/uapi/sound/intel/avs/tokens.h +++ b/include/uapi/sound/intel/avs/tokens.h @@ -77,6 +77,13 @@ enum avs_tplg_token { AVS_TKN_MODCFG_UPDOWN_MIX_CHAN_MAP_U32 = 430, AVS_TKN_MODCFG_EXT_NUM_INPUT_PINS_U16 = 431, AVS_TKN_MODCFG_EXT_NUM_OUTPUT_PINS_U16 = 432, + AVS_TKN_MODCFG_WHM_REF_AFMT_ID_U32 = 433, + AVS_TKN_MODCFG_WHM_OUT_AFMT_ID_U32 = 434, + AVS_TKN_MODCFG_WHM_WAKE_TICK_PERIOD_U32 = 435, + AVS_TKN_MODCFG_WHM_VINDEX_U8 = 436, + AVS_TKN_MODCFG_WHM_DMA_TYPE_U32 = 437, + AVS_TKN_MODCFG_WHM_DMABUFF_SIZE_U32 = 438, + AVS_TKN_MODCFG_WHM_BLOB_AFMT_ID_U32 = 439, /* struct avs_tplg_pplcfg */ AVS_TKN_PPLCFG_ID_U32 = 1401, diff --git a/sound/soc/intel/avs/messages.h b/sound/soc/intel/avs/messages.h index 84b0d4b69ecb..f44fcfc81de7 100644 --- a/sound/soc/intel/avs/messages.h +++ b/sound/soc/intel/avs/messages.h @@ -652,6 +652,9 @@ int avs_ipc_set_system_time(struct avs_dev *adev); #define AVS_INTELWOV_MOD_UUID \ GUID_INIT(0xEC774FA9, 0x28D3, 0x424A, 0x90, 0xE4, 0x69, 0xF9, 0x84, 0xF1, 0xEE, 0xB7) +#define AVS_WOVHOSTM_MOD_UUID \ + GUID_INIT(0xF9ED62B7, 0x092E, 0x4A90, 0x8F, 0x4D, 0x82, 0xDA, 0xA8, 0xB3, 0x8F, 0x3B) + /* channel map */ enum avs_channel_index { AVS_CHANNEL_LEFT = 0, @@ -881,6 +884,16 @@ struct avs_wov_cfg { } __packed; static_assert(sizeof(struct avs_wov_cfg) == 44); +struct avs_whm_cfg { + struct avs_modcfg_base base; + /* Audio format for output pin 0 */ + struct avs_audio_format ref_fmt; + struct avs_audio_format out_fmt; + u32 wake_tick_period; + struct avs_copier_gtw_cfg gtw_cfg; +} __packed; +static_assert(sizeof(struct avs_whm_cfg) == 108); + /* Module runtime parameters */ enum avs_copier_runtime_param { diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c index cfa19e4820d2..dfb85bd2b665 100644 --- a/sound/soc/intel/avs/path.c +++ b/sound/soc/intel/avs/path.c @@ -265,6 +265,41 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod) return ret; } +static int avs_whm_create(struct avs_dev *adev, struct avs_path_module *mod) +{ + struct avs_tplg_module *t = mod->template; + struct avs_tplg_modcfg_ext *te; + struct avs_whm_cfg *cfg; + size_t cfg_size; + u32 dma_id; + int ret; + + te = t->cfg_ext; + cfg = adev->modcfg_buf; + dma_id = mod->owner->owner->dma_id; + cfg_size = offsetof(struct avs_whm_cfg, gtw_cfg.config); + + ret = avs_fill_gtw_config(adev, &cfg->gtw_cfg, t, &cfg_size); + if (ret) + return ret; + + cfg->base.cpc = t->cfg_base->cpc; + cfg->base.ibs = t->cfg_base->ibs; + cfg->base.obs = t->cfg_base->obs; + cfg->base.is_pages = t->cfg_base->is_pages; + cfg->base.audio_fmt = *t->in_fmt; + cfg->ref_fmt = *te->whm.ref_fmt; + cfg->out_fmt = *te->whm.out_fmt; + cfg->wake_tick_period = te->whm.wake_tick_period; + avs_init_node_id(&cfg->gtw_cfg.node_id, te, dma_id); + cfg->gtw_cfg.dma_buffer_size = te->whm.dma_buffer_size; + mod->gtw_attrs = cfg->gtw_cfg.config.attrs; + + ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, t->core_id, + t->domain, cfg, cfg_size, &mod->instance_id); + return ret; +} + static struct avs_control_data *avs_get_module_control(struct avs_path_module *mod) { struct avs_tplg_module *t = mod->template; @@ -536,6 +571,7 @@ static struct avs_module_create avs_module_create[] = { { &AVS_ASRC_MOD_UUID, avs_asrc_create }, { &AVS_INTELWOV_MOD_UUID, avs_wov_create }, { &AVS_PROBE_MOD_UUID, avs_probe_create }, + { &AVS_WOVHOSTM_MOD_UUID, avs_whm_create }, }; static int avs_path_module_type_create(struct avs_dev *adev, struct avs_path_module *mod) diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c index d612f20ed989..471b00b9a149 100644 --- a/sound/soc/intel/avs/topology.c +++ b/sound/soc/intel/avs/topology.c @@ -815,6 +815,48 @@ static const struct avs_tplg_token_parser modcfg_ext_parsers[] = { .offset = offsetof(struct avs_tplg_modcfg_ext, generic.num_output_pins), .parse = avs_parse_short_token, }, + { + .token = AVS_TKN_MODCFG_WHM_REF_AFMT_ID_U32, + .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, + .offset = offsetof(struct avs_tplg_modcfg_ext, whm.ref_fmt), + .parse = avs_parse_audio_format_ptr, + }, + { + .token = AVS_TKN_MODCFG_WHM_OUT_AFMT_ID_U32, + .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, + .offset = offsetof(struct avs_tplg_modcfg_ext, whm.out_fmt), + .parse = avs_parse_audio_format_ptr, + }, + { + .token = AVS_TKN_MODCFG_WHM_WAKE_TICK_PERIOD_U32, + .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, + .offset = offsetof(struct avs_tplg_modcfg_ext, whm.wake_tick_period), + .parse = avs_parse_word_token, + }, + { + .token = AVS_TKN_MODCFG_WHM_VINDEX_U8, + .type = SND_SOC_TPLG_TUPLE_TYPE_BYTE, + .offset = offsetof(struct avs_tplg_modcfg_ext, whm.vindex), + .parse = avs_parse_byte_token, + }, + { + .token = AVS_TKN_MODCFG_WHM_DMA_TYPE_U32, + .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, + .offset = offsetof(struct avs_tplg_modcfg_ext, whm.dma_type), + .parse = avs_parse_word_token, + }, + { + .token = AVS_TKN_MODCFG_WHM_DMABUFF_SIZE_U32, + .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, + .offset = offsetof(struct avs_tplg_modcfg_ext, whm.dma_buffer_size), + .parse = avs_parse_word_token, + }, + { + .token = AVS_TKN_MODCFG_WHM_BLOB_AFMT_ID_U32, + .type = SND_SOC_TPLG_TUPLE_TYPE_WORD, + .offset = offsetof(struct avs_tplg_modcfg_ext, whm.blob_fmt), + .parse = avs_parse_audio_format_ptr, + }, }; static const struct avs_tplg_token_parser pin_format_parsers[] = { diff --git a/sound/soc/intel/avs/topology.h b/sound/soc/intel/avs/topology.h index dcfc568081a3..23d5ccd19959 100644 --- a/sound/soc/intel/avs/topology.h +++ b/sound/soc/intel/avs/topology.h @@ -75,6 +75,15 @@ struct avs_tplg_modcfg_ext { u32 dma_type; u32 dma_buffer_size; } copier; + struct { + struct avs_audio_format *ref_fmt; + struct avs_audio_format *out_fmt; + u32 wake_tick_period; + union avs_virtual_index vindex; + u32 dma_type; + u32 dma_buffer_size; + struct avs_audio_format *blob_fmt; /* optional override */ + } whm; struct { u32 out_channel_config; u32 coefficients_select; From patchwork Wed Jan 22 17:54:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13947591 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19E112153FF for ; Wed, 22 Jan 2025 17:41:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567668; cv=none; b=Jw52Cu0BzIXgVxixqOVyi9alF9+/gp8OQiSDWvA/rttenD9MCyIceU/wB8Jh3S0zy05tZEYqV5+a40MpGahIdNh3J1iIvto9UR/dpphJXsD0EjrDI3gAi9ClLwt5C7CU+bknevaxGgoBNAInayeFzhH8olmbWSWYVfCaoxDOCnA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567668; c=relaxed/simple; bh=CtcjxbxSMe9+UWegxhwcaOmTq/vY0kvzO1AvhGKXPgk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=T/QCk8I00eYI/TZyJzXlY7hT2rNCaoubNopSzvwu9NUC0qJAVMoBXojtZ+2Nk/JQxLCyuxicIrpN+iUzDy6jMMSPPIlFuwzoaNQd05itY2fkdjbEM2+6cUXGISiRByOrt50lPkN5Onh12x2wfFxrmvVutzX3TbLQTMcI78NEyeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ib8zQ5xn; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ib8zQ5xn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737567667; x=1769103667; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CtcjxbxSMe9+UWegxhwcaOmTq/vY0kvzO1AvhGKXPgk=; b=Ib8zQ5xn7MOcIZnC9Izu6ErfEAUDvP7GvATcyerIelQSg9CFI2KJ+Csw qvVlUVJ3xK0/COrjqAJhQKqj/toFqfbzX9xFykURy9lUm+uWDDhbPannZ z6hKHSuhFASvV5wrWaOwp60K+lJ9IkdxLVUwWw/svEXCWx0D17dwjZJmO QDF50gUDWDBGKmFih3z4RhkxQRqKBolG8sVEjrEgytzXd2M9XTv47zlZ7 0zNMEwAUIkHpiW0nVgYGlfIqZ8V3JAfujssJN3THjnA7ntigJjoK93Dqf ivtJwJcjqnZy03aRMHgQZizcAYijQjNf003G5q2KE+3hXfQ4MvUASmBkY A==; X-CSE-ConnectionGUID: pI9DFFLnS3atmPOq1NHPYw== X-CSE-MsgGUID: gQJIzEyPSvmVEKKitqKCEw== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="49434792" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="49434792" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 09:41:07 -0800 X-CSE-ConnectionGUID: GkPTt/LKTA+GaNDCOH/q5w== X-CSE-MsgGUID: bzDi0RUxTmi/i/JzS97rgg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="112185370" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2025 09:41:05 -0800 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 11/11] ALSA: hda: Select avs-driver by default on MBL Date: Wed, 22 Jan 2025 18:54:26 +0100 Message-Id: <20250122175426.1369059-12-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122175426.1369059-1-cezary.rojewski@intel.com> References: <20250122175426.1369059-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The avs-driver is the recommended solution for MalibouLake (MBL, also known as RPL-M) platform. Signed-off-by: Cezary Rojewski --- sound/hda/intel-dsp-config.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c index f564ec7af194..9a8ead75be17 100644 --- a/sound/hda/intel-dsp-config.c +++ b/sound/hda/intel-dsp-config.c @@ -108,6 +108,10 @@ static const struct config_entry config_table[] = { {} } }, + { + .flags = FLAG_SST, + .device = PCI_DEVICE_ID_INTEL_HDA_RPL_M, + }, #endif #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) {