From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 ACD042071FA; Wed, 16 Oct 2024 10:23:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074232; cv=none; b=LthNHtxAx930cCNjcDY5J5R6Ja9DqhcfQ7pA/ioXMHB2mwwb+FhsS6MFO5KYVhbEKNitL5L7xLbhUC+JbFflS3Rgcz26IHs14B+ElU8AT4iZAVDrAQBh5dv6rxE4h7dnONCa29+zk99nO8uzw+xDIwVeZQcMgwIBLSWQY7uPfe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074232; c=relaxed/simple; bh=4jIe2xqSKVjGEWTr3xBGOmO3ircpkSEOO2331657ryA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tL5EYPoecTTh6CZY9TXqxnszCWHXxCr8i/ZBr8gBT6xoCVfqcqQTRaFxtb+6hDEjC7ROOTlECuwZu/bAVlf+195zfqwWsCveTo9t3xqkHMehKn2mmcerCyevPL3Xw/uABLOv3SPNC9KGy5G2Ilxgqvk9RH6rq8qZnSgLdEcj3Mc= 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=D3T47An1; arc=none smtp.client-ip=192.198.163.19 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="D3T47An1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074231; x=1760610231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4jIe2xqSKVjGEWTr3xBGOmO3ircpkSEOO2331657ryA=; b=D3T47An1Eb5C+UNYMP7tTgYVXlF/w1TUmtTZL/o35bZDXDmuhz0bXx53 u0O7H87C+qpTs7MSSDhXL5k4Y/3eQRC8lF12aWuZAUrBj8FgyykRCldkc OSrptHt5N/f071Pmy+zmTscnINQiGVR7Xtzb2U1B8VY9PrJCEVftmpDaH 2iXjA9dyLHqFMPo7dx+8t3L2bEktqCNI0NRk7tJ/NN3aYz9fb/dKzzFZE J8XMbHhfhmgdlJcvvprIXV4qi2AZ2ltAHtSj+S4uAi6+X/bldPcKi4a1j ohS0pd9ynoBpvWxsoyCD15bvSar6VbslsA4E8CW8J6W4UeZXEotcoQCNK A==; X-CSE-ConnectionGUID: 6LhsCupHRIeWpzcU0VSDdg== X-CSE-MsgGUID: +hGKKkyMQ8iSIFxCMKg2Ow== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985865" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985865" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:23:51 -0700 X-CSE-ConnectionGUID: GBp4x6Q2ROGyOMMondF+Ag== X-CSE-MsgGUID: TO/ZkeOdS/uam1yj9Qb0GA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82960816" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:23:48 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 01/11] soundwire: sdw_intel: include linux/acpi.h Date: Wed, 16 Oct 2024 18:23:23 +0800 Message-ID: <20241016102333.294448-2-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable For the acpi_handle stuff. Signed-off-by: Bard Liao Reviewed-by: P=C3=A9ter Ujfalusi Acked-by: Vinod Koul --- include/linux/soundwire/sdw_intel.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index 37ae69365fe2..fae345987b8c 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -4,6 +4,7 @@ #ifndef __SDW_INTEL_H #define __SDW_INTEL_H =20 +#include #include #include =20 --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 7689D207A2C; Wed, 16 Oct 2024 10:23:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074236; cv=none; b=gK0K1VyBsE2Xj9U4mP7PYRGvxyZS/PZ9ylNC53gB6bm7Nn7708NU1509B8PjPrihXYRJLwUgpUQCZTZPXHa1fhoS6sH4Zr+r7CjRPKV1rHWANtNNMk3l3qBzQH826kshaEElSmpgLJBQTpY/Cn7GFVDJ9+VYCAm44jxwYCPKQMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074236; c=relaxed/simple; bh=w+/f4EEiwvS2DsYowjzczU9v3DyZ+l0kFaSro8GL824=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CUBEQVzB9/wIlIt1f1OLWcN34U/fAJarhKGT91XQqrD5I2TJY99Y1TdMS+bCC5sCbid1TFmFRO4YuNuebVhR1myTxE3apJ/K68Ye9uMNF/bM6iP0xmhoougOxDgWn70nc8TrL32nJLe1X7yCg86RUBpAw/cFk6AMe0sqi6cvOv0= 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=OawZXEiU; arc=none smtp.client-ip=192.198.163.19 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="OawZXEiU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074235; x=1760610235; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w+/f4EEiwvS2DsYowjzczU9v3DyZ+l0kFaSro8GL824=; b=OawZXEiUJugM2sWzkf6IBgLnLfh0R6T+Kz8fhS2GGExEzRS5sSVSgV2f rWKIF9t7vLAojnlyZOJTuywgFgRifZt4HU1C4BkDKjNe2yzSy+yABto5B h88f+6ZnVwuu3xf0Oo3W+d0big1A7OZ0Su5b2Rp7qV64fzIl2xE3vh9SW pbCEnXf3NMRFmo2MP6GinxyU5wEydW63KHJA2GbJMCYzpooy5DK2XJxDh 3Bdbi4yrSzsOaWxSjnAUA0yFIl2Ipat/Z8ecoCSqLQpIg6Pd1mlmkR297 vx09mG9At2Sgf4pzx17IRIOtbJ4UkNmaY+tp62baWSUBPMUZqzypECa+C w==; X-CSE-ConnectionGUID: L8ZMEuk0Ry+cVHUL7FwWLA== X-CSE-MsgGUID: O2k3H/f0SSSrrcsQVbXodA== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985873" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985873" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:23:54 -0700 X-CSE-ConnectionGUID: ELUNtIPNSOGobDxsLEcWdg== X-CSE-MsgGUID: 097grx1TRv+h5MiJ6oCzFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82960831" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:23:51 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 02/11] ASoC/soundwire: remove sdw_slave_extended_id Date: Wed, 16 Oct 2024 18:23:24 +0800 Message-ID: <20241016102333.294448-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart This structure is used to copy information from the 'sdw_slave' structures, it's better to create a flexible array of 'sdw_slave' pointers and directly access the information. This will also help access additional information stored in the 'sdw_slave' structure, such as an SDCA context. This patch does not add new functionality, it only modified how the information is retrieved. Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- drivers/soundwire/amd_init.c | 12 ++++++------ drivers/soundwire/intel_init.c | 13 ++++++------- include/linux/soundwire/sdw.h | 6 +++--- include/linux/soundwire/sdw_amd.h | 7 ++----- include/linux/soundwire/sdw_intel.h | 7 ++----- include/sound/soc-acpi.h | 3 +-- sound/soc/amd/ps/pci-ps.c | 3 +-- sound/soc/soc-acpi.c | 30 +++++++++++++++-------------- sound/soc/sof/amd/acp-common.c | 3 +-- sound/soc/sof/intel/hda.c | 16 ++++++++------- 10 files changed, 47 insertions(+), 53 deletions(-) diff --git a/drivers/soundwire/amd_init.c b/drivers/soundwire/amd_init.c index db040f435059..53d1d707ca1a 100644 --- a/drivers/soundwire/amd_init.c +++ b/drivers/soundwire/amd_init.c @@ -177,7 +177,7 @@ EXPORT_SYMBOL_NS(sdw_amd_probe, SOUNDWIRE_AMD_INIT); void sdw_amd_exit(struct sdw_amd_ctx *ctx) { sdw_amd_cleanup(ctx); - kfree(ctx->ids); + kfree(ctx->peripherals); kfree(ctx); } EXPORT_SYMBOL_NS(sdw_amd_exit, SOUNDWIRE_AMD_INIT); @@ -204,10 +204,11 @@ int sdw_amd_get_slave_info(struct sdw_amd_ctx *ctx) num_slaves++; } =20 - ctx->ids =3D kcalloc(num_slaves, sizeof(*ctx->ids), GFP_KERNEL); - if (!ctx->ids) + ctx->peripherals =3D kmalloc(struct_size(ctx->peripherals, array, num_sla= ves), + GFP_KERNEL); + if (!ctx->peripherals) return -ENOMEM; - ctx->num_slaves =3D num_slaves; + ctx->peripherals->num_peripherals =3D num_slaves; for (index =3D 0; index < ctx->count; index++) { if (!(ctx->link_mask & BIT(index))) continue; @@ -215,8 +216,7 @@ int sdw_amd_get_slave_info(struct sdw_amd_ctx *ctx) if (amd_manager) { bus =3D &amd_manager->bus; list_for_each_entry(slave, &bus->slaves, node) { - ctx->ids[i].id =3D slave->id; - ctx->ids[i].link_id =3D bus->link_id; + ctx->peripherals->array[i] =3D slave; i++; } } diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index a09134b97cd6..12e7a98f319f 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -252,17 +252,16 @@ static struct sdw_intel_ctx num_slaves++; } =20 - ctx->ids =3D kcalloc(num_slaves, sizeof(*ctx->ids), GFP_KERNEL); - if (!ctx->ids) + ctx->peripherals =3D kmalloc(struct_size(ctx->peripherals, array, num_sla= ves), + GFP_KERNEL); + if (!ctx->peripherals) goto err; - - ctx->num_slaves =3D num_slaves; + ctx->peripherals->num_peripherals =3D num_slaves; i =3D 0; list_for_each_entry(link, &ctx->link_list, list) { bus =3D &link->cdns->bus; list_for_each_entry(slave, &bus->slaves, node) { - ctx->ids[i].id =3D slave->id; - ctx->ids[i].link_id =3D bus->link_id; + ctx->peripherals->array[i] =3D slave; i++; } } @@ -371,7 +370,7 @@ void sdw_intel_exit(struct sdw_intel_ctx *ctx) } =20 sdw_intel_cleanup(ctx); - kfree(ctx->ids); + kfree(ctx->peripherals); kfree(ctx->ldev); kfree(ctx); } diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 5e0dd47a0412..283c8bfdde49 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -488,9 +488,9 @@ struct sdw_slave_id { __u8 sdw_version:4; }; =20 -struct sdw_extended_slave_id { - int link_id; - struct sdw_slave_id id; +struct sdw_peripherals { + int num_peripherals; + struct sdw_slave *array[]; }; =20 /* diff --git a/include/linux/soundwire/sdw_amd.h b/include/linux/soundwire/sd= w_amd.h index 28a4eb77717f..585b4c58a8a6 100644 --- a/include/linux/soundwire/sdw_amd.h +++ b/include/linux/soundwire/sdw_amd.h @@ -115,19 +115,16 @@ struct sdw_amd_acpi_info { * struct sdw_amd_ctx - context allocated by the controller driver probe * * @count: link count - * @num_slaves: total number of devices exposed across all enabled links * @link_mask: bit-wise mask listing SoundWire links reported by the * Controller - * @ids: array of slave_id, representing Slaves exposed across all enabled - * links * @pdev: platform device structure + * @peripherals: array representing Peripherals exposed across all enabled= links */ struct sdw_amd_ctx { int count; - int num_slaves; u32 link_mask; - struct sdw_extended_slave_id *ids; struct platform_device *pdev[AMD_SDW_MAX_MANAGER_COUNT]; + struct sdw_peripherals *peripherals; }; =20 /** diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index fae345987b8c..491ddd27270f 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -287,31 +287,28 @@ struct hdac_bus; * hardware capabilities after all power dependencies are settled. * @link_mask: bit-wise mask listing SoundWire links reported by the * Controller - * @num_slaves: total number of devices exposed across all enabled links * @handle: ACPI parent handle * @ldev: information for each link (controller-specific and kept * opaque here) - * @ids: array of slave_id, representing Slaves exposed across all enabled - * links * @link_list: list to handle interrupts across all links * @shim_lock: mutex to handle concurrent rmw access to shared SHIM regist= ers. * @shim_mask: flags to track initialization of SHIM shared registers * @shim_base: sdw shim base. * @alh_base: sdw alh base. + * @peripherals: array representing Peripherals exposed across all enabled= links */ struct sdw_intel_ctx { int count; void __iomem *mmio_base; u32 link_mask; - int num_slaves; acpi_handle handle; struct sdw_intel_link_dev **ldev; - struct sdw_extended_slave_id *ids; struct list_head link_list; struct mutex shim_lock; /* lock for access to shared SHIM registers */ u32 shim_mask; u32 shim_base; u32 alh_base; + struct sdw_peripherals *peripherals; }; =20 /** diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h index 60d3b86a4660..ac7f9e791ee1 100644 --- a/include/sound/soc-acpi.h +++ b/include/sound/soc-acpi.h @@ -233,7 +233,6 @@ static inline bool snd_soc_acpi_sof_parent(struct devic= e *dev) =20 bool snd_soc_acpi_sdw_link_slaves_found(struct device *dev, const struct snd_soc_acpi_link_adr *link, - struct sdw_extended_slave_id *ids, - int num_slaves); + struct sdw_peripherals *peripherals); =20 #endif diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index c72d666d51bd..4365499c8f82 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -302,8 +302,7 @@ static struct snd_soc_acpi_mach *acp63_sdw_machine_sele= ct(struct device *dev) link =3D mach->links; for (i =3D 0; i < acp_data->info.count && link->num_adr; link++, i++) { if (!snd_soc_acpi_sdw_link_slaves_found(dev, link, - acp_data->sdw->ids, - acp_data->sdw->num_slaves)) + acp_data->sdw->peripherals)) break; } if (i =3D=3D acp_data->info.count || !link->num_adr) diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c index 6d693b2ad5a3..270f9777942f 100644 --- a/sound/soc/soc-acpi.c +++ b/sound/soc/soc-acpi.c @@ -131,8 +131,7 @@ EXPORT_SYMBOL_GPL(snd_soc_acpi_codec_list); /* Check if all Slaves defined on the link can be found */ bool snd_soc_acpi_sdw_link_slaves_found(struct device *dev, const struct snd_soc_acpi_link_adr *link, - struct sdw_extended_slave_id *ids, - int num_slaves) + struct sdw_peripherals *peripherals) { unsigned int part_id, link_id, unique_id, mfg_id, version; int i, j, k; @@ -146,22 +145,25 @@ bool snd_soc_acpi_sdw_link_slaves_found(struct device= *dev, link_id =3D SDW_DISCO_LINK_ID(adr); version =3D SDW_VERSION(adr); =20 - for (j =3D 0; j < num_slaves; j++) { + for (j =3D 0; j < peripherals->num_peripherals; j++) { + struct sdw_slave *peripheral =3D peripherals->array[j]; + /* find out how many identical parts were reported on that link */ - if (ids[j].link_id =3D=3D link_id && - ids[j].id.part_id =3D=3D part_id && - ids[j].id.mfg_id =3D=3D mfg_id && - ids[j].id.sdw_version =3D=3D version) + if (peripheral->bus->link_id =3D=3D link_id && + peripheral->id.part_id =3D=3D part_id && + peripheral->id.mfg_id =3D=3D mfg_id && + peripheral->id.sdw_version =3D=3D version) reported_part_count++; } =20 - for (j =3D 0; j < num_slaves; j++) { + for (j =3D 0; j < peripherals->num_peripherals; j++) { + struct sdw_slave *peripheral =3D peripherals->array[j]; int expected_part_count =3D 0; =20 - if (ids[j].link_id !=3D link_id || - ids[j].id.part_id !=3D part_id || - ids[j].id.mfg_id !=3D mfg_id || - ids[j].id.sdw_version !=3D version) + if (peripheral->bus->link_id !=3D link_id || + peripheral->id.part_id !=3D part_id || + peripheral->id.mfg_id !=3D mfg_id || + peripheral->id.sdw_version !=3D version) continue; =20 /* find out how many identical parts are expected */ @@ -180,7 +182,7 @@ bool snd_soc_acpi_sdw_link_slaves_found(struct device *= dev, */ unique_id =3D SDW_UNIQUE_ID(adr); if (reported_part_count =3D=3D 1 || - ids[j].id.unique_id =3D=3D unique_id) { + peripheral->id.unique_id =3D=3D unique_id) { dev_dbg(dev, "found part_id %#x at link %d\n", part_id, link_id); break; } @@ -189,7 +191,7 @@ bool snd_soc_acpi_sdw_link_slaves_found(struct device *= dev, part_id, reported_part_count, expected_part_count, link_id); } } - if (j =3D=3D num_slaves) { + if (j =3D=3D peripherals->num_peripherals) { dev_dbg(dev, "Slave part_id %#x not found\n", part_id); return false; } diff --git a/sound/soc/sof/amd/acp-common.c b/sound/soc/sof/amd/acp-common.c index dbcaac84cb73..fc792956bb97 100644 --- a/sound/soc/sof/amd/acp-common.c +++ b/sound/soc/sof/amd/acp-common.c @@ -145,8 +145,7 @@ static struct snd_soc_acpi_mach *amd_sof_sdw_machine_se= lect(struct snd_sof_dev * link =3D mach->links; for (i =3D 0; i < acp_data->info.count && link->num_adr; link++, i++) { if (!snd_soc_acpi_sdw_link_slaves_found(sdev->dev, link, - acp_data->sdw->ids, - acp_data->sdw->num_slaves)) + acp_data->sdw->peripherals)) break; } if (i =3D=3D acp_data->info.count || !link->num_adr) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index e4cb4ffc7270..9abc4c071ae5 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1064,7 +1064,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_sele= ct(struct snd_sof_dev *sdev { struct snd_sof_pdata *pdata =3D sdev->pdata; const struct snd_soc_acpi_link_adr *link; - struct sdw_extended_slave_id *ids; + struct sdw_peripherals *peripherals; struct snd_soc_acpi_mach *mach; struct sof_intel_hda_dev *hdev; u32 link_mask; @@ -1083,7 +1083,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_sele= ct(struct snd_sof_dev *sdev return NULL; } =20 - if (!hdev->sdw->num_slaves) { + if (!hdev->sdw->peripherals || !hdev->sdw->peripherals->num_peripherals) { dev_warn(sdev->dev, "No SoundWire peripheral detected in ACPI tables\n"); return NULL; } @@ -1119,8 +1119,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_sele= ct(struct snd_sof_dev *sdev * are not found on this link. */ if (!snd_soc_acpi_sdw_link_slaves_found(sdev->dev, link, - hdev->sdw->ids, - hdev->sdw->num_slaves)) + hdev->sdw->peripherals)) break; } /* Found if all Slaves are checked */ @@ -1136,10 +1135,13 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_se= lect(struct snd_sof_dev *sdev } =20 dev_info(sdev->dev, "No SoundWire machine driver found for the ACPI-repor= ted configuration:\n"); - ids =3D hdev->sdw->ids; - for (i =3D 0; i < hdev->sdw->num_slaves; i++) + peripherals =3D hdev->sdw->peripherals; + for (i =3D 0; i < peripherals->num_peripherals; i++) dev_info(sdev->dev, "link %d mfg_id 0x%04x part_id 0x%04x version %#x\n", - ids[i].link_id, ids[i].id.mfg_id, ids[i].id.part_id, ids[i].id.sdw_ver= sion); + peripherals->array[i]->bus->link_id, + peripherals->array[i]->id.mfg_id, + peripherals->array[i]->id.part_id, + peripherals->array[i]->id.sdw_version); =20 return NULL; } --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 144AA208208; Wed, 16 Oct 2024 10:23:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074240; cv=none; b=YAw3eU0DVircNLWqVBmMAx2/nIZw1PvNyxBBlaNxF2YI5m5Dyt2ZxzZgZw70RoE70njhJPf91brrDdqVahc0gD4TTFxnB8yYKHpQdoLNa3BH42Cg07lfe247uQ0CGoexhH5x+NL/cx1W0IZeB6w+vzHDk9BScYm0OFdtq5KlB9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074240; c=relaxed/simple; bh=diJ36RLK/l5o56cnGDl0UJM9WiHgarjAT0U7fl+VFWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LL5rMM/j1/Vegq8RvOve5mzQTeK8HD3dgMEOc2FIW5JKF0QyLs2QE6NQIVnlqkG2juncOg8S2MJWEGoWF8z6ATOHCWeqrM4VXBQoJWbgt1VrTtV58UNvOWAeqDaKNmlyBeKqifEak9iNtJybXB4Gd6WoMZJW2WhzovYVKySteaI= 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=MxPLIuzH; arc=none smtp.client-ip=192.198.163.19 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="MxPLIuzH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074238; x=1760610238; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=diJ36RLK/l5o56cnGDl0UJM9WiHgarjAT0U7fl+VFWE=; b=MxPLIuzHpDRvbTqkLX7SvzvABGUgHMdu6Upb9RJw1ao1qx5Y7+Mo+0GP IosTddHfEkWB2nNqlHy05ok+RlcvIc4hUIryLQLFLVw132ZlrB0Nf0TtZ nwiQCqjpb4pyxFpvMvh1GUI40j4Po8GkS7jX++NOquKB4O/Bv5McgxQ2e 6hOFoCDIoY/AvxAgFPCKLHWWJ8eiucViMHFZhKMejC1xp4Vzz8N+9nPLQ vB7vogeSq/WLNhmJJMp9VoRuCn6pFyqEPECsSitzHk2mQXUJu4A0miH/M HJeoJdpt9VUB+Jor/FVEki3pUxljQNcyyMAH8Ov/UCmBZT8abCh4XtSga w==; X-CSE-ConnectionGUID: jMt3/VvvT3aOSbK09T7G+w== X-CSE-MsgGUID: kMYg/sW8RymryOcUYscxLg== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985883" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985883" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:23:58 -0700 X-CSE-ConnectionGUID: ktrH/MDzS9ySZe40e5gIIA== X-CSE-MsgGUID: /Fnt1euGRLWYdX9VbEMqcg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82960847" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:23:55 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 03/11] ASoC: SDCA: add initial module Date: Wed, 16 Oct 2024 18:23:25 +0800 Message-ID: <20241016102333.294448-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart Add new module for SDCA (SoundWire Device Class for Audio) support. For now just add a parser to identify the SDCA revision and the function mask. Note that the SDCA definitions and related MIPI DisCo properties are defined only for ACPI platforms and extracted with _DSD helpers. There is currently no support for Device Tree in the specification, the 'depends on ACPI' reflects this design limitation. This might change in a future revision of the specification but for SDCA 1.0 ACPI is the only supported type of platform firmware. The SDCA library is defined with static inline fallbacks, which will allow for unconditional addition of SDCA support in common parts of the code. The design follows a four-step process: 1) Basic information related to Functions is extracted from MIPI DisCo tables and stored in the 'struct sdw_slave'. Devm_ based memory allocation is not allowed at this point prior to a driver probe, so we only store the function node, address and type. 2) When a codec driver probes, it will register subdevices for each Function identified in phase 1) 3) a driver will probe for each subdevice and addition parsing/memory allocation takes place at this level. devm_ based allocation is highly encouraged to make error handling manageable. 4) Before the peripheral device becomes physically attached, register access is not permitted and the regmaps are cache-only. When peripheral device is enumerated, the bus level uses the 'update_status' notification; after optional device-level initialization, the codec driver will notify each of the subdevices so that they can start interacting with the hardware. Note that the context extracted in 1) should be arguably be handled completely in the codec driver probe. That would however make it difficult to use the ACPI information for machine quirks, and e.g. select different machine driver and topologies as done for the RT712_VB handling later in the series. To make the implementation of quirks simpler, this patchset extracts a minimal amount of context (interface revision and number/type of Functions) before the codec driver probe, and stores this context in the scope of the 'struct sdw_slave'. The SDCA library can also be used in a vendor-specific driver without creating subdevices, e.g. to retrieve the 'initialization-table' values to write platform-specific values as needed. For more technical details, the SDCA specification is available for public downloads at https://www.mipi.org/mipi-sdca-v1-0-download Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- include/linux/soundwire/sdw.h | 3 + include/sound/sdca.h | 54 ++++++++++ include/sound/sdca_function.h | 55 ++++++++++ sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/sdca/Kconfig | 11 ++ sound/soc/sdca/Makefile | 5 + sound/soc/sdca/sdca_device.c | 24 +++++ sound/soc/sdca/sdca_functions.c | 173 ++++++++++++++++++++++++++++++++ 9 files changed, 327 insertions(+) create mode 100644 include/sound/sdca.h create mode 100644 include/sound/sdca_function.h create mode 100644 sound/soc/sdca/Kconfig create mode 100644 sound/soc/sdca/Makefile create mode 100644 sound/soc/sdca/sdca_device.c create mode 100644 sound/soc/sdca/sdca_functions.c diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 283c8bfdde49..49d690f3d29a 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -10,6 +10,7 @@ #include #include #include +#include =20 struct sdw_bus; struct sdw_slave; @@ -663,6 +664,7 @@ struct sdw_slave_ops { * @is_mockup_device: status flag used to squelch errors in the command/co= ntrol * protocol for SoundWire mockup devices * @sdw_dev_lock: mutex used to protect callbacks/remove races + * @sdca_data: structure containing all device data for SDCA helpers */ struct sdw_slave { struct sdw_slave_id id; @@ -686,6 +688,7 @@ struct sdw_slave { bool first_interrupt_done; bool is_mockup_device; struct mutex sdw_dev_lock; /* protect callbacks/remove races */ + struct sdca_device_data sdca_data; }; =20 #define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev) diff --git a/include/sound/sdca.h b/include/sound/sdca.h new file mode 100644 index 000000000000..34473ca4c789 --- /dev/null +++ b/include/sound/sdca.h @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* + * The MIPI SDCA specification is available for public downloads at + * https://www.mipi.org/mipi-sdca-v1-0-download + * + * Copyright(c) 2024 Intel Corporation + */ + +#ifndef __SDCA_H__ +#define __SDCA_H__ + +struct sdw_slave; + +#define SDCA_MAX_FUNCTION_COUNT 8 + +/** + * sdca_device_desc - short descriptor for an SDCA Function + * @adr: ACPI address (used for SDCA register access) + * @type: Function topology type + * @name: human-readable string + */ +struct sdca_function_desc { + u64 adr; + u32 type; + const char *name; +}; + +/** + * sdca_device_data - structure containing all SDCA related information + * @sdca_interface_revision: value read from _DSD property, mainly to check + * for changes between silicon versions + * @num_functions: total number of supported SDCA functions. Invalid/unsup= ported + * functions will be skipped. + * @sdca_func: array of function descriptors + */ +struct sdca_device_data { + u32 interface_revision; + int num_functions; + struct sdca_function_desc sdca_func[SDCA_MAX_FUNCTION_COUNT]; +}; + +#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA) + +void sdca_lookup_functions(struct sdw_slave *slave); +void sdca_lookup_interface_revision(struct sdw_slave *slave); + +#else + +static inline void sdca_lookup_functions(struct sdw_slave *slave) {} +static inline void sdca_lookup_interface_revision(struct sdw_slave *slave)= {} + +#endif + +#endif diff --git a/include/sound/sdca_function.h b/include/sound/sdca_function.h new file mode 100644 index 000000000000..a01eec86b9a6 --- /dev/null +++ b/include/sound/sdca_function.h @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* + * The MIPI SDCA specification is available for public downloads at + * https://www.mipi.org/mipi-sdca-v1-0-download + * + * Copyright(c) 2024 Intel Corporation + */ + +#ifndef __SDCA_FUNCTION_H__ +#define __SDCA_FUNCTION_H__ + +/* + * SDCA Function Types from SDCA specification v1.0a Section 5.1.2 + * all Function types not described are reserved + * Note that SIMPLE_AMP, SIMPLE_MIC and SIMPLE_JACK Function Types + * are NOT defined in SDCA 1.0a, but they were defined in earlier + * drafts and are planned for 1.1. + */ + +enum sdca_function_type { + SDCA_FUNCTION_TYPE_SMART_AMP =3D 0x01, /* Amplifier with protection featu= res */ + SDCA_FUNCTION_TYPE_SIMPLE_AMP =3D 0x02, /* subset of SmartAmp */ + SDCA_FUNCTION_TYPE_SMART_MIC =3D 0x03, /* Smart microphone with acoustic = triggers */ + SDCA_FUNCTION_TYPE_SIMPLE_MIC =3D 0x04, /* subset of SmartMic */ + SDCA_FUNCTION_TYPE_SPEAKER_MIC =3D 0x05, /* Combination of SmartMic and S= martAmp */ + SDCA_FUNCTION_TYPE_UAJ =3D 0x06, /* 3.5mm Universal Audio jack */ + SDCA_FUNCTION_TYPE_RJ =3D 0x07, /* Retaskable jack */ + SDCA_FUNCTION_TYPE_SIMPLE_JACK =3D 0x08, /* Subset of UAJ */ + SDCA_FUNCTION_TYPE_HID =3D 0x0A, /* Human Interface Device, for e.g. but= tons */ + SDCA_FUNCTION_TYPE_IMP_DEF =3D 0x1F, /* Implementation-defined function */ +}; + +/* Human-readable names used for kernel logs and Function device registrat= ion/bind */ +#define SDCA_FUNCTION_TYPE_SMART_AMP_NAME "SmartAmp" +#define SDCA_FUNCTION_TYPE_SIMPLE_AMP_NAME "SimpleAmp" +#define SDCA_FUNCTION_TYPE_SMART_MIC_NAME "SmartMic" +#define SDCA_FUNCTION_TYPE_SIMPLE_MIC_NAME "SimpleMic" +#define SDCA_FUNCTION_TYPE_SPEAKER_MIC_NAME "SpeakerMic" +#define SDCA_FUNCTION_TYPE_UAJ_NAME "UAJ" +#define SDCA_FUNCTION_TYPE_RJ_NAME "RJ" +#define SDCA_FUNCTION_TYPE_SIMPLE_NAME "SimpleJack" +#define SDCA_FUNCTION_TYPE_HID_NAME "HID" + +enum sdca_entity0_controls { + SDCA_CONTROL_ENTITY_0_COMMIT_GROUP_MASK =3D 0x01, + SDCA_CONTROL_ENTITY_0_INTSTAT_CLEAR =3D 0x02, + SDCA_CONTROL_ENTITY_0_INT_ENABLE =3D 0x03, + SDCA_CONTROL_ENTITY_0_FUNCTION_SDCA_VERSION =3D 0x04, + SDCA_CONTROL_ENTITY_0_FUNCTION_TOPOLOGY =3D 0x05, + SDCA_CONTROL_ENTITY_0_FUNCTION_MANUFACTURER_ID =3D 0x06, + SDCA_CONTROL_ENTITY_0_FUNCTION_ID =3D 0x07, + SDCA_CONTROL_ENTITY_0_FUNCTION_VERSION =3D 0x08 +}; + +#endif diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index e87bd15a8b43..8e01b421fe8d 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -108,6 +108,7 @@ source "sound/soc/pxa/Kconfig" source "sound/soc/qcom/Kconfig" source "sound/soc/rockchip/Kconfig" source "sound/soc/samsung/Kconfig" +source "sound/soc/sdca/Kconfig" source "sound/soc/sh/Kconfig" source "sound/soc/sof/Kconfig" source "sound/soc/spear/Kconfig" diff --git a/sound/soc/Makefile b/sound/soc/Makefile index 775bb38c2ed4..5307b0b62a93 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile @@ -61,6 +61,7 @@ obj-$(CONFIG_SND_SOC) +=3D pxa/ obj-$(CONFIG_SND_SOC) +=3D qcom/ obj-$(CONFIG_SND_SOC) +=3D rockchip/ obj-$(CONFIG_SND_SOC) +=3D samsung/ +obj-$(CONFIG_SND_SOC) +=3D sdca/ obj-$(CONFIG_SND_SOC) +=3D sh/ obj-$(CONFIG_SND_SOC) +=3D sof/ obj-$(CONFIG_SND_SOC) +=3D spear/ diff --git a/sound/soc/sdca/Kconfig b/sound/soc/sdca/Kconfig new file mode 100644 index 000000000000..07f6822fa614 --- /dev/null +++ b/sound/soc/sdca/Kconfig @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config SND_SOC_SDCA + tristate "ASoC SDCA library" + depends on ACPI + help + This option enables support for the MIPI SoundWire Device + Class for Audio (SDCA). + +config SND_SOC_SDCA_OPTIONAL + def_tristate SND_SOC_SDCA || !SND_SOC_SDCA diff --git a/sound/soc/sdca/Makefile b/sound/soc/sdca/Makefile new file mode 100644 index 000000000000..c296bd5a0a7c --- /dev/null +++ b/sound/soc/sdca/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-only + +snd-soc-sdca-objs :=3D sdca_functions.o sdca_device.o + +obj-$(CONFIG_SND_SOC_SDCA) +=3D snd-soc-sdca.o diff --git a/sound/soc/sdca/sdca_device.c b/sound/soc/sdca/sdca_device.c new file mode 100644 index 000000000000..58f5f6f0f723 --- /dev/null +++ b/sound/soc/sdca/sdca_device.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) +// Copyright(c) 2024 Intel Corporation + +/* + * The MIPI SDCA specification is available for public downloads at + * https://www.mipi.org/mipi-sdca-v1-0-download + */ + +#include +#include +#include + +void sdca_lookup_interface_revision(struct sdw_slave *slave) +{ + struct fwnode_handle *fwnode =3D slave->dev.fwnode; + + /* + * if this property is not present, then the sdca_interface_revision will + * remain zero, which will be considered as 'not defined' or 'invalid'. + */ + fwnode_property_read_u32(fwnode, "mipi-sdw-sdca-interface-revision", + &slave->sdca_data.interface_revision); +} +EXPORT_SYMBOL_NS(sdca_lookup_interface_revision, SND_SOC_SDCA); diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_function= s.c new file mode 100644 index 000000000000..a6ad57430dd4 --- /dev/null +++ b/sound/soc/sdca/sdca_functions.c @@ -0,0 +1,173 @@ +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) +// Copyright(c) 2024 Intel Corporation + +/* + * The MIPI SDCA specification is available for public downloads at + * https://www.mipi.org/mipi-sdca-v1-0-download + */ + +#include +#include +#include +#include + +static int patch_sdca_function_type(struct device *dev, + u32 interface_revision, + u32 *function_type, + const char **function_name) +{ + unsigned long function_type_patch =3D 0; + + /* + * Unfortunately early SDCA specifications used different indices for Fun= ctions, + * for backwards compatibility we have to reorder the values found + */ + if (interface_revision >=3D 0x0801) + goto skip_early_draft_order; + + switch (*function_type) { + case 1: + function_type_patch =3D SDCA_FUNCTION_TYPE_SMART_AMP; + break; + case 2: + function_type_patch =3D SDCA_FUNCTION_TYPE_SMART_MIC; + break; + case 3: + function_type_patch =3D SDCA_FUNCTION_TYPE_SPEAKER_MIC; + break; + case 4: + function_type_patch =3D SDCA_FUNCTION_TYPE_UAJ; + break; + case 5: + function_type_patch =3D SDCA_FUNCTION_TYPE_RJ; + break; + case 6: + function_type_patch =3D SDCA_FUNCTION_TYPE_HID; + break; + default: + dev_warn(dev, "%s: SDCA version %#x unsupported function type %d, skippe= d\n", + __func__, interface_revision, *function_type); + return -EINVAL; + } + +skip_early_draft_order: + if (function_type_patch) + *function_type =3D function_type_patch; + + /* now double-check the values */ + switch (*function_type) { + case SDCA_FUNCTION_TYPE_SMART_AMP: + *function_name =3D SDCA_FUNCTION_TYPE_SMART_AMP_NAME; + break; + case SDCA_FUNCTION_TYPE_SMART_MIC: + *function_name =3D SDCA_FUNCTION_TYPE_SMART_MIC_NAME; + break; + case SDCA_FUNCTION_TYPE_UAJ: + *function_name =3D SDCA_FUNCTION_TYPE_UAJ_NAME; + break; + case SDCA_FUNCTION_TYPE_HID: + *function_name =3D SDCA_FUNCTION_TYPE_HID_NAME; + break; + case SDCA_FUNCTION_TYPE_SIMPLE_AMP: + case SDCA_FUNCTION_TYPE_SIMPLE_MIC: + case SDCA_FUNCTION_TYPE_SPEAKER_MIC: + case SDCA_FUNCTION_TYPE_RJ: + case SDCA_FUNCTION_TYPE_IMP_DEF: + dev_warn(dev, "%s: found unsupported SDCA function type %d, skipped\n", + __func__, *function_type); + return -EINVAL; + default: + dev_err(dev, "%s: found invalid SDCA function type %d, skipped\n", + __func__, *function_type); + return -EINVAL; + } + + dev_info(dev, "%s: found SDCA function %s (type %d)\n", + __func__, *function_name, *function_type); + + return 0; +} + +static int find_sdca_function(struct acpi_device *adev, void *data) +{ + struct fwnode_handle *function_node =3D acpi_fwnode_handle(adev); + struct sdca_device_data *sdca_data =3D data; + struct device *dev =3D &adev->dev; + struct fwnode_handle *control5; /* used to identify function type */ + const char *function_name; + u32 function_type; + int func_index; + u64 addr; + int ret; + + if (sdca_data->num_functions >=3D SDCA_MAX_FUNCTION_COUNT) { + dev_err(dev, "%s: maximum number of functions exceeded\n", __func__); + return -EINVAL; + } + + /* + * The number of functions cannot exceed 8, we could use + * acpi_get_local_address() but the value is stored as u64 so + * we might as well avoid casts and intermediate levels + */ + ret =3D acpi_get_local_u64_address(adev->handle, &addr); + if (ret < 0) + return ret; + + if (!addr) { + dev_err(dev, "%s: no addr\n", __func__); + return -ENODEV; + } + + /* + * Extracting the topology type for an SDCA function is a + * convoluted process. + * The Function type is only visible as a result of a read + * from a control. In theory this would mean reading from the hardware, + * but the SDCA/DisCo specs defined the notion of "DC value" - a constant + * represented with a DSD subproperty. + * Drivers have to query the properties for the control + * SDCA_CONTROL_ENTITY_0_FUNCTION_TOPOLOGY (0x05) + */ + control5 =3D fwnode_get_named_child_node(function_node, + "mipi-sdca-control-0x5-subproperties"); + if (!control5) + return -ENODEV; + + ret =3D fwnode_property_read_u32(control5, "mipi-sdca-control-dc-value", + &function_type); + + fwnode_handle_put(control5); + + if (ret < 0) { + dev_err(dev, "%s: the function type can only be determined from ACPI inf= ormation\n", + __func__); + return ret; + } + + ret =3D patch_sdca_function_type(dev, sdca_data->interface_revision, + &function_type, &function_name); + if (ret < 0) + return ret; + + /* store results */ + func_index =3D sdca_data->num_functions; + sdca_data->sdca_func[func_index].adr =3D addr; + sdca_data->sdca_func[func_index].type =3D function_type; + sdca_data->sdca_func[func_index].name =3D function_name; + sdca_data->num_functions++; + + return 0; +} + +void sdca_lookup_functions(struct sdw_slave *slave) +{ + struct device *dev =3D &slave->dev; + struct acpi_device *adev =3D to_acpi_device_node(dev->fwnode); + + acpi_dev_for_each_child(adev, find_sdca_function, &slave->sdca_data); +} +EXPORT_SYMBOL_NS(sdca_lookup_functions, SND_SOC_SDCA); + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_DESCRIPTION("SDCA library"); --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 6E6FA20821B; Wed, 16 Oct 2024 10:24:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074243; cv=none; b=lZ7N/mYl6YIVIRmD/OA0Gl7/mvYHCbZ7psABY0Qr4vxO3rWth9FqJy7vpqsR688YH7hr/p/YCmB7OdHYVmGjgCGgyiwOzodSb2i4Dav6jTPgCkDxCxIJFIq2fkW1Cu6GynCQUrTQyK1mMYc2yEIiVfVCcZHgt0sb0MpTeCMgI9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074243; c=relaxed/simple; bh=kRto2Vxs+QZGWQmqTFa0+UrJ1B4FDOrZfg6FGj1DPak=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=u0Ntd0whAHE5rw/4osuE1GiMlZfxXgdvdDNMq/ZOE/SrptIckQ88UKLClBbkz9bmly0JabCriDvQ8SEElkUxgo+O5tCug+IBZdz/PriP+5nNuKkuENB9VAtcfked3KrwscWq+9hycA6E2IBDhMmMDK0DgEm14AQa6JcrUvs5FMQ= 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=SCCGfRXH; arc=none smtp.client-ip=192.198.163.19 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="SCCGfRXH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074242; x=1760610242; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kRto2Vxs+QZGWQmqTFa0+UrJ1B4FDOrZfg6FGj1DPak=; b=SCCGfRXH+57d0NtnhKzNXYgFU4J+wt5Iq88FU0JnIDuBcGHcoI1YYj3b MarPFuSPQmZx2Fp2zsCcexoKJuCFAwMquLuvWTfZYSFFO/QfT+BdpYaLN 2GDY7GYSh3B3lfiwOtasjhP/h+8qw7Pn/EadMrOG16gibnad+vZnDNJPb +hdYCiPRjFA3ztDiYIcFw0HjH/UulnZpAxxwmXAkQsR9YbhDXuw4gWPz0 Lr7i9UgEe8BuMWm2Vr0j/nnhtd1YEiWlLcdMs/9RRfgnJd3UzMJxRgcAJ lHvU01mKL9pcO0XZEyLyfUUDajHnQ/JRWSohr3r5R4jVHMGrWbaoJfiPm Q==; X-CSE-ConnectionGUID: +W7dHz8iS+CYPzHN43gl9Q== X-CSE-MsgGUID: YtZXd4ekQuKHuiWdgrgxgQ== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985889" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985889" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:01 -0700 X-CSE-ConnectionGUID: 6kBq1D5ASJ2tWrukyPoceg== X-CSE-MsgGUID: AvJSmFVrTr2FzlgiydFL/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82960870" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:23:58 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 04/11] soundwire: slave: lookup SDCA version and functions Date: Wed, 16 Oct 2024 18:23:26 +0800 Message-ID: <20241016102333.294448-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart Use SDCA helpers to get the basic information and store it in the slave context. The information will be optionally be used in codec drivers to register sub-devices for each Function. When platforms are not based on ACPI the helpers do absolutely nothing. Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- drivers/soundwire/Kconfig | 1 + drivers/soundwire/slave.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/soundwire/Kconfig b/drivers/soundwire/Kconfig index 4d8f3b7024ae..f66f869dff2e 100644 --- a/drivers/soundwire/Kconfig +++ b/drivers/soundwire/Kconfig @@ -6,6 +6,7 @@ menuconfig SOUNDWIRE tristate "SoundWire support" depends on ACPI || OF + depends on SND_SOC_SDCA_OPTIONAL help SoundWire is a 2-Pin interface with data and clock line ratified by the MIPI Alliance. SoundWire is used for transporting data diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index f1a4df6cfebd..97cf8bcca047 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "bus.h" #include "sysfs_local.h" =20 @@ -70,6 +71,17 @@ int sdw_slave_add(struct sdw_bus *bus, list_add_tail(&slave->node, &bus->slaves); mutex_unlock(&bus->bus_lock); =20 + /* + * The Soundwire driver probe may optionally register SDCA + * sub-devices, one per Function. This means the information + * on the SDCA revision and the number/type of Functions need + * to be extracted from platform firmware before the SoundWire + * driver probe, and as a consequence before the SoundWire + * device_register() below. + */ + sdca_lookup_interface_revision(slave); + sdca_lookup_functions(slave); + ret =3D device_register(&slave->dev); if (ret) { dev_err(bus->dev, "Failed to add slave: ret %d\n", ret); @@ -259,3 +271,5 @@ int sdw_of_find_slaves(struct sdw_bus *bus) =20 return 0; } + +MODULE_IMPORT_NS(SND_SOC_SDCA); --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 BE6F220F5D5; Wed, 16 Oct 2024 10:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074246; cv=none; b=XxbQEbw0zEdxEE4FbBpbteLNPh3MPo1tKsO+MYx0qlMkn0Blx7cucYIJz2+tIFNkuG2Vb/D7ghniX8IZk4ISUlqY8GC65O0f89lqF1YHwNyrJGlnGf18pA1rJjmtUHQhLJR92UDq+yWGGr2NmaKgafG/o1dLijhIqE+BPLWYC5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074246; c=relaxed/simple; bh=vQsikfVcqe1m+nqzWrrCnhb0/wGj2sneKFB8jR73Da0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gG2/MspRPudn9lMwZri2HVbDAwuEchODGIOychGGEwnEao6aYmhWnxE24yiaabDDGh/gYvRZRzraY+oXKMytoRtLFY9MwLHA5D9rLAekHx59TBvfb2rpbavKFADaGaBhwazqqJ2u/Iffl/DqRsAkt6dKO7I+14CcDLSGJzv7z1w= 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=NLFNdE7g; arc=none smtp.client-ip=192.198.163.19 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="NLFNdE7g" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074245; x=1760610245; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vQsikfVcqe1m+nqzWrrCnhb0/wGj2sneKFB8jR73Da0=; b=NLFNdE7gcc8+mP3FrFXnHBng752f/a7eWwIU2dBxLFnKJ+yWSV+vsGqh TF1mpUpqGUhRTQooU9KFWIfwuTSgWTGv7qKLsG8cy4Te0S8+2roT4SEDx 5cs15fmtEpCsAaYzmcQfOcv3qHi0lsRc7Bru9hYjs4vUpE9ehFxyLiYxf LLBJtLAhsTOO7KWB/RY6Ft/nlX2aL2dijRdzdN00wXJp5ECkBsuTjY7K6 gKwezmv441n5eUFwOM49oyKC3ukrchQTeLwPyvFyk8UmxSDNpfqthmSDF pE81ICOf98CCwbhT89k6iqQ0UwNGfxDLp6LtL21ytHI2f/ItZwOf+eUNi A==; X-CSE-ConnectionGUID: 5JJEMCC2TRCq0HCXnPCngQ== X-CSE-MsgGUID: 7M+vCJsiTyW602IyF+OPuw== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985901" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985901" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:05 -0700 X-CSE-ConnectionGUID: r3SuJixVSNSO32NkF0aZRg== X-CSE-MsgGUID: Y4er7GD8SyOpXEppwWScpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82960918" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:02 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 05/11] ASoC: SDCA: add quirk function for RT712_VB match Date: Wed, 16 Oct 2024 18:23:27 +0800 Message-ID: <20241016102333.294448-6-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart Add a generic match function for quirks, chances are we are going to have lots of those... Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- include/sound/sdca.h | 10 ++++++++- sound/soc/sdca/sdca_device.c | 43 ++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/include/sound/sdca.h b/include/sound/sdca.h index 34473ca4c789..7e138229e8f3 100644 --- a/include/sound/sdca.h +++ b/include/sound/sdca.h @@ -39,16 +39,24 @@ struct sdca_device_data { struct sdca_function_desc sdca_func[SDCA_MAX_FUNCTION_COUNT]; }; =20 +enum sdca_quirk { + SDCA_QUIRKS_RT712_VB, +}; + #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA) =20 void sdca_lookup_functions(struct sdw_slave *slave); void sdca_lookup_interface_revision(struct sdw_slave *slave); +bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quir= k); =20 #else =20 static inline void sdca_lookup_functions(struct sdw_slave *slave) {} static inline void sdca_lookup_interface_revision(struct sdw_slave *slave)= {} - +static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum s= dca_quirk quirk) +{ + return false; +} #endif =20 #endif diff --git a/sound/soc/sdca/sdca_device.c b/sound/soc/sdca/sdca_device.c index 58f5f6f0f723..c44dc21cb634 100644 --- a/sound/soc/sdca/sdca_device.c +++ b/sound/soc/sdca/sdca_device.c @@ -9,6 +9,7 @@ #include #include #include +#include =20 void sdca_lookup_interface_revision(struct sdw_slave *slave) { @@ -22,3 +23,45 @@ void sdca_lookup_interface_revision(struct sdw_slave *sl= ave) &slave->sdca_data.interface_revision); } EXPORT_SYMBOL_NS(sdca_lookup_interface_revision, SND_SOC_SDCA); + +static bool sdca_device_quirk_rt712_vb(struct sdw_slave *slave) +{ + struct sdw_slave_id *id =3D &slave->id; + int i; + + /* + * The RT712_VA relies on the v06r04 draft, and the + * RT712_VB on a more recent v08r01 draft. + */ + if (slave->sdca_data.interface_revision < 0x0801) + return false; + + if (id->mfg_id !=3D 0x025d) + return false; + + if (id->part_id !=3D 0x712 && + id->part_id !=3D 0x713 && + id->part_id !=3D 0x716 && + id->part_id !=3D 0x717) + return false; + + for (i =3D 0; i < slave->sdca_data.num_functions; i++) { + if (slave->sdca_data.sdca_func[i].type =3D=3D + SDCA_FUNCTION_TYPE_SMART_MIC) + return true; + } + + return false; +} + +bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quir= k) +{ + switch (quirk) { + case SDCA_QUIRKS_RT712_VB: + return sdca_device_quirk_rt712_vb(slave); + default: + break; + } + return false; +} +EXPORT_SYMBOL_NS(sdca_device_quirk_match, SND_SOC_SDCA); --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 DE5D920FAA1; Wed, 16 Oct 2024 10:24:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074249; cv=none; b=gBWOu+zXLMpCqLr30zob42JUlGN7bXdimXjQ53ROVnqP0krBVUgzrQEJq4Jz0pMaGoxW7Y+khzT6Lg+WTjr5KsArw1dguDDEzIkEuOqpH0o6bvM0oxqx0v5AF6b+uc85i9xrPn99/Vis4PNfIQtYDK3rNp9Km3eT0PLFgxwXx2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074249; c=relaxed/simple; bh=R3L3OdjrZ7wDoYzeI5ybv3xYxVMF4yQecWFgcQqX9Aw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HyEgt81Ja/kyuSCTQsgFym6yKJtEvp1ylUf12eU1jgMQanxNK+A0DwXerjycRHilNcRTQYAdPk3cp26JXddQjwFDDEQXRFXIuwnBOk7hJ/OIoH2KINPbtKTjJKgZL8ePNONsWrQrBhAhZzPD5AZ7mrFIQn3dcvLxKNLCksAm36Y= 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=GBhvWNzC; arc=none smtp.client-ip=192.198.163.19 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="GBhvWNzC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074248; x=1760610248; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R3L3OdjrZ7wDoYzeI5ybv3xYxVMF4yQecWFgcQqX9Aw=; b=GBhvWNzCn0oZgz03dn4L2QgZlR1re4uJhNMhR6kSRXz+dsJyo2qYlJGh 2HDM1oaAJCy2+t/e1BuANlTOd2kYke/nuejghNGGmejBYNFC2U32CIEbj Af+EWOl4hX8um7FZeEZAtZq/tvTMS51DEIK+pIvD3IpIQUBEyV1E1L5B2 +5xRkk6ffI3aX9R7Ha5DAhvrx2G6mxBGsagxHudOVDQOM0tLzKvoOWkQq q4JRWOh1GkL7xnsVXeurHCUwMZEeLPvrWoO5dM8HMTPtzdd5k5LnVeUeP p2BixZ4FGt2Zh4aPj53TfJIPwTgO385zmMuIGkAcRiQFyjX5HfHzyqnZ7 Q==; X-CSE-ConnectionGUID: 8VweWllhRXafTz2eW1ucGQ== X-CSE-MsgGUID: WatDMxNAQmyPFXLBka9nzA== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985908" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985908" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:08 -0700 X-CSE-ConnectionGUID: h8wlzai2QXGEKoPgI9OkjA== X-CSE-MsgGUID: K8ZDfds/Q0yH3mNGlpQ11w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82960947" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:05 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 06/11] ASoC: rt712-sdca: detect the SMART_MIC function during the probe stage Date: Wed, 16 Oct 2024 18:23:28 +0800 Message-ID: <20241016102333.294448-7-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart We shouldn't do any devm_ based allocation in the io_init(), this need to happen in the probe(). Luckily, we now have an SDCA helper to look in ACPI tables if a SMART_MIC function is exposed. FIXME: the registers are not well handled today, the regmap lists registers which are not really supported in all platforms. The regmap needs to throw an error if those registers are accessed without existing. Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- sound/soc/codecs/rt712-sdca-sdw.c | 1 + sound/soc/codecs/rt712-sdca.c | 38 +++++++++++++++++++++++-------- sound/soc/codecs/rt712-sdca.h | 1 + 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/rt712-sdca-sdw.c b/sound/soc/codecs/rt712-sdc= a-sdw.c index 90d5aaddbd5b..549aa31faed4 100644 --- a/sound/soc/codecs/rt712-sdca-sdw.c +++ b/sound/soc/codecs/rt712-sdca-sdw.c @@ -507,3 +507,4 @@ module_sdw_driver(rt712_sdca_sdw_driver); MODULE_DESCRIPTION("ASoC RT712 SDCA SDW driver"); MODULE_AUTHOR("Shuming Fan "); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(SND_SOC_SDCA); diff --git a/sound/soc/codecs/rt712-sdca.c b/sound/soc/codecs/rt712-sdca.c index e210c574bb74..78dbf9eed494 100644 --- a/sound/soc/codecs/rt712-sdca.c +++ b/sound/soc/codecs/rt712-sdca.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1652,6 +1653,17 @@ int rt712_sdca_init(struct device *dev, struct regma= p *regmap, if (ret < 0) return ret; =20 + /* only add the dmic component if a SMART_MIC function is exposed in ACPI= */ + if (sdca_device_quirk_match(slave, SDCA_QUIRKS_RT712_VB)) { + ret =3D devm_snd_soc_register_component(dev, + &soc_sdca_dev_rt712_dmic, + rt712_sdca_dmic_dai, + ARRAY_SIZE(rt712_sdca_dmic_dai)); + if (ret < 0) + return ret; + rt712->dmic_function_found =3D true; + } + /* set autosuspend parameters */ pm_runtime_set_autosuspend_delay(dev, 3000); pm_runtime_use_autosuspend(dev); @@ -1799,7 +1811,6 @@ static void rt712_sdca_vb_io_init(struct rt712_sdca_p= riv *rt712) int rt712_sdca_io_init(struct device *dev, struct sdw_slave *slave) { struct rt712_sdca_priv *rt712 =3D dev_get_drvdata(dev); - int ret =3D 0; unsigned int val; struct sdw_slave_prop *prop =3D &slave->prop; =20 @@ -1829,15 +1840,22 @@ int rt712_sdca_io_init(struct device *dev, struct s= dw_slave *slave) rt712->version_id =3D (val & 0x0f00) >> 8; dev_dbg(&slave->dev, "%s hw_id=3D0x%x, version_id=3D0x%x\n", __func__, rt= 712->hw_id, rt712->version_id); =20 - if (rt712->version_id =3D=3D RT712_VA) + if (rt712->version_id =3D=3D RT712_VA) { + if (rt712->dmic_function_found) { + dev_err(&slave->dev, "%s RT712 VA detected but SMART_MIC function expos= ed in ACPI\n", + __func__); + goto suspend; + } + rt712_sdca_va_io_init(rt712); - else { + } else { + if (!rt712->dmic_function_found) { + dev_err(&slave->dev, "%s RT712 VB detected but no SMART_MIC function ex= posed in ACPI\n", + __func__); + goto suspend; + } + /* multilanes and DMIC are supported by rt712vb */ - ret =3D devm_snd_soc_register_component(dev, - &soc_sdca_dev_rt712_dmic, rt712_sdca_dmic_dai, ARRAY_SIZE(rt712_sdca_dm= ic_dai)); - if (ret < 0) - return ret; - prop->lane_control_support =3D true; rt712_sdca_vb_io_init(rt712); } @@ -1862,10 +1880,12 @@ int rt712_sdca_io_init(struct device *dev, struct s= dw_slave *slave) /* Mark Slave initialization complete */ rt712->hw_init =3D true; =20 + dev_dbg(&slave->dev, "%s hw_init complete\n", __func__); + +suspend: pm_runtime_mark_last_busy(&slave->dev); pm_runtime_put_autosuspend(&slave->dev); =20 - dev_dbg(&slave->dev, "%s hw_init complete\n", __func__); return 0; } =20 diff --git a/sound/soc/codecs/rt712-sdca.h b/sound/soc/codecs/rt712-sdca.h index 2169f2f726b9..a08491496d90 100644 --- a/sound/soc/codecs/rt712-sdca.h +++ b/sound/soc/codecs/rt712-sdca.h @@ -36,6 +36,7 @@ struct rt712_sdca_priv { unsigned int scp_sdca_stat2; unsigned int hw_id; unsigned int version_id; + bool dmic_function_found; bool fu0f_dapm_mute; bool fu0f_mixer_l_mute; bool fu0f_mixer_r_mute; --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 5DB10210195; Wed, 16 Oct 2024 10:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074252; cv=none; b=PePhIw+zc/nZvpD7QfFg2SL8m+az0B3UEAx7FuQq1+ROYfYACgBPbxDTFspTRpZY0PuFnvJEHhu6KJjr+dNVVIQuLsXYAeSSY3hXJpJ8zqOpyaQLE56fmPfercvB8b7vRH3qUjzfRNrQEtXc+kTCtlfko/HV7UWakG60PMsOVG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074252; c=relaxed/simple; bh=MR7mGv44uH93XVt6JOmyrHGxIEfJa5wPWj2sSiGQABg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N//cDr+aYm/i93QdwX7OkGvLFf+Eboct2f6ypzc7yrVZ2lMfxX9Sb8moe0trYE/jykRmnPeoaX8Y8GBYFVIy/qIktzlQW062CoukbpJoEF6Hwe1+Ma+VreScclS8Y7rQP/c6qm/qiLv+imxD2+8pPY87pKwMK9wWsNP25wH5IM0= 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=b0ErMiFu; arc=none smtp.client-ip=192.198.163.19 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="b0ErMiFu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074252; x=1760610252; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MR7mGv44uH93XVt6JOmyrHGxIEfJa5wPWj2sSiGQABg=; b=b0ErMiFuiNM4DGHp7Mc0Eurs9pu0YhIcq/1hjTblFZEgTp1mMy3c5+F0 hxKVczaa0DkmyR4ye/z+MIbQRUgmCzg23HG5c5mrP/rF2+0OasUjjoAuh KDgM+em2jjpxvTyI2F+i9tlMF3tgMgu1Yd6lcPM7hKSVSi2Q/Wboav8Cm S2nplCOiFjzhMy46n8eUX/6qH0C7Viw2h2TSgvDIgpXOo/9rilHTDbIBn I86qJFjk7Q3vMtpgtH/RZUwjE8T3i6qinJcQwJSXNw4r3lwSJpNP/5rdf rhkcFxea30gT74zW8uIh0hi9nvm4OjBlOstgO9ZNSiFstqYEgVRDG9TVL g==; X-CSE-ConnectionGUID: GSGK2w+hQay7H4xSYcijiA== X-CSE-MsgGUID: 0FdWeCAoRpCiC9u3/1acDA== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985918" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985918" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:11 -0700 X-CSE-ConnectionGUID: xv0FipJ9RsSp5N2Zqu+ZMA== X-CSE-MsgGUID: iul1Kt0wS92VZD1SSsSb5g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82960977" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:08 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 07/11] ASoC: soc-acpi: introduce new 'machine check' callback Date: Wed, 16 Oct 2024 18:23:29 +0800 Message-ID: <20241016102333.294448-8-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart The existing machine_quirk() returns a pointer to a soc_acpi_mach structure. For SoundWire/SDCA support, we need a slightly different functionality where a quirk function either validates or NACKs an initial selection, based on additional firmware/DMI information. Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- include/sound/soc-acpi.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h index ac7f9e791ee1..72e371a21767 100644 --- a/include/sound/soc-acpi.h +++ b/include/sound/soc-acpi.h @@ -185,6 +185,10 @@ struct snd_soc_acpi_link_adr { * ACPI ID alone is not sufficient, wrong or misleading * @quirk_data: data used to uniquely identify a machine, usually a list of * audio codecs whose presence if checked with ACPI + * @machine_check: pointer to quirk function. The functionality is similar= to + * the use of @machine_quirk, except that the return value is a boolean: t= he intent + * is to skip a machine if the additional hardware/firmware verification i= nvalidates + * the initial selection in the snd_soc_acpi_mach table. * @pdata: intended for platform data or machine specific-ops. This struct= ure * is not constant since this field may be updated at run-time * @sof_tplg_filename: Sound Open Firmware topology file name, if enabled @@ -203,6 +207,7 @@ struct snd_soc_acpi_mach { const char *board; struct snd_soc_acpi_mach * (*machine_quirk)(void *arg); const void *quirk_data; + bool (*machine_check)(void *arg); void *pdata; struct snd_soc_acpi_mach_params mach_params; const char *sof_tplg_filename; --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 CC2F02101B5; Wed, 16 Oct 2024 10:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074256; cv=none; b=fuN6bODBxecEbri4f90uBfwM6SvevW29u82ORuzyFX+QhCeUqfTwtkcbOOOvfHC7Eush5oiutwwiqwWYEjm40O63DaIlsup3QPePARnk0n5LlsleBrOiVq1xuNQkYjHVSP9l9lkhc9iS4DKYpzxCP1BcrYs/dVfFjUUFIMejRNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074256; c=relaxed/simple; bh=vr/oL273acBCaJMtolC7CXyVZDTAOm/tQGUnqwMQ4Cw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ibjnD2R/SOw178fI7VWw0GUYD19Q57gxC+dnE5Bsop04CuHpa8azy7sL9KIkdtiaoolx1ZDz+VjnHj1b6KgCBxHmvjYxPWNQt+lPUOTiCSf77JgUMDEosmBQej8H614hEKkxOVZSAPGy5FWEKg5idJyHBUyx+4TPel8zaDt56fc= 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=SF1cu3yu; arc=none smtp.client-ip=192.198.163.19 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="SF1cu3yu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074255; x=1760610255; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vr/oL273acBCaJMtolC7CXyVZDTAOm/tQGUnqwMQ4Cw=; b=SF1cu3yuxD8yiY0OFnBdQ0e2CWhjenWQl3cgb++zZyH2rtxWGnoTd9yT Y7wR2AzCtbd2bdriEvtoyBWXf3au57DIYlpeuI8k7s7JEE4AqU/17Wlwv TqsXP8jWCNpAXB3H3N1ebrvqTNUpgWRIMYWbdiA4xkeCu2If4CqOBZs1W NLT7R0pz64OFP3kKlHJEGF7DAcJ7gCk4s/VcfW6nVPnHOsisHUBBsg9vN 0XWpKOISnF4f3PudKtbty8bKOaT7A0E8rdtfn9HlDZ5VzojzGmw3JXC2s vplfzBHRAA7hWCQr0WNi8u8+E85WVp9vXg7MsH8Kyk6Z/UHgLGhUwegG2 w==; X-CSE-ConnectionGUID: ndaaJiGsRKmPevMdfHjnlg== X-CSE-MsgGUID: SVNREGFjT3SM3xNet6xxBQ== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985925" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985925" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:15 -0700 X-CSE-ConnectionGUID: azL7BDqiS5urRvF5McYGtQ== X-CSE-MsgGUID: A5pgsrcCRi6CJEJV5YZSZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82961005" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:12 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 08/11] ASoC: sdw_utils: add SmartMic DAI for RT712 VB Date: Wed, 16 Oct 2024 18:23:30 +0800 Message-ID: <20241016102333.294448-9-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart In theory the dailinks are created based on the number of endpoints reported in ACPI match tables, so it should harmless to add a new dailink: RT712 VA would not use it since it has only 2 endpoints. Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- sound/soc/sdw_utils/soc_sdw_utils.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_= sdw_utils.c index 6f6bff0f69fc..9fc07731a05b 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -144,8 +144,15 @@ struct asoc_sdw_codec_info codec_info_list[] =3D { .widgets =3D generic_spk_widgets, .num_widgets =3D ARRAY_SIZE(generic_spk_widgets), }, + { + .direction =3D {false, true}, + .dai_name =3D "rt712-sdca-aif3", + .dai_type =3D SOC_SDW_DAI_TYPE_MIC, + .dailink =3D {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID}, + .rtd_init =3D asoc_sdw_rt_dmic_rtd_init, + }, }, - .dai_num =3D 2, + .dai_num =3D 3, }, { .part_id =3D 0x1712, --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 DCF7A210C2F; Wed, 16 Oct 2024 10:24:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074259; cv=none; b=Qkq12YtjMDKrBhEXQE/ubM8fxATvy3RIKs7JiSuKiC+0GwzNLBfjF3YTXIIWXjKQ6yu+B2qcYyqp30/ebraaVU9QxbCL+W0HDBX+9x3+ua+d+D4Q6VTjDNNMP3X8FiCdrnTCvQzBu4ddOMeKfnjqdl55+HHxCLRGb1tPGxgsFys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074259; c=relaxed/simple; bh=aJrKVCeuvpCL/FbgZ8Sr/GttrHpwhSeE/BtJa7KW7u0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mNQ2j6yJoSropS1/UIZUAwCbqtykhOEaanPxrJEdb8IPONR4hystgbnuzac+w2y8gCeZSptDg0jUy9g1LMwVVWEUwrTPe98Fkt+53NxCAEkvi8GKzuB8l3k6VQ5PgRDyFjPBX19PytPdo9k6pzbHFLucJoTcsmJxb0G2bgQp0Xw= 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=RSUA5MxZ; arc=none smtp.client-ip=192.198.163.19 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="RSUA5MxZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074258; x=1760610258; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aJrKVCeuvpCL/FbgZ8Sr/GttrHpwhSeE/BtJa7KW7u0=; b=RSUA5MxZWBYesXB2z0zUupaxoQDCQWZG2A1UT6jVrTbdp3fvm2MHqYn9 diAFTXx+hCaN+1TJhWdprF+mUojUsTDzWLN2HYeCYMTCBdJVyY5VU5az0 1sxqg7Br+zAKnUdI/GUhdDAtkyHofaDzb7DkisUVBaPQZ6ZKYqDgXopxW JAgg82IFQa8nyFhnAZAu2GeffSWUH8x90FK+U84Qrx1nVVBmKltJmfl1M pSPMBvtFPTXM8zLokQoFduoF3qjvMER/xolH5vetxC6Pu69fW0ESflBg3 ezx8Sh1eFZw/r1Oi6iO/u3szK7JqIAGEmL97VdWQeGcwZb+X9g06buh+q A==; X-CSE-ConnectionGUID: Uw5V5RqCT5OwNrgtlGyLkQ== X-CSE-MsgGUID: 6CI7JaRIQMOFjyFh3vKlyg== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985931" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985931" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:18 -0700 X-CSE-ConnectionGUID: 73Cl4cYZQEa/hEXzSgG/9w== X-CSE-MsgGUID: FXeXwmjjR3yzRBsegla9eA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82961016" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:15 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 09/11] ASoC: sdw_utils: add SmartMic DAI for RT713 VB Date: Wed, 16 Oct 2024 18:23:31 +0800 Message-ID: <20241016102333.294448-10-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart In theory the dailinks are created based on the number of endpoints reported in ACPI match tables, so it should harmless to add a new dailink: RT713 VA would not use it since it has only 2 endpoints. Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- sound/soc/sdw_utils/soc_sdw_utils.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_= sdw_utils.c index 9fc07731a05b..8196177ff5e7 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -185,8 +185,15 @@ struct asoc_sdw_codec_info codec_info_list[] =3D { .widgets =3D generic_jack_widgets, .num_widgets =3D ARRAY_SIZE(generic_jack_widgets), }, + { + .direction =3D {false, true}, + .dai_name =3D "rt712-sdca-aif3", + .dai_type =3D SOC_SDW_DAI_TYPE_MIC, + .dailink =3D {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID}, + .rtd_init =3D asoc_sdw_rt_dmic_rtd_init, + }, }, - .dai_num =3D 1, + .dai_num =3D 2, }, { .part_id =3D 0x1713, --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 35B01212635; Wed, 16 Oct 2024 10:24:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074262; cv=none; b=rV3mHhR5F0t7SxzhMbBX13JJ/Kr9gxAiNsawVLgcHMiWITEyyvKGsqctdXKgwoicRRtT4RVnruKmuvP6VEFNGEijJRGYt156oA7hKZ6sEgnoCeacAfeNgNwrqa58fOIeCe8fTH3RKBpWy2cVHIOo8OAW8b6IAcRRymjhbiiUeeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074262; c=relaxed/simple; bh=cB4F2W2GBylk0CZbCVAfMq5n7DHvGFpx/u2Yn4ZBHKU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AQcu5XmV6bJ57pK47wpT/ulXCRp2wAdJ+oG+2UUfiCPXUZijU0FBTta2q0/gFu/4EN6y+L56lwPqQli8NpLNGHGHBe0TAxuxc+/QQdDamofLi+GoWbKlh6thvjeKIZnImwEArtEnne568KKTpPnw1x5MJBIMXXOEDGY59x6jGpM= 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=PPGGpjc0; arc=none smtp.client-ip=192.198.163.19 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="PPGGpjc0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074261; x=1760610261; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cB4F2W2GBylk0CZbCVAfMq5n7DHvGFpx/u2Yn4ZBHKU=; b=PPGGpjc0+y5NP4UcLWVjepNQmspXcHgJqxIDfT7AEjhqzZ23jBCf2ZqG Crgp4svkivFxxSKkJFFGjzkql0rrX0aEA2GlkyQrQjrBFfyfFeExjWyRS kfXJgOgsFS5s4ENh3cvsfrpXU8kD7Sx+JDK66nTGlPqCQsZBjq0TBp2/e 5NMOfxmAgaO6SMhIdfCWGdax6JGl9MWsAU15+1FDEo0Z1otOr5K91l0ou PM8Rm6xGyJ0OT++njAV5cyJT6w5ucmq06s0pQM3qq/UpK0BxaEa+ArJIx 6IiTv1t3JXdEmvfm21tZ0M6LNObdUa/ddpUNrD7TU3PTG1e9sEfExSgcF g==; X-CSE-ConnectionGUID: dbkvJ6gwScyMl8vnZveP8Q== X-CSE-MsgGUID: QiXBzi1NRvC8LgYlczek8w== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985937" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985937" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:21 -0700 X-CSE-ConnectionGUID: dPr/AaH0QGSL9aXsQRq8iw== X-CSE-MsgGUID: 3gAkUUDsTbyN2cq40ekdMA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82961030" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:18 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 10/11] ASoC: Intel: soc-acpi: add is_device_rt712_vb() helper Date: Wed, 16 Oct 2024 18:23:32 +0800 Message-ID: <20241016102333.294448-11-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart Add a filter to skip the RT172 VB configuration if a SmartMic Function is not found in the SDCA descriptors. If the ACPI information is incorrect this can only be quirked further with DMI information. Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- sound/soc/intel/Kconfig | 5 ++ sound/soc/intel/common/Makefile | 3 ++ .../intel/common/soc-acpi-intel-mtl-match.c | 51 +++++++++++++++++++ .../intel/common/soc-acpi-intel-sdca-quirks.c | 42 +++++++++++++++ .../intel/common/soc-acpi-intel-sdca-quirks.h | 14 +++++ 5 files changed, 115 insertions(+) create mode 100644 sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c create mode 100644 sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index 5bb7047c170f..14461dee3e52 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig @@ -71,9 +71,14 @@ if SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLE= VEL config SND_SOC_ACPI_INTEL_MATCH tristate select SND_SOC_ACPI if ACPI + select SND_SOC_ACPI_INTEL_SDCA_QUIRKS # this option controls the compilation of ACPI matching tables and # helpers and is not meant to be selected by the user. =20 +config SND_SOC_ACPI_INTEL_SDCA_QUIRKS + tristate + imply SND_SOC_SDCA + endif ## SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLEVEL =20 config SND_SOC_INTEL_KEEMBAY diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makef= ile index da551144ec0f..0afd114be9e5 100644 --- a/sound/soc/intel/common/Makefile +++ b/sound/soc/intel/common/Makefile @@ -16,4 +16,7 @@ snd-soc-acpi-intel-match-y :=3D soc-acpi-intel-byt-match.= o soc-acpi-intel-cht-matc =20 snd-soc-acpi-intel-match-y +=3D soc-acpi-intel-ssp-common.o =20 +snd-soc-acpi-intel-sdca-quirks-y +=3D soc-acpi-intel-sdca-quirks.o + obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) +=3D snd-soc-acpi-intel-match.o +obj-$(CONFIG_SND_SOC_ACPI_INTEL_SDCA_QUIRKS) +=3D snd-soc-acpi-intel-sdca-= quirks.o 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 fd02c864e25e..0b37465b6c53 100644 --- a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c @@ -6,9 +6,12 @@ * */ =20 +#include +#include #include #include #include +#include "soc-acpi-intel-sdca-quirks.h" #include "soc-acpi-intel-sdw-mockup-match.h" =20 static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp =3D { @@ -133,6 +136,27 @@ static const struct snd_soc_acpi_endpoint rt712_endpoi= nts[] =3D { }, }; =20 +static const struct snd_soc_acpi_endpoint rt712_vb_endpoints[] =3D { + { + .num =3D 0, + .aggregated =3D 0, + .group_position =3D 0, + .group_id =3D 0, + }, + { + .num =3D 1, + .aggregated =3D 0, + .group_position =3D 0, + .group_id =3D 0, + }, + { + .num =3D 2, + .aggregated =3D 0, + .group_position =3D 0, + .group_id =3D 0, + }, +}; + /* * RT722 is a multi-function codec, three endpoints are created for * its headset, amp and dmic functions. @@ -190,6 +214,15 @@ static const struct snd_soc_acpi_adr_device rt712_0_si= ngle_adr[] =3D { } }; =20 +static const struct snd_soc_acpi_adr_device rt712_vb_0_single_adr[] =3D { + { + .adr =3D 0x000030025D071201ull, + .num_endpoints =3D ARRAY_SIZE(rt712_vb_endpoints), + .endpoints =3D rt712_vb_endpoints, + .name_prefix =3D "rt712" + } +}; + static const struct snd_soc_acpi_adr_device rt1712_3_single_adr[] =3D { { .adr =3D 0x000330025D171201ull, @@ -363,6 +396,15 @@ static const struct snd_soc_acpi_link_adr mtl_712_l0[]= =3D { {} }; =20 +static const struct snd_soc_acpi_link_adr mtl_712_vb_l0[] =3D { + { + .mask =3D BIT(0), + .num_adr =3D ARRAY_SIZE(rt712_vb_0_single_adr), + .adr_d =3D rt712_vb_0_single_adr, + }, + {} +}; + static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] =3D { { /* Jack Playback Endpoint */ .num =3D 0, @@ -774,6 +816,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_ma= chines[] =3D { .drv_name =3D "sof_sdw", .sof_tplg_filename =3D "sof-mtl-rt712-l0-rt1712-l3.tplg", }, + { + .link_mask =3D BIT(0), + .links =3D mtl_712_vb_l0, + .drv_name =3D "sof_sdw", + .machine_check =3D snd_soc_acpi_intel_sdca_is_device_rt712_vb, + .sof_tplg_filename =3D "sof-mtl-rt712-vb-l0.tplg", + }, { .link_mask =3D BIT(0), .links =3D mtl_712_l0, @@ -843,3 +892,5 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_mac= hines[] =3D { {}, }; EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines); + +MODULE_IMPORT_NS(SND_SOC_ACPI_INTEL_SDCA_QUIRKS); diff --git a/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c b/sound/so= c/intel/common/soc-acpi-intel-sdca-quirks.c new file mode 100644 index 000000000000..0b7076606d66 --- /dev/null +++ b/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * soc-acpi-intel-sdca-quirks.c - tables and support for SDCA quirks + * + * Copyright (c) 2024, Intel Corporation. + * + */ + +#include +#include +#include +#include "soc-acpi-intel-sdca-quirks.h" + +/* + * Pretend machine quirk. The argument type is not the traditional + * 'struct snd_soc_acpi_mach' pointer but instead the sdw_intel_ctx + * which contains the peripheral information required for the + * SoundWire/SDCA filter on the SMART_MIC setup and interface + * revision. When the return value is false, the entry in the + * 'snd_soc_acpi_mach' table needs to be skipped. + */ +bool snd_soc_acpi_intel_sdca_is_device_rt712_vb(void *arg) +{ + struct sdw_intel_ctx *ctx =3D arg; + int i; + + if (!ctx) + return false; + + for (i =3D 0; i < ctx->peripherals->num_peripherals; i++) { + if (sdca_device_quirk_match(ctx->peripherals->array[i], + SDCA_QUIRKS_RT712_VB)) + return true; + } + + return false; +} +EXPORT_SYMBOL_NS(snd_soc_acpi_intel_sdca_is_device_rt712_vb, SND_SOC_ACPI_= INTEL_SDCA_QUIRKS); + +MODULE_DESCRIPTION("ASoC ACPI Intel SDCA quirks"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(SND_SOC_SDCA); diff --git a/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h b/sound/so= c/intel/common/soc-acpi-intel-sdca-quirks.h new file mode 100644 index 000000000000..bead5ec6243f --- /dev/null +++ b/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * soc-acpi-intel-sdca-quirks.h - tables and support for SDCA quirks + * + * Copyright (c) 2024, Intel Corporation. + * + */ + +#ifndef _SND_SOC_ACPI_INTEL_SDCA_QUIRKS +#define _SND_SOC_ACPI_INTEL_SDCA_QUIRKS + +bool snd_soc_acpi_intel_sdca_is_device_rt712_vb(void *arg); + +#endif --=20 2.43.0 From nobody Tue Nov 26 19:42:19 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 6C20E212EE5; Wed, 16 Oct 2024 10:24:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074265; cv=none; b=aUhWgOYDza4KtE5YzwQmmjuUlGWMenWt8ph+hwZEc+qd7Fce9EOkkBr3c6B3ka8Ndhf4lwXjzdQZKPA3TFtkYzYljn0aCma+pu27plp5PM3EORDwDanY2q99Rjo3fYNDiiO97pHZ6lkMe8GsiMchaL6TSqsZfAMMr4tgif2geyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074265; c=relaxed/simple; bh=JyhxhUVd8DyT3ftBCZnDzf7V31bEENXyt/3/kHeBsEY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VgJY7t5tuMxAZEYa/+/vlXtgkduFdqGTeSgyFngE2W/1VXora7mshE+wKj9boI/kaQ861KVPFKXv+FiFi9R3HGyObPHVhNAyt4y9zrMjL9czlnfwwBAJjjBN9xfeAGYt8HUgdp4GRZH64MSg4zzcgJEjd8eLDEx19DgeZWfv5ew= 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=eeESmpRm; arc=none smtp.client-ip=192.198.163.19 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="eeESmpRm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729074265; x=1760610265; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JyhxhUVd8DyT3ftBCZnDzf7V31bEENXyt/3/kHeBsEY=; b=eeESmpRmj/DKZkI2qFP/yRFi23dFsbAyLinEfTNskQ2Sw5gl9Ee2VB6H A3l2Ry1LMzbDWEaAjRBUHZpAoPkvXekZZBPY2X0/Qbv2tf0yw2Joqk1Zp V/9XSDPlRJAAWtgCWGrCg9CyRnEgG0JhwXJFwo0l3s2n+ATJBVV5tKRce Z+BSei9BpSWHMolprOCeOkOo12lag2AwkHZqz1MNMxQ4KqkxK0DzyqHQj NKSmMQM+2pb88y5OHVVOTtVABFKeCGGoYZ/i1urFOxKtjoBxpJXk08HcE XLvkVCXf2GX5is59pX9Iuv+W8v1Z/aaqIEZ6NScjDDw2OG5k6SaVAx7Vs Q==; X-CSE-ConnectionGUID: Z8PgeoHgQgiGQMxWdkHEyA== X-CSE-MsgGUID: TfnFR4y+R1yRwtGEKGkPlg== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="27985947" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="27985947" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:24 -0700 X-CSE-ConnectionGUID: 85SBHPE5QYebM675VApPew== X-CSE-MsgGUID: NY1lfgY5Q4KhZlACQCWSwA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82961045" Received: from cvapit-mobl1.ger.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:24:22 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com Subject: [PATCH 11/11] ASoC: SOF: Intel: hda: use machine_check() for SoundWire Date: Wed, 16 Oct 2024 18:23:33 +0800 Message-ID: <20241016102333.294448-12-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> References: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Pierre-Louis Bossart Use the new machine_check() callback to select an alternate topology for RT712-VB devices. Signed-off-by: Pierre-Louis Bossart Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- sound/soc/sof/intel/hda.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 9abc4c071ae5..38921c0db84e 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1124,7 +1124,8 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_sele= ct(struct snd_sof_dev *sdev } /* Found if all Slaves are checked */ if (i =3D=3D hdev->info.count || !link->num_adr) - break; + if (!mach->machine_check || mach->machine_check(hdev->sdw)) + break; } if (mach && mach->link_mask) { mach->mach_params.links =3D mach->links; --=20 2.43.0