From patchwork Mon Apr 14 06:32:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049825 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 E26342CCC1 for ; Mon, 14 Apr 2025 06:33:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612401; cv=none; b=DhskUY3hVFuvuVp/URw8Gq6LsGvqVCcNkmvam19VIWBqTkgmJMGvgYgCFGWKBCQM1ygppXFJmDR5GRN7jWuU6MoZWlIuTFpQtSPC3F9NpRhsz5Zw6o7LwhPDnN1iXkHAogCE+lGQRDIGNKacWm+PRgaLvj1zpDnjyMMWDr9xf2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612401; c=relaxed/simple; bh=k8gK2FxGQKc19Ma2nGWNxgUlwVND8rrfJ1YCkjSZr4M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NZUtvreQEcJoiMzAf56pXwkZEyAu3Zpvh97VV8pA49fVo03F6XaYr75Bvhnog3eBo1+4Mk5r9+jPHVmB+nbAObJQy6Lb3HJ8glk/ws45cM0XfYqwiHMIgJqSKCsPVrnSVbBPioIZQU/myYNYnvX1OwYDGJWfrtsZ1HOflfGUs+0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lJebgIuA; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lJebgIuA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612400; x=1776148400; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=k8gK2FxGQKc19Ma2nGWNxgUlwVND8rrfJ1YCkjSZr4M=; b=lJebgIuASeojSdqOO35WjZvvbQPufIcjb1atzk6vF2TlKEODZ9+Fi6UX NRFlCFtknI3mBJQEzh4xQtx/uz5nlmLxHC+uRP9RU1w0PG08Bvsgz/eiV klWmzBKysqXjiu1RMOzf9rWbQWEzWQX43XOad0di3IsLx7SHtl+tWdxiQ 8fiF6UMzgr5NhdEhJ9GLntgLa1RBvbG1MFRBb+qlYEfG/f529Cmrqh7nu H2sZnwIJX/JZNQDdrqSt80zRA4Pl7pgXH9romAJTlqZDxlivyQoCAe6wW 7WL7ITCPkS7wZtxhcG9zWWxhDgfpaa3F4FLu1zifCivhF6h6WiqbFNDCs A==; X-CSE-ConnectionGUID: YH/wi89lQeiyu+V5Rp/bsg== X-CSE-MsgGUID: ByxGrrIdTpqqONRk8RxNCA== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872596" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872596" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:18 -0700 X-CSE-ConnectionGUID: I6+GrWseRAuIqSkekJ5ihQ== X-CSE-MsgGUID: lh7NsZsUQfucnxIaepKx6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275262" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:17 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 01/11] ASoC: SOF: topology: allocate string for tuples Date: Mon, 14 Apr 2025 14:32:29 +0800 Message-ID: <20250414063239.85200-2-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In preparation to handle tuples from multiple topologies, duplicate the tuple string value by allocating memory for it. Signed-off-by: Bard Liao Reviewed-by: Liam Girdwood Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- sound/soc/sof/topology.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index dc9cb8324067..15e8ca62ab14 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -571,7 +571,11 @@ static int sof_copy_tuples(struct snd_sof_dev *sdev, struct snd_soc_tplg_vendor_ continue; tuples[*num_copied_tuples].token = tokens[j].token; - tuples[*num_copied_tuples].value.s = elem->string; + tuples[*num_copied_tuples].value.s = + devm_kasprintf(sdev->dev, GFP_KERNEL, + "%s", elem->string); + if (!tuples[*num_copied_tuples].value.s) + return -ENOMEM; } else { struct snd_soc_tplg_vendor_value_elem *elem; From patchwork Mon Apr 14 06:32:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049826 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 D7F0F1925BC for ; Mon, 14 Apr 2025 06:33:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612402; cv=none; b=CaYc7jkzcNMGdXOQLaG4xEaHdiStWtUeG0rDKAzOG9WchULTj8qoZPDw++vZ7ljXYDDSJBFRDaICeeT9B2CdUaRGr0Y+WmnQXWpEL1QeOJvj0C1qwqeY5pds02DkVaoNvBFJ7YBhD4ncd0vFMdZUCeNNEvGD9bzC+mIHy96J/NU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612402; c=relaxed/simple; bh=gZMwZgvvlxmR4PeHegjiDrodipamfKr7vWFuH+eHbRE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DsY9EG+oUyjNwtI1b7rJK23PDGZVn9c1TRFlKkdf/DWzmqB5S2CrhbyKhqrSJUC4mC9maiy4c4kCgYhHHCVReBSkSDNxMqZkXZsZA5BfeaW87+wY1wMHYR+Pd3U1gButUEU4XNH8D21NiKwLXlfyOOxqyMI8ZcXSu59BHa1gpZw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YZh4N/wG; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YZh4N/wG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612401; x=1776148401; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gZMwZgvvlxmR4PeHegjiDrodipamfKr7vWFuH+eHbRE=; b=YZh4N/wGAcRjRUWZ/qBzrVgR24JCGYK4PZ29/aSBEGEuUF4Z05PWmseI dI1gMvrjTZ1SfbuCQd7bzFz8XfsJeZmIRG3iImjrUTjz5qxsvWWDvdf2u EM2drIVMYbcN6R+H7acXNNioAb5GUZR3uDTsiPXHLlVYt9bjyFWWlH8M8 LGhR94qhjEwWG2sCim2V6wcKVDm2AsZPsVcA8VizC5oti73/Af9MU92zD JZaGcYqYtb6huyRhZBu+4qH2Y64rQ+AgriX0Ef0tflY0z7jGUw3cnuCmc CqkPMByBiZAUSt1i9wfReMZvCXm8vXEwe5SI5ycUBi3JTg/Cf1YvAeD8c g==; X-CSE-ConnectionGUID: j1P5FxfcRQiQPql8iSIS4A== X-CSE-MsgGUID: SyIzWBVZQx+aKNDSuqenCQ== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872609" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872609" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:20 -0700 X-CSE-ConnectionGUID: 7vvNnLW4Tj+YaITy5KpkjA== X-CSE-MsgGUID: xUJIdWZmTWikwOpY2PN2tQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275267" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:19 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 02/11] ASoC: SOF: topology: don't convert error code Date: Mon, 14 Apr 2025 14:32:30 +0800 Message-ID: <20250414063239.85200-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 No need to convert the return value of snd_soc_tplg_component_load(). Signed-off-by: Bard Liao Reviewed-by: Liam Girdwood Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- sound/soc/sof/topology.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 15e8ca62ab14..fc4a9cddd162 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2486,11 +2486,9 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) else ret = snd_soc_tplg_component_load(scomp, &sof_tplg_ops, fw); - if (ret < 0) { + if (ret < 0) dev_err(scomp->dev, "error: tplg component load failed %d\n", ret); - ret = -EINVAL; - } release_firmware(fw); From patchwork Mon Apr 14 06:32:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049827 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 D1D762F32 for ; Mon, 14 Apr 2025 06:33:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612404; cv=none; b=DJC7nQxgZ7ovkW6ojDDdpbY2EkbnR5q/lPYK9reS+7Y5b+dFgaeJ/dsVjTbf0EDlb7hpzZ8jmlMyuTv+VBU7HbJs6C1/xW9TucMTwyVTkaxOWEA1K8SkPKKEJUr/eH9SlNNZkPnLgDTjpDhVBzAj7TMWnzlrfVLIjWuLfdAP+Y8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612404; c=relaxed/simple; bh=OJoIbJZFduZSR7jjrEVMMz4t9m4/hhNBKBcK02Eoigo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MbKNOBHynlk3GEuF/6hOZwcKCFcedS/g5Q2D0Tf5sJDuKUslLgdP6RUwceeNRM2/D9m0Rv8mwaCPeDHJI/XINLtI3DnDBaHFX+PITO4E+21H/BTGpIhiJFPxrcgD1lQF/AlDDhdYTX9/YqzKxsWp9TdloGOKj6v4CGZYTVxDYC0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fDHaAbCy; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fDHaAbCy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612403; x=1776148403; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OJoIbJZFduZSR7jjrEVMMz4t9m4/hhNBKBcK02Eoigo=; b=fDHaAbCyzzDFktCNcRKhXOtQPixoj+Rj8aVg5WUWeI96l8t3R7ULDdIh Rdp2QrMLTcAtCZF+MLuh7Ay+JGayrmhfIcO2oG8qWkwbh77kXJMvM5TDv QcFDx4MWX8huDrWP56+yq98SUqIy7XFmbpFgh1222is/+gGxJNrDZkb68 G9G41Ju9wsfGV38LmTz4Fd1MldvJ0Q4/zMySfUegVHYDa7ae4XRUupFkL X1mdVFfbPmLkX1zgFWR2SsRodvXd0ak53FTBjL2MV81noKHbxoooKB61T CUYTyhc45Xdbqbgsi1hgwwrINfUuS6aNtVG7gmpbDs82YUkAMkdhWP5Tm g==; X-CSE-ConnectionGUID: Jlm1UBkLTrWPiO0rtJ+/qw== X-CSE-MsgGUID: HRpKawOtT+u1MiExYIz36A== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872616" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872616" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:23 -0700 X-CSE-ConnectionGUID: osMA5DuaSZKyfpQC7YOscQ== X-CSE-MsgGUID: yj7vHVmmTquHM0ZnU6Zzwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275272" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:22 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 03/11] ASoC: soc-acpi: add get_function_tplg_files ops Date: Mon, 14 Apr 2025 14:32:31 +0800 Message-ID: <20250414063239.85200-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We always use a single topology that contains all PCM devices belonging to a machine configuration. However, with SDCA, we want to be able to load function topologies based on the supported device functions. This change is in preparation for loading those function topologies. Signed-off-by: Bard Liao Reviewed-by: Liam Girdwood Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- include/sound/soc-acpi.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h index 72e371a21767..b8af309c2683 100644 --- a/include/sound/soc-acpi.h +++ b/include/sound/soc-acpi.h @@ -10,6 +10,7 @@ #include #include #include +#include struct snd_soc_acpi_package_context { char *name; /* package name */ @@ -193,6 +194,15 @@ struct snd_soc_acpi_link_adr { * is not constant since this field may be updated at run-time * @sof_tplg_filename: Sound Open Firmware topology file name, if enabled * @tplg_quirk_mask: quirks to select different topology files dynamically + * @get_function_tplg_files: This is an optional callback, if specified then instead of + * the single sof_tplg_filename the callback will return the list of function topology + * files to be loaded. + * Return value: The number of the files or negative ERRNO. 0 means that the single topology + * file should be used, no function topology split can be used on the machine. + * @card: the pointer of the card + * @mach: the pointer of the machine driver + * @prefix: the prefix of the topology file name. Typically, it is the path. + * @tplg_files: the pointer of the array of the topology file names. */ /* Descriptor for SST ASoC machine driver */ struct snd_soc_acpi_mach { @@ -212,6 +222,9 @@ struct snd_soc_acpi_mach { struct snd_soc_acpi_mach_params mach_params; const char *sof_tplg_filename; const u32 tplg_quirk_mask; + int (*get_function_tplg_files)(struct snd_soc_card *card, + const struct snd_soc_acpi_mach *mach, + const char *prefix, const char ***tplg_files); }; #define SND_SOC_ACPI_MAX_CODECS 3 From patchwork Mon Apr 14 06:32:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049828 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 260EC2CCC1 for ; Mon, 14 Apr 2025 06:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612406; cv=none; b=Ef51Qtg5WXQ35Hl53W50BW4SMA4rYksUs1KdlAIDuSLVGeMzj2GXOaupZoxlu9bZh+Ch0lsBTZp5t1zZBfcY0eZ7fgkXG+XWlV3miJJVFApeeuPXwB/wFNldrE7kKPFju/JBZn3OSZTqTSvWiJ0yzM+tiKdo7vnqiQqmNfde+zo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612406; c=relaxed/simple; bh=jgYhblBIAv42DeHHVoOcJkpLQ3MyQPZeuy8BMTkgCv0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FcAUDEHKerY/p/4mzlTu/qtARR32yEpNVOPW3bGB1gM9848zDF4vruD1u3wzFo77rb0voa6BV/tkrDN2RCE1/KyYNuimsPJhuJqyPhgQDszm7FUqH18FCjZISBFf4M5zl9yd/GrQEvVJA6BrTs1vviK/b5bW99qoz9T9Ud4ocy0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AEzxOsc9; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AEzxOsc9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612405; x=1776148405; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jgYhblBIAv42DeHHVoOcJkpLQ3MyQPZeuy8BMTkgCv0=; b=AEzxOsc97g9zpSowGybBjs3RXLZLccjnM1aOe2yQhsoS7P2kHHdKrSVL x6qfIvGwNwJzEymu8TOGvqIrG+C5tz7kM066xDr2gyyaDAgThKgfOA4MY SjQpa9GR1q37rB3y0euLPqPE5njUSsp/1tXID9dwhYpH7BqPhu1lBAiVy XxOX33FF49aj9b8xHzH10AtDsyNAQim94uzzsrBvIIZrpChmxHQeqJZ2y 8qyir/pB8Pzgy3gmIB3B3OLmqjwvV0sHc3jwUsWs3K/V1OO1D7ddRnNMa mw6r9tX2edeKQmxxvkljnA+gzKunK0lseIpmf0+Kgr+YiFLbqUWRbs28c g==; X-CSE-ConnectionGUID: B0Jy0cU5S56eyOnYpMmqVw== X-CSE-MsgGUID: HKd7uJDpSO6aFP3AuyOOow== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872621" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872621" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:25 -0700 X-CSE-ConnectionGUID: xyjvc4V3T16dI/l8ygORaw== X-CSE-MsgGUID: /KNK8YO2TX2MlqLCE0GWBQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275287" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:24 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 04/11] ASoC: SOF: topology: load multiple topologies Date: Mon, 14 Apr 2025 14:32:32 +0800 Message-ID: <20250414063239.85200-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently, we always use single topology file to describe the widgets. However, with SDCA, we want to be able to load sub-topologies based on the supported device functions. Signed-off-by: Bard Liao Reviewed-by: Liam Girdwood Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- sound/soc/sof/topology.c | 86 +++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 18 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index fc4a9cddd162..e19ba94f2c80 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2310,8 +2310,10 @@ static const struct snd_soc_tplg_ops sof_tplg_ops = { .link_load = sof_link_load, .link_unload = sof_link_unload, - /* completion - called at completion of firmware loading */ - .complete = sof_complete, + /* + * No need to set the complete callback. sof_complete will be called explicitly after + * topology loading is complete. + */ /* manifest - optional to inform component of manifest */ .manifest = sof_manifest, @@ -2467,34 +2469,82 @@ static const struct snd_soc_tplg_ops sof_dspless_tplg_ops = { int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) { struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); + struct snd_sof_pdata *sof_pdata = sdev->pdata; + const char *tplg_filename_prefix = sof_pdata->tplg_filename_prefix; const struct firmware *fw; + const char **tplg_files; + int tplg_cnt = 0; int ret; + int i; - dev_dbg(scomp->dev, "loading topology:%s\n", file); + tplg_files = kcalloc(scomp->card->num_links, sizeof(char *), GFP_KERNEL); + if (!tplg_files) + return -ENOMEM; - ret = request_firmware(&fw, file, scomp->dev); - if (ret < 0) { - dev_err(scomp->dev, "error: tplg request firmware %s failed err: %d\n", - file, ret); - dev_err(scomp->dev, - "you may need to download the firmware from https://github.com/thesofproject/sof-bin/\n"); - return ret; + if (sof_pdata->machine->get_function_tplg_files) { + tplg_cnt = sof_pdata->machine->get_function_tplg_files(scomp->card, + sof_pdata->machine, + tplg_filename_prefix, + &tplg_files); + if (tplg_cnt < 0) { + kfree(tplg_files); + return tplg_cnt; + } } - if (sdev->dspless_mode_selected) - ret = snd_soc_tplg_component_load(scomp, &sof_dspless_tplg_ops, fw); - else - ret = snd_soc_tplg_component_load(scomp, &sof_tplg_ops, fw); + /* + * The monolithic topology will be used if there is no get_function_tplg_files + * callback or the callback returns 0. + */ + if (!tplg_cnt) { + tplg_files[0] = file; + tplg_cnt = 1; + dev_dbg(scomp->dev, "loading topology: %s\n", file); + } else { + dev_info(scomp->dev, "Using function topologies instead %s\n", file); + } + + for (i = 0; i < tplg_cnt; i++) { + /* Only print the file names if the function topologies are used */ + if (tplg_files[0] != file) + dev_info(scomp->dev, "loading topology %d: %s\n", i, tplg_files[i]); + + ret = request_firmware(&fw, tplg_files[i], scomp->dev); + if (ret < 0) { + /* + * snd_soc_tplg_component_remove(scomp) will be called + * if snd_soc_tplg_component_load(scomp) failed and all + * objects in the scomp will be removed. No need to call + * snd_soc_tplg_component_remove(scomp) here. + */ + dev_err(scomp->dev, "tplg request firmware %s failed err: %d\n", + tplg_files[i], ret); + goto out; + } - if (ret < 0) - dev_err(scomp->dev, "error: tplg component load failed %d\n", - ret); + if (sdev->dspless_mode_selected) + ret = snd_soc_tplg_component_load(scomp, &sof_dspless_tplg_ops, fw); + else + ret = snd_soc_tplg_component_load(scomp, &sof_tplg_ops, fw); + + release_firmware(fw); + + if (ret < 0) { + dev_err(scomp->dev, "tplg %s component load failed %d\n", + tplg_files[i], ret); + goto out; + } + } - release_firmware(fw); + /* call sof_complete when topologies are loaded successfully */ + ret = sof_complete(scomp); +out: if (ret >= 0 && sdev->led_present) ret = snd_ctl_led_request(); + kfree(tplg_files); + return ret; } EXPORT_SYMBOL(snd_sof_load_topology); From patchwork Mon Apr 14 06:32:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049829 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 7B43619FA92 for ; Mon, 14 Apr 2025 06:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612409; cv=none; b=WCxtXTWk3629tFPsX4eukBRdt5FzqJp+aCJxlmOs4TRaIltaLBQLzBXa/YCyxwrJxYeQgr/yJd3eflekLERlvXuSQgeLEzolcnukxm3rmtm1BpHvvx5xEL0rmKabfD9avRIrTZeeUk43qSnYVTD9xi1CjxLY+ASMq3cq892DMYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612409; c=relaxed/simple; bh=/mZ/xct1ow4dvcqLq3ti+aSQS0YhxRKMzCb1BS8yvqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ewiFbPsieGsmnL30m3tkSm9XSEy2OK3X8yRygqjQBh7xux2INVm9oqIJFtbqP1j/AeEsGLTccsYw8S/VP2RMIpPJD22AEooBh8k7VwgTiMZki99TA4jABurOD4ZcMgV+UJVRmtlyJyD/jG7RbpaFyYs0telq2Pnoxcrz2HleuJ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dTae6zJF; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dTae6zJF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612407; x=1776148407; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/mZ/xct1ow4dvcqLq3ti+aSQS0YhxRKMzCb1BS8yvqk=; b=dTae6zJFCgMrGsqhGyYwvtmeZ7wqRkHpDNNQKDf5wHz6AHyd1eB3gktR BeEnejK1oK+Xurwnc5vAsbZP+urCmCK7q9aEhPS+rypOQTjq1bmKXjB5C ZwjtwG7bR+5y8KdDa6MIN6Bv/edKEaO4o/w6dMOyjUqovbIwYW6K0Qlzs 6CWzGiNhY1n5nq/or9OFGg7EU+wXabkqdvxaQppsSgWZKKC5uwaxohAib 6zYLJCL0+klhK46+beUA8PBS7Tbe1zURF+bCsMv1X43Vn3tJVgREYmrvF vuaQmcnFtAYpVwkH6vDV/pkir+Il6lHwbJiq/x0k7MgXxIOtWZGcdaXzX Q==; X-CSE-ConnectionGUID: CNyKS0vLR8OeaC2BHh3GRQ== X-CSE-MsgGUID: AOw5S+vTSzy5By84wQLvtQ== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872629" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872629" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:27 -0700 X-CSE-ConnectionGUID: ZQNiitT6ReKqM2aTh1S4kw== X-CSE-MsgGUID: P1TJdpqQQxeCB8RKEYzFbQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275291" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:26 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 05/11] ASoC: Intel: add sof_sdw_get_tplg_files ops Date: Mon, 14 Apr 2025 14:32:33 +0800 Message-ID: <20250414063239.85200-6-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add sof_sdw_get_tplg_files ops to get sub-topology file names for the sof_sdw card. Signed-off-by: Bard Liao Reviewed-by: Liam Girdwood Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- sound/soc/intel/common/Makefile | 2 +- .../intel/common/sof-function-topology-lib.c | 135 ++++++++++++++++++ .../intel/common/sof-function-topology-lib.h | 15 ++ 3 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 sound/soc/intel/common/sof-function-topology-lib.c create mode 100644 sound/soc/intel/common/sof-function-topology-lib.h diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile index 0afd114be9e5..7822bcae6c69 100644 --- a/sound/soc/intel/common/Makefile +++ b/sound/soc/intel/common/Makefile @@ -12,7 +12,7 @@ snd-soc-acpi-intel-match-y := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-matc soc-acpi-intel-lnl-match.o \ soc-acpi-intel-ptl-match.o \ soc-acpi-intel-hda-match.o \ - soc-acpi-intel-sdw-mockup-match.o + soc-acpi-intel-sdw-mockup-match.o sof-function-topology-lib.o snd-soc-acpi-intel-match-y += soc-acpi-intel-ssp-common.o diff --git a/sound/soc/intel/common/sof-function-topology-lib.c b/sound/soc/intel/common/sof-function-topology-lib.c new file mode 100644 index 000000000000..90fe7aa3df1c --- /dev/null +++ b/sound/soc/intel/common/sof-function-topology-lib.c @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2025 Intel Corporation. +// + +#include +#include +#include +#include +#include +#include "sof-function-topology-lib.h" + +enum tplg_device_id { + TPLG_DEVICE_SDCA_JACK, + TPLG_DEVICE_SDCA_AMP, + TPLG_DEVICE_SDCA_MIC, + TPLG_DEVICE_INTEL_PCH_DMIC, + TPLG_DEVICE_HDMI, + TPLG_DEVICE_MAX +}; + +#define SDCA_DEVICE_MASK (BIT(TPLG_DEVICE_SDCA_JACK) | BIT(TPLG_DEVICE_SDCA_AMP) | \ + BIT(TPLG_DEVICE_SDCA_MIC)) + +#define SOF_INTEL_PLATFORM_NAME_MAX 4 + +int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_mach *mach, + const char *prefix, const char ***tplg_files) +{ + struct snd_soc_acpi_mach_params mach_params = mach->mach_params; + struct snd_soc_dai_link *dai_link; + const struct firmware *fw; + char platform[SOF_INTEL_PLATFORM_NAME_MAX]; + unsigned long tplg_mask = 0; + int tplg_num = 0; + int tplg_dev; + int ret; + int i; + + ret = sscanf(mach->sof_tplg_filename, "sof-%3s-*.tplg", platform); + if (ret != 1) { + dev_err(card->dev, "Invalid platform name %s of tplg %s\n", + platform, mach->sof_tplg_filename); + return -EINVAL; + } + + for_each_card_prelinks(card, i, dai_link) { + char *tplg_dev_name; + + dev_dbg(card->dev, "dai_link %s id %d\n", dai_link->name, dai_link->id); + if (strstr(dai_link->name, "SimpleJack")) { + tplg_dev = TPLG_DEVICE_SDCA_JACK; + tplg_dev_name = "sdca-jack"; + } else if (strstr(dai_link->name, "SmartAmp")) { + tplg_dev = TPLG_DEVICE_SDCA_AMP; + tplg_dev_name = devm_kasprintf(card->dev, GFP_KERNEL, + "sdca-%damp", dai_link->num_cpus); + if (!tplg_dev_name) + return -ENOMEM; + } else if (strstr(dai_link->name, "SmartMic")) { + tplg_dev = TPLG_DEVICE_SDCA_MIC; + tplg_dev_name = "sdca-mic"; + } else if (strstr(dai_link->name, "dmic")) { + switch (mach_params.dmic_num) { + case 2: + tplg_dev_name = "dmic-2ch"; + break; + case 4: + tplg_dev_name = "dmic-4ch"; + break; + default: + dev_warn(card->dev, + "only -2ch and -4ch are supported for dmic\n"); + continue; + } + tplg_dev = TPLG_DEVICE_INTEL_PCH_DMIC; + } else if (strstr(dai_link->name, "iDisp")) { + tplg_dev = TPLG_DEVICE_HDMI; + tplg_dev_name = "hdmi-pcm5"; + + } else { + /* The dai link is not supported by separated tplg yet */ + dev_dbg(card->dev, + "dai_link %s is not supported by separated tplg yet\n", + dai_link->name); + return 0; + } + if (tplg_mask & BIT(tplg_dev)) + continue; + + tplg_mask |= BIT(tplg_dev); + + /* + * The tplg file naming rule is sof---id.tplg + * where is only required for the DMIC function as the nhlt blob + * is platform dependent. + */ + switch (tplg_dev) { + case TPLG_DEVICE_INTEL_PCH_DMIC: + (*tplg_files)[tplg_num] = devm_kasprintf(card->dev, GFP_KERNEL, + "%s/sof-%s-%s-id%d.tplg", + prefix, platform, + tplg_dev_name, dai_link->id); + break; + default: + (*tplg_files)[tplg_num] = devm_kasprintf(card->dev, GFP_KERNEL, + "%s/sof-%s-id%d.tplg", + prefix, tplg_dev_name, + dai_link->id); + break; + } + if (!(*tplg_files)[tplg_num]) + return -ENOMEM; + tplg_num++; + } + + dev_dbg(card->dev, "tplg_mask %#lx tplg_num %d\n", tplg_mask, tplg_num); + + /* Check presence of sub-topologies */ + for (i = 0; i < tplg_num; i++) { + ret = firmware_request_nowarn(&fw, (*tplg_files)[i], card->dev); + if (!ret) { + release_firmware(fw); + } else { + dev_dbg(card->dev, "Failed to open topology file: %s\n", (*tplg_files)[i]); + return 0; + } + } + + return tplg_num; +} + diff --git a/sound/soc/intel/common/sof-function-topology-lib.h b/sound/soc/intel/common/sof-function-topology-lib.h new file mode 100644 index 000000000000..e7d0c39d0788 --- /dev/null +++ b/sound/soc/intel/common/sof-function-topology-lib.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * soc-acpi-intel-get-tplg.h - get-tplg-files ops + * + * Copyright (c) 2025, Intel Corporation. + * + */ + +#ifndef _SND_SOC_ACPI_INTEL_GET_TPLG_H +#define _SND_SOC_ACPI_INTEL_GET_TPLG_H + +int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_mach *mach, + const char *prefix, const char ***tplg_files); + +#endif From patchwork Mon Apr 14 06:32:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049830 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 C31B619FA92 for ; Mon, 14 Apr 2025 06:33:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612411; cv=none; b=da5sZwNo0PujGyAEZtAHakqFvAcftN5lbDVvPm5+kMmANFK8njm+hPp0uYA85nRrDz7WpC9BN+01GxXD4ArNAICbTH+MlI961qnsV58/IMrNvENF/tPSzvXzXXCgAZiksLqf619vKS+N9fFdBAIkhnh3QIWiyStOmorkbyHmkmM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612411; c=relaxed/simple; bh=u6N/SpTVLhp3URmn/ZVL8fulX+PHhuD5LUKKCz/iDrk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bsXlURYcMj3PATYmj5vIzlu4iSQ/3qC/0Te5iF4SyHT+gHNPfvFuoq7VKl/1OcmtEvBijsHez4Yxfej0E4e9vUxOpkiVYVtMp6gfe6QB0RM8IoVd+7xwsysguZSlydMCwy6D/zg4Pgt+tamXk1qw/PGeB7+23gMqqbwNLAO8LnM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XLsY9A2g; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XLsY9A2g" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612410; x=1776148410; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u6N/SpTVLhp3URmn/ZVL8fulX+PHhuD5LUKKCz/iDrk=; b=XLsY9A2g/Jq3nKm4aIN5CrF5vmpFkiCi7u4vrjwl3GheYPUjgTTK43sR 2GsON/t/dHXuJhrg+DVhe3DCWCsEnQwUjf/9LpodNVi0Ere6TF0pPVVvo F5uqZl+UxCeUK+IG6MRPDEwxcl5WHPaoyqIwhNpf2/31M61gcg8MsMp8/ t6Xt2IkQfTT3d+GHaqHeFNEK3evofm/7QZHWEG0lT8faP82v/RkMCrbAj ePcGpaqcJ/zmsp25bDa/RfAq2ZlNYT5Tketa+JWpdSW/UDVULcJGd3cTT Sa0T2OxJ3s7cOZoRgUCgu7ec7jzU4g5T+B7hcN7gAA358T7vWmOwztxrb A==; X-CSE-ConnectionGUID: Zz5F69YLRZ6yvAh3UlCufQ== X-CSE-MsgGUID: R2XeSjgGQTuX+qJ5CmX1gQ== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872635" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872635" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:30 -0700 X-CSE-ConnectionGUID: +ggUzl8XRmml9ReKkynnRA== X-CSE-MsgGUID: /n6HSjMNQEKt3+12F4OHxQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275296" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:29 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 06/11] ASoC: Intel: soc-acpi-intel-lnl-match: set get_function_tplg_files ops Date: Mon, 14 Apr 2025 14:32:34 +0800 Message-ID: <20250414063239.85200-7-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The audio configs with multi-function SDCA codecs can use the sof_sdw_get_tplg_files ops to get function topologies dynamically. Signed-off-by: Bard Liao Reviewed-by: Liam Girdwood Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- sound/soc/intel/common/soc-acpi-intel-lnl-match.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/common/soc-acpi-intel-lnl-match.c b/sound/soc/intel/common/soc-acpi-intel-lnl-match.c index e04f6de746eb..a2bee667facb 100644 --- a/sound/soc/intel/common/soc-acpi-intel-lnl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-lnl-match.c @@ -8,6 +8,7 @@ #include #include +#include "sof-function-topology-lib.h" #include "soc-acpi-intel-sdca-quirks.h" #include "soc-acpi-intel-sdw-mockup-match.h" @@ -712,6 +713,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = { .links = lnl_cs42l43_l0, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-lnl-cs42l43-l0.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0), @@ -730,6 +732,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = { .links = lnl_rt722_only, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-lnl-rt722-l0.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = GENMASK(2, 0), @@ -748,14 +751,16 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = { .links = lnl_sdw_rt712_vb_l2_rt1320_l1, .drv_name = "sof_sdw", .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, - .sof_tplg_filename = "sof-lnl-rt712-l2-rt1320-l1.tplg" + .sof_tplg_filename = "sof-lnl-rt712-l2-rt1320-l1.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(1) | BIT(2) | BIT(3), .links = lnl_sdw_rt713_vb_l2_rt1320_l13, .drv_name = "sof_sdw", .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, - .sof_tplg_filename = "sof-lnl-rt713-l2-rt1320-l13.tplg" + .sof_tplg_filename = "sof-lnl-rt713-l2-rt1320-l13.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, {}, }; From patchwork Mon Apr 14 06:32:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049831 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 552D119FA92 for ; Mon, 14 Apr 2025 06:33:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612413; cv=none; b=ifBZyZFGvGI/mjRXEmCOa7w1iorZlPNWTZ22m498mLIfVFdeIStatlKCI+/xN2ArgJxpanZY1Th42aYHGVP44ZEbR7NEfetvLGazgZMdPgM+NIIC2h2BkT+Q7TD4EF6KDuRWPuZUfBuXmiuZLVrzcVUTNVbBKwxLWEhhSQk7FVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612413; c=relaxed/simple; bh=YC1lLXjtQoYoTT2C+5WBVbRujJ4LcLZ15w/Kv/O6nKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q8uZ4y8neEFOKu2wF1o2YjOXcdakkyQvt1cEBoN5oGAt3Ry0YOs87U3yErlBW5BB0RvN+VAe3vh1ixiiL/VnlKfnXsOI1vpxNX9B3o5CtG5RRmEqJL8wt683RljnYcLdislW71q/k2y9Rz7X1jCWX5aY3++Uz4HGV77lDe/LdWY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CxYBnOfo; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CxYBnOfo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612412; x=1776148412; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YC1lLXjtQoYoTT2C+5WBVbRujJ4LcLZ15w/Kv/O6nKw=; b=CxYBnOfoUdDmGmTva2xEYhgS99LvEpeU7ERTWsn5l8FmIivRbinZaWWR k4spklgOX5dcNnvKyN3uXT8Y2AI8UGDEjn23ok/Qrch67CdMS4sIKPlaq 2dwn2/IvacU36XLcjlxqqn8rGzPe1h4OnNzBQVbCz3dFPCzq3hUiveg5a rzkIx6rpT3xZC3sF6msE/gSFcII8sHlyU6Tmw1DhbPeyk+2foQwe9H6QN eucQsQAyVnNSYDW101luMDli25DDWK1E6HhY6oDzs2UYp9ytzhHFJDO0K B9RobjfZxGgMrpGtAsYPTSrt+B0nTkBb0Uz/WlWJ+wUU3idEoxiA8YHgs w==; X-CSE-ConnectionGUID: yfCGW8jKR62oHqH36/zl9g== X-CSE-MsgGUID: yCRGLDnTS/GZOoS/b7UkqQ== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872641" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872641" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:32 -0700 X-CSE-ConnectionGUID: oLZv2L53SAuLdhondxA3XA== X-CSE-MsgGUID: 1lWaURzBR4ShodPGnaHMXQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275302" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:31 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 07/11] ASoC: Intel: soc-acpi-intel-arl-match: set get_function_tplg_files ops Date: Mon, 14 Apr 2025 14:32:35 +0800 Message-ID: <20250414063239.85200-8-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The audio configs with multi-function SDCA codecs can use the sof_sdw_get_tplg_files ops to get function topologies dynamically. Signed-off-by: Bard Liao Reviewed-by: Liam Girdwood Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- sound/soc/intel/common/soc-acpi-intel-arl-match.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/soc/intel/common/soc-acpi-intel-arl-match.c b/sound/soc/intel/common/soc-acpi-intel-arl-match.c index 32147dc9d2d6..73e581e93755 100644 --- a/sound/soc/intel/common/soc-acpi-intel-arl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-arl-match.c @@ -8,6 +8,7 @@ #include #include #include +#include "sof-function-topology-lib.h" static const struct snd_soc_acpi_endpoint single_endpoint = { .num = 0, @@ -436,42 +437,49 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = { .links = arl_cs42l43_l0_cs35l56_l23, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0) | BIT(2) | BIT(3), .links = arl_cs42l43_l0_cs35l56_2_l23, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0) | BIT(2) | BIT(3), .links = arl_cs42l43_l0_cs35l56_3_l23, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0) | BIT(2), .links = arl_cs42l43_l0_cs35l56_l2, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l2.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0), .links = arl_cs42l43_l0, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-arl-cs42l43-l0.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(2), .links = arl_cs42l43_l2, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-arl-cs42l43-l2.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(2) | BIT(3), .links = arl_cs42l43_l2_cs35l56_l3, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-arl-cs42l43-l2-cs35l56-l3.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = 0x1, /* link0 required */ @@ -490,6 +498,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = { .links = arl_rt722_l0_rt1320_l2, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-arl-rt722-l0_rt1320-l2.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, {}, }; From patchwork Mon Apr 14 06:32:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049832 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 A84AD19D07A for ; Mon, 14 Apr 2025 06:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612416; cv=none; b=erjA/LgmSDahLKL0ShGtDK5YRHhhRT3SoxzN04px8exmwdBjPxVFWiu+Rp3vnezNAOOX6P88fWHBW/GJkRuS/GVKxO6eYkHikmY0YUVATKwKJuuoDMehMfSIxEC3+I+IXTdaEf/+rhbDPSv9Ei1EBFSey2/OVDNLa/2HuHPMDko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612416; c=relaxed/simple; bh=h1PhqnWpiBBlfAfNTdhq4rCb1CSU99PMrDmvB0KD9Yc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sL/CjAGY4thmU89fMM41Pxv6fZMO/4++gs+1njDT/8/JgBwokdoWZYT1hL7LqcdLcCutF/WOXaxBzmhZD1MYdSEe23ZYdSrFuNYIqBqZgwAxrzh42v/yJX9F/NZb4CePjMk8wzqX33kfZ9sVpg7uH9II+s4cydMt8MBQ6ddeWPU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OvTAqs3y; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OvTAqs3y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612415; x=1776148415; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=h1PhqnWpiBBlfAfNTdhq4rCb1CSU99PMrDmvB0KD9Yc=; b=OvTAqs3y2OQ+dwhuYESU/oLmyKZVBVhfe75NSBaHR4KrdkQCdXImVjJb Lb04X66RBdhC9ikfgaB4hGOKnzMuBaU48R4NdO7mQ3twRxnyqDXCzJ1Kf vbuk8qSgX+3nUQisRiDhmy1zg50Om/dgXI/3cNL+XmMrjq7orVFJVXwVs eSiKGmxknohpMrSVW+Z+tCWRQbOJCezgc0SwgdNghtWRamxiKAt2XI5Oo Vv0pJ2Hy/coYSBGBRNLqvIEuYzXOoS9MfOfdJvYEyM93QiNoGIrJwO1mE oCilOdjIXdcTJBdeFC3MdoYSyV6TAUpruy9Rg+HT5+WSpwUqQCuCNXC5S g==; X-CSE-ConnectionGUID: xor24tmdQ2eSBRkFt9UHGg== X-CSE-MsgGUID: JagHm5D+QDKekiE+cD/X4w== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872647" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872647" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:34 -0700 X-CSE-ConnectionGUID: EhD4i3QzRqSxedEW5gYy4g== X-CSE-MsgGUID: B+4eWpXETo2tG4CKbL1N7w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275310" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:34 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 08/11] ASoC: Intel: soc-acpi-intel-ptl-match: add get_function_tplg_files ops Date: Mon, 14 Apr 2025 14:32:36 +0800 Message-ID: <20250414063239.85200-9-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The audio configs with multi-function SDCA codecs can use the sof_sdw_get_tplg_files ops to get function topologies dynamically. Signed-off-by: Bard Liao Reviewed-by: Liam Girdwood Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- .../soc/intel/common/soc-acpi-intel-ptl-match.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/common/soc-acpi-intel-ptl-match.c b/sound/soc/intel/common/soc-acpi-intel-ptl-match.c index 6603d8de501c..992729582562 100644 --- a/sound/soc/intel/common/soc-acpi-intel-ptl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-ptl-match.c @@ -8,6 +8,7 @@ #include #include +#include "sof-function-topology-lib.h" #include "soc-acpi-intel-sdca-quirks.h" #include "soc-acpi-intel-sdw-mockup-match.h" #include @@ -586,52 +587,60 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = { .links = ptl_rt721_l3, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-ptl-rt721.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0), .links = ptl_rt722_only, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-ptl-rt722.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(1), .links = ptl_rt722_l1, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-ptl-rt722.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(3), .links = ptl_rt722_l3, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-ptl-rt722.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(1) | BIT(2), .links = ptl_sdw_rt712_vb_l2_rt1320_l1, .drv_name = "sof_sdw", .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, - .sof_tplg_filename = "sof-ptl-rt712-l2-rt1320-l1.tplg" + .sof_tplg_filename = "sof-ptl-rt712-l2-rt1320-l1.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(2) | BIT(3), .links = ptl_sdw_rt712_vb_l3_rt1320_l2, .drv_name = "sof_sdw", .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, - .sof_tplg_filename = "sof-ptl-rt712-l3-rt1320-l2.tplg" + .sof_tplg_filename = "sof-ptl-rt712-l3-rt1320-l2.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(1) | BIT(2) | BIT(3), .links = ptl_sdw_rt713_vb_l2_rt1320_l13, .drv_name = "sof_sdw", .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, - .sof_tplg_filename = "sof-ptl-rt713-l2-rt1320-l13.tplg" + .sof_tplg_filename = "sof-ptl-rt713-l2-rt1320-l13.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(1) | BIT(2) | BIT(3), .links = ptl_sdw_rt713_vb_l3_rt1320_l12, .drv_name = "sof_sdw", .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, - .sof_tplg_filename = "sof-ptl-rt713-l3-rt1320-l12.tplg" + .sof_tplg_filename = "sof-ptl-rt713-l3-rt1320-l12.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, {}, }; From patchwork Mon Apr 14 06:32:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049833 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 ED71B19FA92 for ; Mon, 14 Apr 2025 06:33:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612418; cv=none; b=fQsiWwaFKdqh199SNsPRwAwP13Efps6hxShdwN3KZeGCPTdBoz4tdsbxudkUHdXWqAcXalhJmdMtJCXrkv/SbNxs20DEXrxph1fEekU/OP0laZltGpAv+r33t9d1RxQaor9HaXEWgIzl40Dst+L6CLsedAWzYobYbP5Ld25yXMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612418; c=relaxed/simple; bh=hs0HkxwMrAfmMTP31qNqXzw4y/fHQWCpsmXvB59v4JM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Mxum+5hoVKHkROIQzeLbKaWjY1KerJ7F/DHUu1l9FsUuKUmGmK5Quwg62ko8tVJV/cPEXlIkQ1euKv8OGR8HJyPY2xdUHSHKhZ7W8XXDKpNCo0pftmVk7Usyf5TqUBS9krTUDFHwea9wAGzBNWvNW/A7FGRpyVcXnhGbPwq6gaA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=M1xF3/q7; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="M1xF3/q7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612417; x=1776148417; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hs0HkxwMrAfmMTP31qNqXzw4y/fHQWCpsmXvB59v4JM=; b=M1xF3/q71Nqva8JbUGeIzGWy1eniMq9p3QdFplcQFJ6VGMkrXXDib/N2 S5JTBxEytUMB3CE2LvibqJVcE2iGBQDn9ToA9KDDF7TbOcfmM/hvdFDlF zyDXzbcTasxo2pEEJQRhgX0c4V5khvFiVmjwdjQlntjl4ffhpcuYgcjwF in34b4cl78lL4ZbjuU5WsEZ9ssyoBf1AzhEOkWi7dWQGWFjyOftjjFMiv xiRbbkv5bNameGVEZo8M9c4Ah27BCOnKym9DVLzlezbOz6TeUrrXM+8+C DhVvTOFR87Tg7NfN5HFmyt4rSA1/MqCRe94hQ5nl0ujpL4L4Oz+UjT/MX g==; X-CSE-ConnectionGUID: iw+cM3YJQGuWXjO2S/5Tng== X-CSE-MsgGUID: Z3RLcw7dS3Ca0pq0itYiug== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872659" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872659" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:37 -0700 X-CSE-ConnectionGUID: TfyH4jhFRbmDp2WogyhBqQ== X-CSE-MsgGUID: yrjnkRlGT/2sWTl18cAUag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275317" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:36 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 09/11] ASoC: Intel: soc-acpi-intel-mtl-match: add get_function_tplg_files ops Date: Mon, 14 Apr 2025 14:32:37 +0800 Message-ID: <20250414063239.85200-10-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The audio configs with multi-function SDCA codecs can use the sof_sdw_get_tplg_files ops to get function topologies dynamically. Signed-off-by: Bard Liao Reviewed-by: Liam Girdwood Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- sound/soc/intel/common/soc-acpi-intel-mtl-match.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c index 9e611e3667ad..af131d26bd33 100644 --- a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c @@ -11,6 +11,7 @@ #include #include #include +#include "sof-function-topology-lib.h" #include "soc-acpi-intel-sdca-quirks.h" #include "soc-acpi-intel-sdw-mockup-match.h" @@ -1083,12 +1084,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { .drv_name = "sof_sdw", .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, .sof_tplg_filename = "sof-mtl-rt712-vb-l0.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0), .links = mtl_712_l0, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-rt712-l0.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = GENMASK(2, 0), @@ -1101,30 +1104,35 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { .links = cs42l43_link0_cs35l56_link2_link3, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-cs42l43-l0-cs35l56-l23.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0) | BIT(1) | BIT(3), .links = cs42l43_link3_cs35l56_x4_link0_link1_spkagg, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-cs42l43-l3-cs35l56-l01-spkagg.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = GENMASK(2, 0), .links = mtl_cs42l43_cs35l56, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-cs42l43-l0-cs35l56-l12.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0) | BIT(1), .links = mtl_cs35l56_x8_link0_link1_fb, .drv_name = "sof_sdw", - .sof_tplg_filename = "sof-mtl-cs35l56-l01-fb8.tplg" + .sof_tplg_filename = "sof-mtl-cs35l56-l01-fb8.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0), .links = mtl_cs42l43_l0, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-cs42l43-l0.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = GENMASK(3, 0), @@ -1143,6 +1151,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { .links = mtl_rt722_only, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-rt722-l0.tplg", + .get_function_tplg_files = sof_sdw_get_tplg_files, }, { .link_mask = BIT(0), From patchwork Mon Apr 14 06:32:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049834 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 4CB461A8F79 for ; Mon, 14 Apr 2025 06:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612420; cv=none; b=CBrHq1UPIiCWpMrSg6LvXY2vEq5g07y2Kv+a/s78uPaAHemyr5K8S1McvNYNN+nxdkE926bmaoasrRRr2ughGPJDlPXMPaWnrGdBXilBScZMM12GC+I2Z2j5SkCS/mEVvhoQsNxyIrR/VTfWI1IfLeCZ9XIQHo2G9EHuWFT2tUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612420; c=relaxed/simple; bh=+eKmeNAFfNUC1OMAKp3ZtwZm43cCAkTDIqMP12YkBGA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P/4avMUslWq+cQaGRwP0WSpz6scgeu4eA5ySbHKnweBp6nfcnef+0SR6FyXFMLNwYINiBBdUI6wjhuRa8St8oG6ql3q6eL6sKjKILHA7+1nD7E1QXyaezGLNUTBEVZctnDEdXPEiZtGrZSvljTnX2z8PHj4PL8rwlBTtnjs9PLU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NKDTgjzj; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NKDTgjzj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612419; x=1776148419; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+eKmeNAFfNUC1OMAKp3ZtwZm43cCAkTDIqMP12YkBGA=; b=NKDTgjzjsJANi9PzprjZkn/vyD5nwVTWXKKNyxa1fE+nhQqZ/Tpfy/Zs g2Ci+67ZG+mjIJ5qLVLt5eP+lwFRcMpJ04ApTWAyfdoNuUXfg6M1TglY9 eCWBVb0vHQCFNAaPB3c0z1Fr9JV00812LFo0qb3pzb7Pwax6MA9c8HFql I4Gya+ZKCFNzOlV54W1xDnwzzFTM40KFq5a4MkDgK1ymMFoB37BcD6OOA bH70JCNMN4pbscyu+uXVd9PpyxM+0JG868EWTjnxajoJ6ObUvwhT1F/Sg VP3PKe4B6JI5F29tlNoJDPar8agPpFCyyTFXgicx+gzkA6/LJrPbmzTeN A==; X-CSE-ConnectionGUID: zGpUi9sCT26OAVEChmXwCw== X-CSE-MsgGUID: n5iKkeEiSRK5SHLJy0kogA== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872664" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872664" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:39 -0700 X-CSE-ConnectionGUID: dIbc5NjYR2mAQXb0UMMK9Q== X-CSE-MsgGUID: yW4RHhJsTsq4WpghXKjLjg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275324" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:38 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 10/11] ASoC: sdw_utils: split asoc_sdw_get_codec_name Date: Mon, 14 Apr 2025 14:32:38 +0800 Message-ID: <20250414063239.85200-11-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently asoc_sdw_get_codec_name will return codec_info->codec_name if it is set. However, in some case we need the sdw codec name no matter if codec_info->codec_name is set or not. _asoc_sdw_get_codec_name() will be used in the follow up commit. Signed-off-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sdw_utils/soc_sdw_utils.c | 31 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c index 5175818ff2c1..4c5ce01eae5b 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -934,10 +934,10 @@ static bool asoc_sdw_is_unique_device(const struct snd_soc_acpi_link_adr *adr_li return true; } -const char *asoc_sdw_get_codec_name(struct device *dev, - const struct asoc_sdw_codec_info *codec_info, - const struct snd_soc_acpi_link_adr *adr_link, - int adr_index) +static const char *_asoc_sdw_get_codec_name(struct device *dev, + const struct asoc_sdw_codec_info *codec_info, + const struct snd_soc_acpi_link_adr *adr_link, + int adr_index) { u64 adr = adr_link->adr_d[adr_index].adr; unsigned int sdw_version = SDW_VERSION(adr); @@ -947,17 +947,24 @@ const char *asoc_sdw_get_codec_name(struct device *dev, unsigned int part_id = SDW_PART_ID(adr); unsigned int class_id = SDW_CLASS_ID(adr); - if (codec_info->codec_name) - return devm_kstrdup(dev, codec_info->codec_name, GFP_KERNEL); - else if (asoc_sdw_is_unique_device(adr_link, sdw_version, mfg_id, part_id, - class_id, adr_index)) + if (asoc_sdw_is_unique_device(adr_link, sdw_version, mfg_id, part_id, + class_id, adr_index)) return devm_kasprintf(dev, GFP_KERNEL, "sdw:0:%01x:%04x:%04x:%02x", link_id, mfg_id, part_id, class_id); - else - return devm_kasprintf(dev, GFP_KERNEL, "sdw:0:%01x:%04x:%04x:%02x:%01x", - link_id, mfg_id, part_id, class_id, unique_id); - return NULL; + return devm_kasprintf(dev, GFP_KERNEL, "sdw:0:%01x:%04x:%04x:%02x:%01x", + link_id, mfg_id, part_id, class_id, unique_id); +} + +const char *asoc_sdw_get_codec_name(struct device *dev, + const struct asoc_sdw_codec_info *codec_info, + const struct snd_soc_acpi_link_adr *adr_link, + int adr_index) +{ + if (codec_info->codec_name) + return devm_kstrdup(dev, codec_info->codec_name, GFP_KERNEL); + + return _asoc_sdw_get_codec_name(dev, codec_info, adr_link, adr_index); } EXPORT_SYMBOL_NS(asoc_sdw_get_codec_name, "SND_SOC_SDW_UTILS"); From patchwork Mon Apr 14 06:32:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 14049835 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 9C2131A76D4 for ; Mon, 14 Apr 2025 06:33:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612423; cv=none; b=Fpncia43PeRy5EtTsXVuT5EI+4gXZOTrqH2g/NMpm6blCu3CkZT94s69afdYxXT5zWBqYHdpuxXGNUDInmGR2D+rfEmNaGWi3NAFWEsHOYO62thsUTLBmByqenejQSnwkE53n+zVFw/aCKAK8w9Hy2zcH4QiwcJVFevWIaCPz1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744612423; c=relaxed/simple; bh=RxeE0M5yOtCwPGDCbPhS0aueIm3+ZMVBg5s9hCl+U6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=S3AKnlUvy2SD72ZIaRoFN3bN3hCKYAVKcLMO7uQzkIYyF4aLwhqRl2XgRUHNp6oN6VyPY0fTV249mgAt+RS0mmxHz/Tdz/y9nyH2sKZZb/05xairwRp3MRgLDgmgSSDqFXP5c0R40TZ/bKgNWo83FQZFij6fGcqG8Ob5/uGEFBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YRJpQzVC; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YRJpQzVC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744612422; x=1776148422; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RxeE0M5yOtCwPGDCbPhS0aueIm3+ZMVBg5s9hCl+U6E=; b=YRJpQzVCoLCScV9zazLIpEqcsNPUHnO3+aJ1f1pwNpCqIZNV/U7es46s YJ4JVXCvghbrYWjNIgEYITEILTn6mjKIyCNiZuVmXQzxlatwNTjxHZrwF zRKeVV9OTUf9ZLdIfgtgif1Q9sVr7fblMpSZstB0s1FSx71YPe2tTO2EM 3xddQ92I78LtIaI/bGMS16mznIWYWYkf6nG75cuB5rYGGyse6JeywReeG Fi2mfKHOpSFbZmQMRMI+5HogeNjFz0P7uVSTnf+f+24LLkmJda/hu69jN flfSyTAD71Guq/pLurLpWEuT4ZDUXjXHaOpyGGEyPiuiSRa4wzCo9ZXgX Q==; X-CSE-ConnectionGUID: SOwOwnR1Tb2lPnWvL99mog== X-CSE-MsgGUID: ZKdJvc+MTxCfoVUiy121vA== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="49872673" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="49872673" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:41 -0700 X-CSE-ConnectionGUID: JPHVh+CESViDwRy2jbvZgg== X-CSE-MsgGUID: 9f1GqLzEQUmBGkRw2hfARg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="130275341" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.73]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 23:33:41 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 11/11] ASoC: soc_sdw_utils: skip the endpoint that doesn't present Date: Mon, 14 Apr 2025 14:32:39 +0800 Message-ID: <20250414063239.85200-12-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> References: <20250414063239.85200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A codec endpoint may not be used. We could check the present SDCA functions to know if the endpoint is used or not. Skip the endpoint which is not used. Signed-off-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sdw_utils/soc_sdw_utils.c | 137 +++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 3 deletions(-) diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c index 4c5ce01eae5b..60b731673f3b 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -10,6 +10,7 @@ #include #include #include +#include #include static const struct snd_soc_dapm_widget generic_dmic_widgets[] = { @@ -1131,6 +1132,106 @@ struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *dailinks } EXPORT_SYMBOL_NS(asoc_sdw_find_dailink, "SND_SOC_SDW_UTILS"); +static int asoc_sdw_get_dai_type(u32 type) +{ + switch (type) { + case SDCA_FUNCTION_TYPE_SMART_AMP: + case SDCA_FUNCTION_TYPE_SIMPLE_AMP: + return SOC_SDW_DAI_TYPE_AMP; + case SDCA_FUNCTION_TYPE_SMART_MIC: + case SDCA_FUNCTION_TYPE_SIMPLE_MIC: + case SDCA_FUNCTION_TYPE_SPEAKER_MIC: + return SOC_SDW_DAI_TYPE_MIC; + case SDCA_FUNCTION_TYPE_UAJ: + case SDCA_FUNCTION_TYPE_RJ: + case SDCA_FUNCTION_TYPE_SIMPLE_JACK: + return SOC_SDW_DAI_TYPE_JACK; + default: + return -EINVAL; + } +} + +/* + * Check if the SDCA endpoint is present by the SDW peripheral + * + * @dev: Device pointer + * @codec_info: Codec info pointer + * @adr_link: ACPI link address + * @adr_index: Index of the ACPI link address + * @end_index: Index of the endpoint + * + * Return: 1 if the endpoint is present, + * 0 if the endpoint is not present, + * negative error code. + */ + +static int is_sdca_endpoint_present(struct device *dev, + struct asoc_sdw_codec_info *codec_info, + const struct snd_soc_acpi_link_adr *adr_link, + int adr_index, int end_index) +{ + const struct snd_soc_acpi_adr_device *adr_dev = &adr_link->adr_d[adr_index]; + const struct snd_soc_acpi_endpoint *adr_end; + const struct asoc_sdw_dai_info *dai_info; + struct snd_soc_dai_link_component *dlc; + struct snd_soc_dai *codec_dai; + struct sdw_slave *slave; + struct device *sdw_dev; + const char *sdw_codec_name; + int i; + + dlc = kzalloc(sizeof(*dlc), GFP_KERNEL); + + adr_end = &adr_dev->endpoints[end_index]; + dai_info = &codec_info->dais[adr_end->num]; + + dlc->dai_name = dai_info->dai_name; + codec_dai = snd_soc_find_dai_with_mutex(dlc); + if (!codec_dai) { + dev_warn(dev, "codec dai %s not registered yet\n", dlc->dai_name); + kfree(dlc); + return -EPROBE_DEFER; + } + kfree(dlc); + + sdw_codec_name = _asoc_sdw_get_codec_name(dev, codec_info, + adr_link, adr_index); + if (!sdw_codec_name) + return -ENOMEM; + + sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, sdw_codec_name); + if (!sdw_dev) { + dev_err(dev, "codec %s not found\n", sdw_codec_name); + return -EINVAL; + } + + slave = dev_to_sdw_dev(sdw_dev); + if (!slave) + return -EINVAL; + + /* Make sure BIOS provides SDCA properties */ + if (!slave->sdca_data.interface_revision) { + dev_warn(&slave->dev, "SDCA properties not found in the BIOS\n"); + return 1; + } + + for (i = 0; i < slave->sdca_data.num_functions; i++) { + int dai_type = asoc_sdw_get_dai_type(slave->sdca_data.function[i].type); + + if (dai_type == dai_info->dai_type) { + dev_dbg(&slave->dev, "DAI type %d sdca function %s found\n", + dai_type, slave->sdca_data.function[i].name); + return 1; + } + } + + dev_dbg(&slave->dev, + "SDCA device function for DAI type %d not supported, skip endpoint\n", + dai_info->dai_type); + + return 0; +} + int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, struct asoc_sdw_dailink *soc_dais, struct asoc_sdw_endpoint *soc_ends, @@ -1159,6 +1260,7 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, const struct snd_soc_acpi_adr_device *adr_dev = &adr_link->adr_d[i]; struct asoc_sdw_codec_info *codec_info; const char *codec_name; + bool check_sdca = false; if (!adr_dev->name_prefix) { dev_err(dev, "codec 0x%llx does not have a name prefix\n", @@ -1189,6 +1291,9 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, soc_end->include_sidecar = true; } + if (SDW_CLASS_ID(adr_dev->adr) && adr_dev->num_endpoints > 1) + check_sdca = true; + for (j = 0; j < adr_dev->num_endpoints; j++) { const struct snd_soc_acpi_endpoint *adr_end; const struct asoc_sdw_dai_info *dai_info; @@ -1199,9 +1304,35 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, dai_info = &codec_info->dais[adr_end->num]; soc_dai = asoc_sdw_find_dailink(soc_dais, adr_end); - if (dai_info->quirk && - !(dai_info->quirk_exclude ^ !!(dai_info->quirk & ctx->mc_quirk))) - continue; + /* + * quirk should have higher priority than the sdca properties + * in the BIOS. We can't always check the DAI quirk because we + * will set the mc_quirk when the BIOS doesn't provide the right + * information. The endpoint will be skipped if the dai_info-> + * quirk_exclude and mc_quirk are both not set if we always skip + * the endpoint according to the quirk information. We need to + * keep the endpoint if it is present in the BIOS. So, only + * check the DAI quirk when the mc_quirk is set or SDCA endpoint + * present check is not needed. + */ + if (dai_info->quirk & ctx->mc_quirk || !check_sdca) { + /* + * Check the endpoint if a matching quirk is set or SDCA + * endpoint check is not necessary + */ + if (dai_info->quirk && + !(dai_info->quirk_exclude ^ !!(dai_info->quirk & ctx->mc_quirk))) + continue; + } else { + /* Check SDCA codec endpoint if there is no matching quirk */ + ret = is_sdca_endpoint_present(dev, codec_info, adr_link, i, j); + if (ret < 0) + return ret; + + /* The endpoint is not present, skip */ + if (!ret) + continue; + } dev_dbg(dev, "Add dev: %d, 0x%llx end: %d, dai: %d, %c/%c to %s: %d\n",