From patchwork Thu Oct 12 08:34:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 733749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14B9ECDB47E for ; Thu, 12 Oct 2023 08:40:09 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 37D3684B; Thu, 12 Oct 2023 10:39:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 37D3684B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100006; bh=S5jBDTM+DQJlLKIXoEEMCnr1Umj8uKrhTUOCgEUlDEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=kuGxkge3odfJeIuMzXC3VhIj5C0oLLubz33r5wMsKC2e0uqS9agNrvC9Ei0Vwsaoi h9gmlaAlBLFeGu5S5mrn6HOb7XrEp0VP+7JeIocHs5AVBO/qdwleVdwvYeqHL0Kc21 cModjDwEYtYMcBru2qIh/BpGgCwUSTr+4vXH+P4g= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 57B00F80536; Thu, 12 Oct 2023 10:38:44 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 503C3F80310; Thu, 12 Oct 2023 10:38:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 26DEEF8055C; Thu, 12 Oct 2023 10:35:31 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8D45CF80130 for ; Thu, 12 Oct 2023 10:35:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8D45CF80130 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ZtY71SCA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099716; x=1728635716; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=S5jBDTM+DQJlLKIXoEEMCnr1Umj8uKrhTUOCgEUlDEI=; b=ZtY71SCAaQFRt72gxYK21dFi8dRdhCe82H/QUrkdxk3kgp0HuRuuj8TP i1IZ19uQO87PwBZbWPtpbGdCccAMpdNxGDPti9feAT3iRR5cDuCYopmtX dZuV3SCUmVNA1dNqARRBvJz0U58yzV5SzslqQug/d/db6FbGssZQhhaRX 43lp4GV6aHf4aVvM1G9+4kqPcm+LaxkCWTjkIIDVaG+cHxMhwyoMVsVzM OlvU9M+3eEBjR8v9q/+aAj6pxOnKIbsPeypR7T1NM6wmw61pj+4L0P+GV MWJsT1lYcBrkQQwDBqD85g391zlYGVk1JG4woEey/RQicDCN6yvyWY7ZU A==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417196" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417196" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516576" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516576" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:07 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 01/16] ASoC: Intel: avs: Only create SSP%d snd_soc_dai_driver when requested Date: Thu, 12 Oct 2023 10:34:59 +0200 Message-Id: <20231012083514.492626-2-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: R67TX6D4WLNCOU6BCRRLSUAM4MSIMKVN X-Message-ID-Hash: R67TX6D4WLNCOU6BCRRLSUAM4MSIMKVN X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: When using TDM configuration some other device may be using SSP%d, so don't create snd_soc_dai_driver configuration for it unless requested by TDM configuration. While at it adjust tdf8532 board to explicitly describe TDM configuration. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/board_selection.c | 2 +- sound/soc/intel/avs/pcm.c | 28 ++++++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c index 59a13feec57b..c10fff705496 100644 --- a/sound/soc/intel/avs/board_selection.c +++ b/sound/soc/intel/avs/board_selection.c @@ -193,7 +193,7 @@ static struct snd_soc_acpi_mach avs_apl_i2s_machines[] = { .mach_params = { .i2s_link_mask = AVS_SSP_RANGE(0, 5), }, - .pdata = (unsigned long[]){ 0, 0, 0x14, 0, 0, 0 }, /* SSP2 TDMs */ + .pdata = (unsigned long[]){ 0x1, 0x1, 0x14, 0x1, 0x1, 0x1 }, /* SSP2 TDMs */ .tplg_filename = "tdf8532-tplg.bin", }, { diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index 5b31203bd56a..bea66e6bd438 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -1238,7 +1238,11 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l int i, j; ssp_count = adev->hw_cfg.i2s_caps.ctrl_count; - cpu_count = hweight_long(port_mask); + + cpu_count = 0; + for_each_set_bit(i, &port_mask, ssp_count) + if (!tdms || test_bit(0, &tdms[i])) + cpu_count++; if (tdms) for_each_set_bit(i, &port_mask, ssp_count) cpu_count += hweight_long(tdms[i]); @@ -1249,18 +1253,20 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l dai = cpus; for_each_set_bit(i, &port_mask, ssp_count) { - memcpy(dai, &i2s_dai_template, sizeof(*dai)); + if (!tdms || test_bit(0, &tdms[i])) { + memcpy(dai, &i2s_dai_template, sizeof(*dai)); - dai->name = - devm_kasprintf(adev->dev, GFP_KERNEL, "SSP%d Pin", i); - dai->playback.stream_name = - devm_kasprintf(adev->dev, GFP_KERNEL, "ssp%d Tx", i); - dai->capture.stream_name = - devm_kasprintf(adev->dev, GFP_KERNEL, "ssp%d Rx", i); + dai->name = + devm_kasprintf(adev->dev, GFP_KERNEL, "SSP%d Pin", i); + dai->playback.stream_name = + devm_kasprintf(adev->dev, GFP_KERNEL, "ssp%d Tx", i); + dai->capture.stream_name = + devm_kasprintf(adev->dev, GFP_KERNEL, "ssp%d Rx", i); - if (!dai->name || !dai->playback.stream_name || !dai->capture.stream_name) - return -ENOMEM; - dai++; + if (!dai->name || !dai->playback.stream_name || !dai->capture.stream_name) + return -ENOMEM; + dai++; + } } if (!tdms) From patchwork Thu Oct 12 08:35:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 732502 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B452CDB47E for ; Thu, 12 Oct 2023 08:40:28 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id F3C76A4A; Thu, 12 Oct 2023 10:39:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F3C76A4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100026; bh=nj17oRFzyvmyQOQJmAwbnMy2j3Jrqv8Of3qGHVFkqjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=EzcCvLh4H0Ze525bnMCDMJpkwQXHHDAffPcLyZPtriI4ODlRqxM6FcWhXgwNJBdHc smwv2WfaOKdUP95qS8GdLlDBMwAAIF2OxgBbYyH4TCtaNxQq0uUyz1ou78uJ5HnyaE Zxo2HjH4aVcKtEDa/mQ+L7Rd/c3rJ1WuNmD4/d3Y= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4997BF80571; Thu, 12 Oct 2023 10:38:47 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 63970F80564; Thu, 12 Oct 2023 10:38:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9F0F4F80563; Thu, 12 Oct 2023 10:35:35 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 195A0F802BE for ; Thu, 12 Oct 2023 10:35:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 195A0F802BE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Wol8bjRN DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099716; x=1728635716; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nj17oRFzyvmyQOQJmAwbnMy2j3Jrqv8Of3qGHVFkqjI=; b=Wol8bjRNQHNHGvA7FOIF9xjnILhEB7kGMmRRuysIOK4vSEXqoYpt4nyU TTvbYOgj/KqTAKrT1VSbRv0cSRV8TTnd/PqqOJXaaHEUpYubiNToD8Asx Gnn0WZgURwh2BBZ4qREhwk59mQe7XAMRB412Mvip8anY3wcjvXWjd4CBM yNSpUHRrk7T35L4qK2wRGAhOSNR9OMB+O/rdtpj97WSyX7pA4PwOahdII 1ME+YwIi0kh9PsVfNXczquMoFSWPFVNosphyTSIWJJRKGUXK9j6WAOwIE f0iBrRveOmuLhKfFtM4lQ6gV6H7JAzEEuM0E2FcdsRJ8GsK61julTLmfj g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417208" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417208" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516583" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516583" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:09 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 02/16] ASoC: Intel: avs: Introduce helper functions for SSP and TDM handling Date: Thu, 12 Oct 2023 10:35:00 +0200 Message-Id: <20231012083514.492626-3-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: I4SYGDELN22ZOI3EOKMET7KX6GQVPKNS X-Message-ID-Hash: I4SYGDELN22ZOI3EOKMET7KX6GQVPKNS X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In quite a few places in code there are checks for number of SSPs present on system, to reduce maintenance burden introduce helper functions allowing to get SSP and TDM from machine board configuration. Additionally in boards we use SSP and TDM to generate quite a few strings, it could be done like: if (tdms) dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d:%d-Codec", ssp_port, tdm_slot); else dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); but quite quickly code ends up with spaghetti of similar if elses. Instead introduce macro which can be used to generate correct string, allowing to minimize code to something like: dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/utils.h | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sound/soc/intel/avs/utils.h diff --git a/sound/soc/intel/avs/utils.h b/sound/soc/intel/avs/utils.h new file mode 100644 index 000000000000..0b82a98ed024 --- /dev/null +++ b/sound/soc/intel/avs/utils.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright(c) 2023 Intel Corporation. All rights reserved. + * + * Authors: Cezary Rojewski + * Amadeusz Slawinski + */ + +#ifndef __SOUND_SOC_INTEL_AVS_UTILS_H +#define __SOUND_SOC_INTEL_AVS_UTILS_H + +#include + +static inline bool avs_mach_singular_ssp(struct snd_soc_acpi_mach *mach) +{ + return hweight_long(mach->mach_params.i2s_link_mask) == 1; +} + +static inline u32 avs_mach_ssp_port(struct snd_soc_acpi_mach *mach) +{ + return __ffs(mach->mach_params.i2s_link_mask); +} + +static inline bool avs_mach_singular_tdm(struct snd_soc_acpi_mach *mach, u32 port) +{ + unsigned long *tdms = mach->pdata; + + return !tdms || (hweight_long(tdms[port]) == 1); +} + +static inline u32 avs_mach_ssp_tdm(struct snd_soc_acpi_mach *mach, u32 port) +{ + unsigned long *tdms = mach->pdata; + + return tdms ? __ffs(tdms[port]) : 0; +} + +static inline int avs_mach_get_ssp_tdm(struct device *dev, struct snd_soc_acpi_mach *mach, + int *ssp_port, int *tdm_slot) +{ + int port; + + if (!avs_mach_singular_ssp(mach)) { + dev_err(dev, "Invalid SSP configuration\n"); + return -EINVAL; + } + port = avs_mach_ssp_port(mach); + + if (!avs_mach_singular_tdm(mach, port)) { + dev_err(dev, "Invalid TDM configuration\n"); + return -EINVAL; + } + *ssp_port = port; + *tdm_slot = avs_mach_ssp_tdm(mach, *ssp_port); + + return 0; +} + +/* + * Macro to easily generate format strings + */ +#define AVS_STRING_FMT(prefix, suffix, ssp, tdm) \ + (tdm) ? prefix "%d:%d" suffix : prefix "%d" suffix, (ssp), (tdm) + +#endif From patchwork Thu Oct 12 08:35:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 732501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DFC6ACDB46E for ; Thu, 12 Oct 2023 08:40:57 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CBBD4DF0; Thu, 12 Oct 2023 10:40:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CBBD4DF0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100054; bh=CBr7+wMU/IkWb3QPmgjG0/U5KSwig70kzXJn27Ush5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=J/1wXzws0R5qTyRo919ddRg5J2iV2iHoOpzIZU1wGTuL+su1DA/dHPvXt7guQ/EQZ eRmoqLKFlJsTGRTyQRDcw26JpkZuzgr7Ctf2TndUIGuItSkPKRShS5hcVVqttYKWNc 35f3oH0Z2K7LBGHycE7wBkUFClmXATLMaS0R6GIo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 00F4EF805AD; Thu, 12 Oct 2023 10:38:52 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 4AA5DF805A9; Thu, 12 Oct 2023 10:38:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E7A7CF80579; Thu, 12 Oct 2023 10:35:46 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C8F5CF80536 for ; Thu, 12 Oct 2023 10:35:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C8F5CF80536 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iRcqD6ZY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099719; x=1728635719; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CBr7+wMU/IkWb3QPmgjG0/U5KSwig70kzXJn27Ush5M=; b=iRcqD6ZYMr3JjtYXEfOZYrSS/KoUfuK7ZjhqtneZIQDYLqQixmNs4K6n KJfJC0KvMTuc8fA1EbdsWEdywrdyOjUJmjcdSye9ztylWslN9piuX9S2F kAxLOdV31bf4a2aApKPIOG8BZE4BKNM9v5VogFRtMo4ZwWKwkYTFBGPQm CaRG2kc+3HH9ZNmVeL7Dv62MdD/KyoPYHDAqec4EbqCBN4ZkwG0+pbJP+ taC0PISbhpEj3DXiyxTafAL0b09o1xQW9wzkzEmU+FtHgykue3Ho+8kDj NHM9NJjU7WVjj+Vvb7LVIljpOEJaAId96oTo5AMEG837X/a2KZn3GmRIM Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417220" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417220" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516597" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516597" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:11 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 03/16] ASoC: Intel: avs: Improve topology parsing of dynamic strings Date: Thu, 12 Oct 2023 10:35:01 +0200 Message-Id: <20231012083514.492626-4-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: DL4FF4LNWIHD2HHZZBRN6E345YDGJUEH X-Message-ID-Hash: DL4FF4LNWIHD2HHZZBRN6E345YDGJUEH X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Current mechanism replaces "%d" present in some routes and widget names with SSP number. However there are also configurations which make use of TDM number, in which case expected behavior would be to have string in form of SSP:TDM - see implementation of avs_i2s_platform_register() in sound/soc/intel/avs/pcm.c. Implement custom function, which parses string and make use of it when parsing topology. While at it make sure that we generate dynamic names only if there is no multiple SSPs or TDMs defined. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/topology.c | 102 ++++++++++++++++++++++++++------- 1 file changed, 80 insertions(+), 22 deletions(-) diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c index 45d0eb2a8e71..c74e9d622e4c 100644 --- a/sound/soc/intel/avs/topology.c +++ b/sound/soc/intel/avs/topology.c @@ -15,6 +15,7 @@ #include "avs.h" #include "control.h" #include "topology.h" +#include "utils.h" /* Get pointer to vendor array at the specified offset. */ #define avs_tplg_vendor_array_at(array, offset) \ @@ -371,22 +372,50 @@ parse_audio_format_bitfield(struct snd_soc_component *comp, void *elem, void *ob return 0; } +static int avs_ssp_sprint(char *buf, size_t size, const char *fmt, int port, int tdm) +{ + char *needle = strstr(fmt, "%d"); + int retsize; + + /* + * If there is %d present in fmt string it should be replaced by either + * SSP or SSP:TDM, where SSP and TDM are numbers, all other formatting + * will be ignored. + */ + if (needle) { + retsize = scnprintf(buf, min_t(size_t, size, needle - fmt + 1), "%s", fmt); + retsize += scnprintf(buf + retsize, size - retsize, "%d", port); + if (tdm) + retsize += scnprintf(buf + retsize, size - retsize, ":%d", tdm); + retsize += scnprintf(buf + retsize, size - retsize, "%s", needle + 2); + return retsize; + } + + return snprintf(buf, size, "%s", fmt); +} + static int parse_link_formatted_string(struct snd_soc_component *comp, void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_string_elem *tuple = elem; struct snd_soc_acpi_mach *mach = dev_get_platdata(comp->card->dev); char *val = (char *)((u8 *)object + offset); + int ssp_port, tdm_slot; /* * Dynamic naming - string formats, e.g.: ssp%d - supported only for * topologies describing single device e.g.: an I2S codec on SSP0. */ - if (hweight_long(mach->mach_params.i2s_link_mask) != 1) + if (!avs_mach_singular_ssp(mach)) + return avs_parse_string_token(comp, elem, object, offset); + + ssp_port = avs_mach_ssp_port(mach); + if (!avs_mach_singular_tdm(mach, ssp_port)) return avs_parse_string_token(comp, elem, object, offset); - snprintf(val, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, tuple->string, - __ffs(mach->mach_params.i2s_link_mask)); + tdm_slot = avs_mach_ssp_tdm(mach, ssp_port); + + avs_ssp_sprint(val, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, tuple->string, ssp_port, tdm_slot); return 0; } @@ -813,6 +842,7 @@ static void assign_copier_gtw_instance(struct snd_soc_component *comp, struct avs_tplg_modcfg_ext *cfg) { struct snd_soc_acpi_mach *mach; + int ssp_port, tdm_slot; if (!guid_equal(&cfg->type, &AVS_COPIER_MOD_UUID)) return; @@ -826,11 +856,22 @@ assign_copier_gtw_instance(struct snd_soc_component *comp, struct avs_tplg_modcf return; } + /* If topology sets value don't overwrite it */ + if (cfg->copier.vindex.i2s.instance) + return; + mach = dev_get_platdata(comp->card->dev); - /* Automatic assignment only when board describes single SSP. */ - if (hweight_long(mach->mach_params.i2s_link_mask) == 1 && !cfg->copier.vindex.i2s.instance) - cfg->copier.vindex.i2s.instance = __ffs(mach->mach_params.i2s_link_mask); + if (!avs_mach_singular_ssp(mach)) + return; + ssp_port = avs_mach_ssp_port(mach); + + if (!avs_mach_singular_tdm(mach, ssp_port)) + return; + tdm_slot = avs_mach_ssp_tdm(mach, ssp_port); + + cfg->copier.vindex.i2s.instance = ssp_port; + cfg->copier.vindex.i2s.time_slot = tdm_slot; } static int avs_tplg_parse_modcfg_ext(struct snd_soc_component *comp, @@ -1381,20 +1422,24 @@ static int avs_route_load(struct snd_soc_component *comp, int index, struct snd_soc_acpi_mach *mach = dev_get_platdata(comp->card->dev); size_t len = SNDRV_CTL_ELEM_ID_NAME_MAXLEN; char buf[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; - u32 port; + int ssp_port, tdm_slot; /* See parse_link_formatted_string() for dynamic naming when(s). */ - if (hweight_long(mach->mach_params.i2s_link_mask) == 1) { - port = __ffs(mach->mach_params.i2s_link_mask); - - snprintf(buf, len, route->source, port); - strscpy((char *)route->source, buf, len); - snprintf(buf, len, route->sink, port); - strscpy((char *)route->sink, buf, len); - if (route->control) { - snprintf(buf, len, route->control, port); - strscpy((char *)route->control, buf, len); - } + if (!avs_mach_singular_ssp(mach)) + return 0; + ssp_port = avs_mach_ssp_port(mach); + + if (!avs_mach_singular_tdm(mach, ssp_port)) + return 0; + tdm_slot = avs_mach_ssp_tdm(mach, ssp_port); + + avs_ssp_sprint(buf, len, route->source, ssp_port, tdm_slot); + strscpy((char *)route->source, buf, len); + avs_ssp_sprint(buf, len, route->sink, ssp_port, tdm_slot); + strscpy((char *)route->sink, buf, len); + if (route->control) { + avs_ssp_sprint(buf, len, route->control, ssp_port, tdm_slot); + strscpy((char *)route->control, buf, len); } return 0; @@ -1408,6 +1453,7 @@ static int avs_widget_load(struct snd_soc_component *comp, int index, struct avs_tplg_path_template *template; struct avs_soc_component *acomp = to_avs_soc_component(comp); struct avs_tplg *tplg; + int ssp_port, tdm_slot; if (!le32_to_cpu(dw->priv.size)) return 0; @@ -1419,16 +1465,28 @@ static int avs_widget_load(struct snd_soc_component *comp, int index, tplg = acomp->tplg; mach = dev_get_platdata(comp->card->dev); + if (!avs_mach_singular_ssp(mach)) + goto static_name; + ssp_port = avs_mach_ssp_port(mach); /* See parse_link_formatted_string() for dynamic naming when(s). */ - if (hweight_long(mach->mach_params.i2s_link_mask) == 1) { + if (avs_mach_singular_tdm(mach, ssp_port)) { + /* size is based on possible %d -> SSP:TDM, where SSP and TDM < 10 + '\0' */ + size_t size = strlen(dw->name) + 2; + char *buf; + + tdm_slot = avs_mach_ssp_tdm(mach, ssp_port); + + buf = kmalloc(size, GFP_KERNEL); + if (!buf) + return -ENOMEM; + avs_ssp_sprint(buf, size, dw->name, ssp_port, tdm_slot); kfree(w->name); /* w->name is freed later by soc_tplg_dapm_widget_create() */ - w->name = kasprintf(GFP_KERNEL, dw->name, __ffs(mach->mach_params.i2s_link_mask)); - if (!w->name) - return -ENOMEM; + w->name = buf; } +static_name: template = avs_tplg_path_template_create(comp, tplg, dw->priv.array, le32_to_cpu(dw->priv.size)); if (IS_ERR(template)) { From patchwork Thu Oct 12 08:35:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 733748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA52DCDB46E for ; Thu, 12 Oct 2023 08:40:36 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AAA8583E; Thu, 12 Oct 2023 10:39:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AAA8583E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100034; bh=l0z6R3tLkxrw0ftRKa62KF2GmKmj9rJlqEM7xSB5JOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=px+bfD1AE/HszIrC9GFHzMx/5l2hAdFIP2N6mRt149FaMdEWhkcv3xqcOSm92o0G2 ZOM6ohhkw7YPfndCgEpOjo18OrpAdN8FFXJLAUXE+OvurhRSFLcmNfXP+C71L6e1mn qNnvZvww4JIdabWFUYl1+WFGh6z3g6B18XIVtN6E= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D524EF8056F; Thu, 12 Oct 2023 10:38:49 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 39218F8057B; Thu, 12 Oct 2023 10:38:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 33926F8057B; Thu, 12 Oct 2023 10:35:39 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 13578F802E8 for ; Thu, 12 Oct 2023 10:35:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 13578F802E8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ZOU7e5E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099718; x=1728635718; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l0z6R3tLkxrw0ftRKa62KF2GmKmj9rJlqEM7xSB5JOQ=; b=ZOU7e5E59boEQj7zZsET2IImUx5d2i4ZIPDn4Dt/yCJL8DHuE24QYbsO rjzgqqncCkAX1W0hvT68/CKTWGPaZl/UUiZvfbr0LxyGelkbSAQH8VdkL 2Ek1tKn6hf5Nqr18xsBFQx84ts3vyjTPt0AvNVylXG5iEdtvfmgf5gRF3 7QGKc3YGN9sYd3bPQmMTuLqDHvdulseavF+CmtdyoSHphath8TyWNslqk /qW3YzXWyscUTvsaFsanTDiWDMeD+XolKvRWCp5LnCFiUuDyXIQfdbCwv 2RcE34Yq7EnKO3f4CJWOrv8cvqhdodRBUYIyXRDKe41zNrKWkP0W67Skk Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417243" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417243" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516602" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516602" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:13 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 04/16] ASoC: Intel: avs: i2s_test: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:02 +0200 Message-Id: <20231012083514.492626-5-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: P5L5OXP2SDGC7YLZC7MABANI2HRTZCFD X-Message-ID-Hash: P5L5OXP2SDGC7YLZC7MABANI2HRTZCFD X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: I2S test board can be used in any SSP and TDM configuration. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/i2s_test.c | 55 ++++++++++++++++++--------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/sound/soc/intel/avs/boards/i2s_test.c b/sound/soc/intel/avs/boards/i2s_test.c index 1dd0c59a8d91..3d03e1eed3a9 100644 --- a/sound/soc/intel/avs/boards/i2s_test.c +++ b/sound/soc/intel/avs/boards/i2s_test.c @@ -12,9 +12,10 @@ #include #include #include +#include "../utils.h" static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -26,12 +27,14 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); if (!dl->name || !dl->cpus) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs = &snd_soc_dummy_dlc; if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) return -ENOMEM; @@ -51,7 +54,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, +static int avs_create_dapm_routes(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dapm_route **routes, int *num_routes) { struct snd_soc_dapm_route *dr; @@ -61,13 +64,17 @@ static int avs_create_dapm_routes(struct device *dev, int ssp_port, if (!dr) return -ENOMEM; - dr[0].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%dpb", ssp_port); - dr[0].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); + dr[0].sink = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("ssp", "pb", ssp_port, tdm_slot)); + dr[0].source = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("ssp", " Tx", ssp_port, tdm_slot)); if (!dr[0].sink || !dr[0].source) return -ENOMEM; - dr[1].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port); - dr[1].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%dcp", ssp_port); + dr[1].sink = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("ssp", " Rx", ssp_port, tdm_slot)); + dr[1].source = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("ssp", "cp", ssp_port, tdm_slot)); if (!dr[1].sink || !dr[1].source) return -ENOMEM; @@ -77,7 +84,7 @@ static int avs_create_dapm_routes(struct device *dev, int ssp_port, return 0; } -static int avs_create_dapm_widgets(struct device *dev, int ssp_port, +static int avs_create_dapm_widgets(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dapm_widget **widgets, int *num_widgets) { struct snd_soc_dapm_widget *dw; @@ -89,13 +96,15 @@ static int avs_create_dapm_widgets(struct device *dev, int ssp_port, dw[0].id = snd_soc_dapm_hp; dw[0].reg = SND_SOC_NOPM; - dw[0].name = devm_kasprintf(dev, GFP_KERNEL, "ssp%dpb", ssp_port); + dw[0].name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("ssp", "pb", ssp_port, tdm_slot)); if (!dw[0].name) return -ENOMEM; dw[1].id = snd_soc_dapm_mic; dw[1].reg = SND_SOC_NOPM; - dw[1].name = devm_kasprintf(dev, GFP_KERNEL, "ssp%dcp", ssp_port); + dw[1].name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("ssp", "cp", ssp_port, tdm_slot)); if (!dw[1].name) return -ENOMEM; @@ -115,33 +124,45 @@ static int avs_i2s_test_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; const char *pname; int num_routes, num_widgets; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); + + if (!avs_mach_singular_ssp(mach)) { + dev_err(dev, "Invalid SSP configuration\n"); + return -EINVAL; + } + ssp_port = avs_mach_ssp_port(mach); + + if (!avs_mach_singular_tdm(mach, ssp_port)) { + dev_err(dev, "Invalid TDM configuration\n"); + return -EINVAL; + } + tdm_slot = avs_mach_ssp_tdm(mach, ssp_port); card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!card) return -ENOMEM; - card->name = devm_kasprintf(dev, GFP_KERNEL, "ssp%d-loopback", ssp_port); + card->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("ssp", "-loopback", ssp_port, tdm_slot)); if (!card->name) return -ENOMEM; - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d\n", ret); return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); + ret = avs_create_dapm_routes(dev, ssp_port, tdm_slot, &routes, &num_routes); if (ret) { dev_err(dev, "Failed to create dapm routes: %d\n", ret); return ret; } - ret = avs_create_dapm_widgets(dev, ssp_port, &widgets, &num_widgets); + ret = avs_create_dapm_widgets(dev, ssp_port, tdm_slot, &widgets, &num_widgets); if (ret) { dev_err(dev, "Failed to create dapm widgets: %d\n", ret); return ret; From patchwork Thu Oct 12 08:35:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 732500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6EF03CDB47E for ; Thu, 12 Oct 2023 08:41:27 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7906E86E; Thu, 12 Oct 2023 10:40:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7906E86E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100085; bh=PF5/FBySlE/Bouy98zQC3wbq2qjem9RStcX+Dveb4Os=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=V3PA1VP9Z+JRA4cgiX4VRDJMGFwZsNXx5UKfVj7MAjMKi9R3xEZe3sEpUGRY523tG 9/HBWTLUfMwCE0uT0Mg0OeQtPcm2jqS6SRjrPSgPOIjTARTeWHol/L4i8v/QlJsx7Z 4us6yTWeJGaZGSepzCNnmMciIAe6QbG+0LSxdrU0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 02E77F805B4; Thu, 12 Oct 2023 10:38:55 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3347EF805B2; Thu, 12 Oct 2023 10:38:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4E40AF80553; Thu, 12 Oct 2023 10:35:51 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BAED7F80310 for ; Thu, 12 Oct 2023 10:35:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BAED7F80310 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Bb5sD/P4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099719; x=1728635719; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PF5/FBySlE/Bouy98zQC3wbq2qjem9RStcX+Dveb4Os=; b=Bb5sD/P4nhmerpeGyaCR6KKYps0t4apQm7Kiif57XiEs54+VjB1wxRed vdTN6LfhR4fZ03hsML12SpaB3MhDTrkDjqyYAmuaT7pgVAEFnFdCD0vKx Cvq7dpxQYE4VnWWuvj3/aZmBAupZYkiPfqjJyoqxXvgRzBoLv7mLX7eUE xn/VDL8LpnxMc4N54AS1SdVq8H2M0WiFvDnDX46A5oRwEFzpbCWLG2W61 dZ8MAuamQxhqAaXppvWS8N8XNrRzpf3T25nOnyE7ioEMCaQIjBfKQHP1r tu9D88DwYrmnQoK5Ssiax86wNuMRVE6qhORptM8k+T05E014stIYXUO4k g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417255" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417255" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516609" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516609" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:15 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 05/16] ASoC: Intel: avs: rt274: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:03 +0200 Message-Id: <20231012083514.492626-6-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: TQKLCJOIIWWGFFGI4UY7IP5353QWXOID X-Message-ID-Hash: TQKLCJOIIWWGFFGI4UY7IP5353QWXOID X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/rt274.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt274.c b/sound/soc/intel/avs/boards/rt274.c index b376d4c2d706..157183b1de24 100644 --- a/sound/soc/intel/avs/boards/rt274.c +++ b/sound/soc/intel/avs/boards/rt274.c @@ -13,6 +13,7 @@ #include #include #include "../../../codecs/rt274.h" +#include "../utils.h" #define AVS_RT274_FREQ_OUT 24000000 #define AVS_RT274_BE_FIXUP_RATE 48000 @@ -145,7 +146,7 @@ static int avs_rt274_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pc } static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -157,13 +158,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT34C2:00"); dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT274_CODEC_DAI); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) @@ -211,13 +214,16 @@ static int avs_rt274_probe(struct platform_device *pdev) struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 732495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7897CCDB46E for ; Thu, 12 Oct 2023 08:44:04 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 96A00E84; Thu, 12 Oct 2023 10:43:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 96A00E84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100242; bh=ABhfhXaTshg1nrN8Qq/s0E784tRgHAmyMuAgdWrlgDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ediL57MjDEewzugzte48a/ThzgkVIwwbzv7uTr9qHfKicUjPEd/TNollXll3yVyq8 tTwX7c/K2x3E9ZEvR988Ca/IJ3x+RV1S2cyEd275xC7smZvZ48erAOXDgqYk6ztm4W WoBYNLcjyChuEJa/WdDc0azeSRfviXKKsVht54wU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id BF362F80620; Thu, 12 Oct 2023 10:39:13 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 7C100F8061B; Thu, 12 Oct 2023 10:39:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D09EDF805F7; Thu, 12 Oct 2023 10:39:06 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 98372F80552 for ; Thu, 12 Oct 2023 10:35:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 98372F80552 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=QKMOg4mU DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099721; x=1728635721; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ABhfhXaTshg1nrN8Qq/s0E784tRgHAmyMuAgdWrlgDU=; b=QKMOg4mUk9aDKr5TyIjOHGUcu5YHIGIGGiH0Jl0eHXhurUgXfev6hLeq AcoX1RCdrYNNaF1tRKQDe7kDjy+++kzRqNKIubHPnXKeIbA4pDCHMK3RD dtqUDbcb930mKJkHqL/yS5eua+YSDwbqnqXk/q3lRBpojEQnMsWpq7m+a zXOQdGAi1ad0nzXpLQ/F0/6uxukXypguw00fOvO5hG0gldawZgTJO8gmH TG5mPI1P7+8IhIutDygBU/nOwT9MnXgqnGEeoSWX5jy3QECU5e/REbzWp fg62MqyGUXg2hYtc4GK46631Ey8KSfFiQfSOJ4eHoNfG0D+faa4lOPmYX w==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417264" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417264" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516616" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516616" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:17 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 06/16] ASoC: Intel: avs: rt5682: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:04 +0200 Message-Id: <20231012083514.492626-7-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 4EDFPDIA4YZNCGOCDECBFD7GJMRCDBPY X-Message-ID-Hash: 4EDFPDIA4YZNCGOCDECBFD7GJMRCDBPY X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/rt5682.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt5682.c b/sound/soc/intel/avs/boards/rt5682.c index f1c46c6abd9d..84e850c0b085 100644 --- a/sound/soc/intel/avs/boards/rt5682.c +++ b/sound/soc/intel/avs/boards/rt5682.c @@ -21,6 +21,7 @@ #include #include "../../common/soc-intel-quirks.h" #include "../../../codecs/rt5682.h" +#include "../utils.h" #define AVS_RT5682_SSP_CODEC(quirk) ((quirk) & GENMASK(2, 0)) #define AVS_RT5682_SSP_CODEC_MASK (GENMASK(2, 0)) @@ -203,7 +204,7 @@ avs_rt5682_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pcm_hw_param } static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -215,13 +216,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-10EC5682:00"); dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, AVS_RT5682_CODEC_DAI_NAME); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) @@ -270,7 +273,7 @@ static int avs_rt5682_probe(struct platform_device *pdev) struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; if (pdev->id_entry && pdev->id_entry->driver_data) avs_rt5682_quirk = (unsigned long)pdev->id_entry->driver_data; @@ -280,9 +283,12 @@ static int avs_rt5682_probe(struct platform_device *pdev) mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 733742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B8F9CDB46E for ; Thu, 12 Oct 2023 08:43:50 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 452BCDEC; Thu, 12 Oct 2023 10:42:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 452BCDEC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100228; bh=jF8Q5o21rbLAPRVAXVy7qRfq2VWeUicpckjRdoEWNnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=QvadpOJsClUmM+pUrVoNR681yhli+gbxVN71u55CitNAHuQ8JPFyCH9CAvnZKlJdS TuClsA8/WBAYHuX39LWBgIGSqKPaXcqCEiGlK8H2fo2455rEh/LizewvCNOUkfISAR ScgBqbxEFIu1FFcoPhQVB7MMgwhYVIJTHf3k3/og= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 679BAF80615; Thu, 12 Oct 2023 10:39:12 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E71E2F80608; Thu, 12 Oct 2023 10:39:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 31D20F805E4; Thu, 12 Oct 2023 10:39:03 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CA1D7F8027B for ; Thu, 12 Oct 2023 10:35:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CA1D7F8027B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=FIsqO9gR DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099723; x=1728635723; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jF8Q5o21rbLAPRVAXVy7qRfq2VWeUicpckjRdoEWNnc=; b=FIsqO9gRSNt0vcFfrJ09Ir9B/HSzJm0lf7q6xDjnZZ8oElVbVcq+Cdp9 dpwZfDhdUyQ63bnifsLF7eGzkByCsJzZViyOP5sAU50/46PFbBTyvak2z hKhF/y/cpNqEpKK8XwBAjQn3GaD7TEfN9ArfhicMhPADyvlYnA0bmSivp vtiMe4rDJTHoMfjW+nQCKty1IeQ1fG0uZOFB+cIOZOTkqmVDv6tfls7lh XitwrBuwl29j9u3Fxx+ULtbVNCJXCeeZaKg1Uy1mRiy7choXQ05Qo0wrH S7FVHrzA6jcCQ3Fk6I21kNcNP/X6ZKWoimNoPt7tjopGKvNuD2tn3dzNv g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417269" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417269" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516626" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516626" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:19 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 07/16] ASoC: Intel: avs: max98357a: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:05 +0200 Message-Id: <20231012083514.492626-8-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: CU2DIXEGIIJIE5BRGBU7MEKZOU5S5E53 X-Message-ID-Hash: CU2DIXEGIIJIE5BRGBU7MEKZOU5S5E53 X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/max98357a.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/max98357a.c b/sound/soc/intel/avs/boards/max98357a.c index b9b20562c691..6ba7b6564279 100644 --- a/sound/soc/intel/avs/boards/max98357a.c +++ b/sound/soc/intel/avs/boards/max98357a.c @@ -12,6 +12,7 @@ #include #include #include +#include "../utils.h" static const struct snd_kcontrol_new card_controls[] = { SOC_DAPM_PIN_SWITCH("Spk"), @@ -46,7 +47,7 @@ avs_max98357a_be_fixup(struct snd_soc_pcm_runtime *runrime, struct snd_pcm_hw_pa } static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -58,13 +59,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "MX98357A:00"); dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, "HiFi"); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) @@ -93,13 +96,16 @@ static int avs_max98357a_probe(struct platform_device *pdev) struct snd_soc_card *card; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 732496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3E14CDB46E for ; Thu, 12 Oct 2023 08:43:37 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 65D99E8D; Thu, 12 Oct 2023 10:42:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 65D99E8D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100215; bh=NPf/FUnbcb4IowHiOyNFziOwlQiOQTJBaYtVDunGrPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=HcbWSrK6b9Km5JDNF6YE7TuTFOCwWgHWHTs2qDBB94AktKZa5cE3yg74fBO/oUDwO LOxi+C2lrvSnCAneHQ/3U1Cu9ipJ89QPpZSxvEkTk97j8CSEfMw+Q5IfnHV+wLz6/V TqKTWbnYdRsb8ejzPJLxpWZetJ792IhLfRZRg5ls= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C5F7CF80607; Thu, 12 Oct 2023 10:39:10 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 596C0F80607; Thu, 12 Oct 2023 10:39:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1055AF80557; Thu, 12 Oct 2023 10:39:02 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5AAEAF80557 for ; Thu, 12 Oct 2023 10:35:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5AAEAF80557 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=hP9NveBg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099725; x=1728635725; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NPf/FUnbcb4IowHiOyNFziOwlQiOQTJBaYtVDunGrPE=; b=hP9NveBg/hV48o5OHUGeMcZx5Zi0aP3qoL3jwmyTY2fcD6FMxE3IxrXX OVXgfC4aa53YhIOlgMmMdrSb+EydH4F2XzGXxBJaw5qAn1kZdp4FmuzYK RK8QB/BEXs0bNkSafFmrbuPiT7e7rEP5DBwz+RYX3D1cLez4rGTHJLdb7 nYJAT7EACG2dpRZiuVUDPfxR4Jer2W/ZVUaVTikBYt4Zy+2X5j0fMaD5c feVMAXIhnyeq3/jXvgdrMutW92ipzVGKCMhODxXr//YHQ04GLxez97Vor TPRFzLl5WnEGj/Kysv4v17Rk56w7joR12qihaUW3PVl0gpRQMewhkBuoE A==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417274" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417274" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516634" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516634" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:21 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 08/16] ASoC: Intel: avs: rt298: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:06 +0200 Message-Id: <20231012083514.492626-9-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 2OMP5BHWFHSSUT6JR3IEGDYUWSWAOKJD X-Message-ID-Hash: 2OMP5BHWFHSSUT6JR3IEGDYUWSWAOKJD X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: <> List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/rt298.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt298.c b/sound/soc/intel/avs/boards/rt298.c index 3cd8057f0ed6..ea32a7690c8a 100644 --- a/sound/soc/intel/avs/boards/rt298.c +++ b/sound/soc/intel/avs/boards/rt298.c @@ -14,6 +14,7 @@ #include #include #include "../../../codecs/rt298.h" +#include "../utils.h" #define RT298_CODEC_DAI "rt298-aif1" @@ -131,7 +132,7 @@ static const struct snd_soc_ops avs_rt298_ops = { }; static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -143,13 +144,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT343A:00"); dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT298_CODEC_DAI); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) @@ -201,13 +204,16 @@ static int avs_rt298_probe(struct platform_device *pdev) struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 733747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2CFEBC41513 for ; Thu, 12 Oct 2023 08:41:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7DDA2857; Thu, 12 Oct 2023 10:40:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7DDA2857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100081; bh=wwT/fAiNOA0WZ3na3RZiExnI/inb4Q3VxLX+7U6E+wE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=dd3EhUh1BeArkSmfi21UZe6GUrLdpwZzBaH09XPMAgDbWdR9Xc6nB/Vyjlc4mbu/h 54FwV2LjKwjikTHd0WGDyuEqY3VK1lqShgiSv+PKOIb6Cc2tqfB9cw3LTveYaA2kJz B9K3XVBmdCexWpCl2GFqKJwB9z+pUvnEEJSRfo/k= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4D97EF805B1; Thu, 12 Oct 2023 10:38:54 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 73F79F805AC; Thu, 12 Oct 2023 10:38:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DED4DF80567; Thu, 12 Oct 2023 10:35:48 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 48BC3F80553 for ; Thu, 12 Oct 2023 10:35:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 48BC3F80553 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=TJ/Di7DT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099727; x=1728635727; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wwT/fAiNOA0WZ3na3RZiExnI/inb4Q3VxLX+7U6E+wE=; b=TJ/Di7DTmCJKBhZarI3yX22JHAFaREF2mDPi66BErUPkZ01QBkzHyNEd BWsODTMPWIlDTqsGZU61TY1q5WBm8t3XoQARtrePjoUN49kVmwsEwvKvH Fdg8ZMtud3K8zFqrd5EfTK/WfczXZOCBBP/8Qc2wludt/xumbeJ/JO2tp eerTkRmY8d9GruQU8r4SWqHpCALWbyRu6RpcYPYfwPj4PgCCami0Xvi/x flP9XgKF2kicx1KpML4zIXKZsF9yQjtJnxhNPSrKFh/KgSY53CF1liqxP Ql5jjTvCFIeNMbPnf1gS0bzrkC92TUIiOcj7yzdySbHOfpM8EVsFAk39t A==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417279" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417279" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516644" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516644" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:23 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 09/16] ASoC: Intel: avs: da7219: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:07 +0200 Message-Id: <20231012083514.492626-10-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: OO6BH7RH5ZTO7ZHFHKW5CLY6VYBZAKEQ X-Message-ID-Hash: OO6BH7RH5ZTO7ZHFHKW5CLY6VYBZAKEQ X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/da7219.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sound/soc/intel/avs/boards/da7219.c b/sound/soc/intel/avs/boards/da7219.c index 2059d6156738..6060894954df 100644 --- a/sound/soc/intel/avs/boards/da7219.c +++ b/sound/soc/intel/avs/boards/da7219.c @@ -16,6 +16,7 @@ #include #include #include "../../../codecs/da7219.h" +#include "../utils.h" #define DA7219_DAI_NAME "da7219-hifi" @@ -164,7 +165,7 @@ avs_da7219_be_fixup(struct snd_soc_pcm_runtime *runrime, struct snd_pcm_hw_param } static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -177,12 +178,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-DLGS7219:00"); dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, DA7219_DAI_NAME); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) @@ -230,13 +234,16 @@ static int avs_da7219_probe(struct platform_device *pdev) struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 732499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45ED6C41513 for ; Thu, 12 Oct 2023 08:41:58 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 80575DED; Thu, 12 Oct 2023 10:41:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 80575DED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100116; bh=I4lmN1gig4vyawfJ5Qjfb5ATCZk4ADN3yc84/zAiIsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jQdYLm/Ic+HxYehE01g/ocj4tUqXViKfh52QEjXGnMRzvSCgXtrO1pISV9F6HwlaU i5AL80JJJcsZZdRPAuQtX4r9MSFou+7800cPhj1leOW2H/HHWQu59NRdtgS9X+y16Z 31GHc0pGMMNRbSVw3Y8awnNkkOGuGkyow2KXz7R0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 99761F805DF; Thu, 12 Oct 2023 10:39:00 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id CB0B8F805D2; Thu, 12 Oct 2023 10:38:59 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 996F9F80310; Thu, 12 Oct 2023 10:35:56 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 560E5F80558 for ; Thu, 12 Oct 2023 10:35:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 560E5F80558 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=nS3s0AfP DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099729; x=1728635729; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I4lmN1gig4vyawfJ5Qjfb5ATCZk4ADN3yc84/zAiIsg=; b=nS3s0AfPhEvZY20OIvMCDIm+GQbVB/E6Kf7gZsZcXt7RLAfFWRB5MBz2 QjzEIpDgcNds04bko14blKannUaNHMm4ia8QTuW2fyz6zC2rS/dL/jduM xCC9z7fAtg3pga46srcphYjmBjoJrFp0rcE396brWGwP9XeHDqihhipct kOX1tO7C8bzKSLKsJ6XaO4hNo7oJ5DnG+sUiFR/jQm8roKA7UsUXi4vnf gcY8b6fU2MEw92lMV41wTTn8LZDaiYKqTgmXfpJSch1+Ug8bZHMX2aQGg WArBMc9B3xjrU5Kiv/UbVvbcPkmQn2EDXDrBc9j7E9FQ33FgIb2ytPOXh A==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417284" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417284" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516650" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516650" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:24 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 10/16] ASoC: Intel: avs: es8336: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:08 +0200 Message-Id: <20231012083514.492626-11-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: CVYCD77E45GBI5UXL7ZN6TFCTL5LIZJX X-Message-ID-Hash: CVYCD77E45GBI5UXL7ZN6TFCTL5LIZJX X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/es8336.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/es8336.c b/sound/soc/intel/avs/boards/es8336.c index 6d2a7c8e445e..f972ef64d284 100644 --- a/sound/soc/intel/avs/boards/es8336.c +++ b/sound/soc/intel/avs/boards/es8336.c @@ -19,6 +19,7 @@ #include #include #include +#include "../utils.h" #define ES8336_CODEC_DAI "ES8316 HiFi" @@ -194,7 +195,7 @@ static int avs_es8336_be_fixup(struct snd_soc_pcm_runtime *runtime, return 0; } static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -206,13 +207,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-ESSX8336:00"); dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, ES8336_CODEC_DAI); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) @@ -261,13 +264,16 @@ static int avs_es8336_probe(struct platform_device *pdev) struct snd_soc_card *card; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 733746 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C80A6CDB46E for ; Thu, 12 Oct 2023 08:41:48 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A99EDDF6; Thu, 12 Oct 2023 10:40:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A99EDDF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100106; bh=ZQgX6iicw6/vP4KZ/GfZdtUJGE8GuCRP8RmV9RYsaSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=HpTXD1t/rK58iCTTJs96XtE9l7o/Y3og4kaPqyTqiyq3DjeZe41z8byMG+uNVI1Oc 0RdeqUwZ1TqdbjU2l7LvmPUuUp50HeXkiSDCSLtQGGjkEPW09TMdNjWFAdCLrQgpAF rD03WI6FdHkCuHugtD/2T7Tn3/2JQd2ccXzZ5r0o= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A612CF805C3; Thu, 12 Oct 2023 10:38:58 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id DE071F805B2; Thu, 12 Oct 2023 10:38:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EE097F80536; Thu, 12 Oct 2023 10:35:52 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0D038F8019B for ; Thu, 12 Oct 2023 10:35:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0D038F8019B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=M/vuSkTE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099730; x=1728635730; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZQgX6iicw6/vP4KZ/GfZdtUJGE8GuCRP8RmV9RYsaSU=; b=M/vuSkTEMsHMo1LsIr3javfJiGE/t5/Oa8XnXgiN3JSRIRZiDIzuuiWK fpCdbxpuVj5v+jP/XShrwDOu7U3OBgUAny3PWVRBK6+PQzYcqaFF6S39s 2udasKNGOUsidXWBnrXAzDbppaN4m+m4gkj0D39kKiA6Gs56xa6DFs27e q721QFytOuu6WEQ4bunDJvPCjbOOYyflkAR+/xq70WhZnzY52lNkInojb 9EES0mYg/ZqJEhiu8yX/pDMLI4gsVugsxxgTYFFyoXHNCQ8QKXDQ1uWiU cVLcDBdZW9Npuj9cz+eehHS/KOET9t1/CMwPugZNaOUHDtZz3e1xEjUj0 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417290" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417290" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516658" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516658" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:26 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 11/16] ASoC: Intel: avs: max98373: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:09 +0200 Message-Id: <20231012083514.492626-12-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: BNFAT4HEL7Z7RZZMD347DSXKYXYR5MMT X-Message-ID-Hash: BNFAT4HEL7Z7RZZMD347DSXKYXYR5MMT X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/max98373.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/max98373.c b/sound/soc/intel/avs/boards/max98373.c index 7820435e3a53..cc7dfdf72083 100644 --- a/sound/soc/intel/avs/boards/max98373.c +++ b/sound/soc/intel/avs/boards/max98373.c @@ -12,6 +12,7 @@ #include #include #include +#include "../utils.h" #define MAX98373_DEV0_NAME "i2c-MX98373:00" #define MAX98373_DEV1_NAME "i2c-MX98373:01" @@ -95,7 +96,7 @@ static const struct snd_soc_ops avs_max98373_ops = { }; static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -107,13 +108,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs) * 2, GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs[0].name = devm_kasprintf(dev, GFP_KERNEL, MAX98373_DEV0_NAME); dl->codecs[0].dai_name = devm_kasprintf(dev, GFP_KERNEL, MAX98373_CODEC_NAME); dl->codecs[1].name = devm_kasprintf(dev, GFP_KERNEL, MAX98373_DEV1_NAME); @@ -148,13 +151,16 @@ static int avs_max98373_probe(struct platform_device *pdev) struct snd_soc_card *card; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 733744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8633DCDB46E for ; Thu, 12 Oct 2023 08:42:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AE6FA84B; Thu, 12 Oct 2023 10:41:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AE6FA84B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100164; bh=PBa3o2hYZhQuR040QMY3gCbmXRypN0WyoxMdlZZ7UTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=O/QPZs55Ej+bkZ+3LYeoCqUL8co1iV6hAFShWyJ+mF1pRVyjCxH44gXo4qGBellCK msOgfKT1FwUyAqAqiKAelpTQn8L9BUaPjQq8FnZ82WbFHV97cgUFuTJI/pSAe+jkp0 46NygHRvoejHfGo3jeCOu18rTmi+XmTqUsjsr0sQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A62F2F805F5; Thu, 12 Oct 2023 10:39:06 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1DE35F805E9; Thu, 12 Oct 2023 10:39:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E82F6F802E8; Thu, 12 Oct 2023 10:36:00 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E23D7F80130 for ; Thu, 12 Oct 2023 10:35:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E23D7F80130 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=N6y36CPZ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099732; x=1728635732; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PBa3o2hYZhQuR040QMY3gCbmXRypN0WyoxMdlZZ7UTs=; b=N6y36CPZLh4P2nxCI6PkMoB3NGoBWq/aUszu1/GevaLnAUn59P71koEa 0+ZOPeGo85Xj2crxfjQeB0w0g4rgQcCvX6YVBU/dcotCIzuuAdfkf8ZC5 mSa+7fP879XKh7JOfcNwjQY9BOqmZRf68h3rd+atMFL1UtqX3WCdbakCS rbC7a8a/zKoRmQQCQA2dm4tUWqyZ4i4NCKU0sa3jzRRdHcavsHh426TH2 tJWcNJzo/X/lG4+0c9fwY22f7CAbZS/98j/xtZlNdNmu8V+K70h45HLcs NTd8ooRZ+s/xmuZbPIjhjIjnWin8nbxztVJxa/CIZuom10XPaP7MJ3vJx w==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417297" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417297" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516668" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516668" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:28 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 12/16] ASoC: Intel: avs: max98927: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:10 +0200 Message-Id: <20231012083514.492626-13-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: DLQ63VBXT32SDRYAGCDWMZ7ARA6CHSI3 X-Message-ID-Hash: DLQ63VBXT32SDRYAGCDWMZ7ARA6CHSI3 X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/max98927.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/max98927.c b/sound/soc/intel/avs/boards/max98927.c index ae465b231249..fb0175f37d61 100644 --- a/sound/soc/intel/avs/boards/max98927.c +++ b/sound/soc/intel/avs/boards/max98927.c @@ -12,6 +12,7 @@ #include #include #include +#include "../utils.h" #define MAX98927_DEV0_NAME "i2c-MX98927:00" #define MAX98927_DEV1_NAME "i2c-MX98927:01" @@ -92,7 +93,7 @@ static const struct snd_soc_ops avs_max98927_ops = { }; static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -104,13 +105,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs) * 2, GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs[0].name = devm_kasprintf(dev, GFP_KERNEL, MAX98927_DEV0_NAME); dl->codecs[0].dai_name = devm_kasprintf(dev, GFP_KERNEL, MAX98927_CODEC_NAME); dl->codecs[1].name = devm_kasprintf(dev, GFP_KERNEL, MAX98927_DEV1_NAME); @@ -145,13 +148,16 @@ static int avs_max98927_probe(struct platform_device *pdev) struct snd_soc_card *card; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 733745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E1C24CDB47E for ; Thu, 12 Oct 2023 08:42:12 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0375B83E; Thu, 12 Oct 2023 10:41:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0375B83E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100131; bh=v6nDrkZ+EXflQCSPe0kYi6yyTtNJy26WQz9iZQZla7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Or7MkOAC2ljM1Fuk5kN5jesJGoVPTZ0EV/EA7pLXaQmFxjO9di53l2x5CWJGI837C Bd3nZKO8GkJIhfAmoq7wRiTtcPLeNY3fZR7JjkeVvyMBPQE5slH4UaDFIQMLqnnOoM ohkQjVYT3UbfOgpfk3sd1Jjlz54A1uzw/uzzOe4Q= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B7474F805DA; Thu, 12 Oct 2023 10:39:02 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C0373F805B2; Thu, 12 Oct 2023 10:39:01 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 10C67F80310; Thu, 12 Oct 2023 10:35:57 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DCC55F8055B for ; Thu, 12 Oct 2023 10:35:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DCC55F8055B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=LfMe1wTE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099734; x=1728635734; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v6nDrkZ+EXflQCSPe0kYi6yyTtNJy26WQz9iZQZla7A=; b=LfMe1wTEuw51L3ythma0oy2Pa3jlyYdni0lGYCOg1oCRqJlPkIExWCv7 OEpuSzbsMVTPu6cJMHWeSstUkvwWOKNd3SoNl+HMJ+P+NbcNs3L28Ex3b WUh4RGqnVO3vkRKNwyU+qxfIIctUrabk483zPY1UYEOoflhDhwGCe0QDF bfH14Acy01obi+5aL0dWhfRjN3F7ZLR0LUsra6AFr0jI2JxeJK46iWnBP deSQ4KA7XBlZ28ZrO74AD6z3fgxvRCLImu5luricrQM69Yg/daJ+uf3qg ZV5DXLRct73CmtIITf7a0ym2GZ91s8pnGNPQaKpk10hVB+Fj5KDHTfasF g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417305" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417305" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516687" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516687" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:30 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 13/16] ASoC: Intel: avs: nau8825: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:11 +0200 Message-Id: <20231012083514.492626-14-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: ZVA7G3KGAELKL37XSALXIJ5KVUYLKEGJ X-Message-ID-Hash: ZVA7G3KGAELKL37XSALXIJ5KVUYLKEGJ X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/nau8825.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/nau8825.c b/sound/soc/intel/avs/boards/nau8825.c index 9f15b22a3c3f..d98b5deb78c9 100644 --- a/sound/soc/intel/avs/boards/nau8825.c +++ b/sound/soc/intel/avs/boards/nau8825.c @@ -16,6 +16,7 @@ #include #include #include "../../../codecs/nau8825.h" +#include "../utils.h" #define SKL_NUVOTON_CODEC_DAI "nau8825-hifi" @@ -171,7 +172,7 @@ static const struct snd_soc_ops avs_nau8825_ops = { }; static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -183,13 +184,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-10508825:00"); dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, SKL_NUVOTON_CODEC_DAI); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) @@ -248,13 +251,16 @@ static int avs_nau8825_probe(struct platform_device *pdev) struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 732498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D320FCDB46E for ; Thu, 12 Oct 2023 08:42:37 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E85A5DF1; Thu, 12 Oct 2023 10:41:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E85A5DF1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100156; bh=ioZlDWWtIzA/5hYmefOSau4IgR6BMSLGaoIAnrSPjEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=eVorejn7HS9par2kIc0wHtwQHfzbqrmoQ+OIX7e3GHXqTLQAEpk9tXLbo0AdGelAp siZeOLU1pbxxsxJYZ56lI+APoh+DGSmnN4Iag26iv+v2otFJRQPmJAP6N/2/rXaF1U zQOYtk+J+SwGP4Ekxt/+M+z9tNqfdfu43ESb//nI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 57F38F805EB; Thu, 12 Oct 2023 10:39:05 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 51E15F8027B; Thu, 12 Oct 2023 10:39:04 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D75F3F80310; Thu, 12 Oct 2023 10:35:59 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A844CF802BE for ; Thu, 12 Oct 2023 10:35:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A844CF802BE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=KXqYX0nm DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099736; x=1728635736; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ioZlDWWtIzA/5hYmefOSau4IgR6BMSLGaoIAnrSPjEw=; b=KXqYX0nmjYD8b6Xd3GD51KhbsnChKYTpF9T2JLpVLdyyIJAMg6AZD11w 5m5hdWBqu0Pwk2/Ob+MXD+CTL/7P4dCopCgjS9+drUDd6/HR/KQHXJOKb qg90ImaqlU0ViJl0Pr1R8qr+7A8Od1nvLsljhM+5eKV9y/2a8DiDMJCQQ aSLklyCGjAue11PPPWA59z1zcbztM7fhZiHJBypzNr/x9EBzelaYc1ify +goWWC/m70fr8f1GYGiKfehhMqt4XgkkZxEVYlDDzc4f9KuIofiXz6NC0 +JAajbWM64B7w5dtfFalOiF9KNr7sNq7BPPuuUEpbbbRSkgrdU04c2gE7 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417312" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417312" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516696" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516696" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:32 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 14/16] ASoC: Intel: avs: rt286: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:12 +0200 Message-Id: <20231012083514.492626-15-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: QNIVOVPCQAHDPGV7L6G4FZX5VC6UZOL4 X-Message-ID-Hash: QNIVOVPCQAHDPGV7L6G4FZX5VC6UZOL4 X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/rt286.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt286.c b/sound/soc/intel/avs/boards/rt286.c index 36da0578d5b4..131237471e3e 100644 --- a/sound/soc/intel/avs/boards/rt286.c +++ b/sound/soc/intel/avs/boards/rt286.c @@ -13,6 +13,7 @@ #include #include #include "../../../codecs/rt286.h" +#include "../utils.h" #define RT286_CODEC_DAI "rt286-aif1" @@ -114,7 +115,7 @@ static const struct snd_soc_ops avs_rt286_ops = { }; static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -126,13 +127,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT343A:00"); dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT286_CODEC_DAI); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) @@ -181,13 +184,17 @@ static int avs_rt286_probe(struct platform_device *pdev) struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); + if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 732497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93EB5CDB482 for ; Thu, 12 Oct 2023 08:43:05 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 12719E87; Thu, 12 Oct 2023 10:42:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 12719E87 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100183; bh=b18PgqezDaaE8D/RmQSc5htXgKfAmXNwcnG5pPJ4Hrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=NcNSmtjWzJwNTdva+ol3aC7wf6bY3KPln25nOhEWlIEZppuOdS3OzaIt2Mfyjlng1 yEXy0/5xQA1QO/iVnLqEiotpIwe4RnnahjRFSdPtuAnwXkIwdj5UrJ9pBPEOoRjfxX lpe9OLmgDG0DuC27yva3fqFOf02UNpIulU4IUkGc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7131BF805E9; Thu, 12 Oct 2023 10:39:08 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 9391BF805E9; Thu, 12 Oct 2023 10:39:07 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B82D0F802BE; Thu, 12 Oct 2023 10:36:01 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E49DAF80571 for ; Thu, 12 Oct 2023 10:35:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E49DAF80571 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=N4OtbgOj DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099738; x=1728635738; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b18PgqezDaaE8D/RmQSc5htXgKfAmXNwcnG5pPJ4Hrg=; b=N4OtbgOjAkv33HRzMcEiqgGFeUKqocI2aKfq8bEnm467phB5YSyaqMXV fFeM3XYypytxR4BvyiPslLQwX6wcDWJ5fFAIqMi/xq2gy0ff5Ryo8DUvM s8xpvf/Ts6esRHHXYfnLCNHSLgzVPwv1HQFRxxEFUMKQLHZYqX8Nar2oh RNIJF1+u+G4sr/6G8Bb5/gOBP1ZaGloN7ZVetN1Gm98IW3xZ3CriD8aif cC7y82n3O4cDvHME5KCb458uoInSUga7rzfrutDKdbcpAxU9qCKkUiDhS u3POWD/+mf03UECuqw+3CsKbqpwlKmAfk4W1+i4SBMdb7IzITRiYyMuUz g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417321" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417321" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516709" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516709" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:34 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 15/16] ASoC: Intel: avs: rt5663: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:13 +0200 Message-Id: <20231012083514.492626-16-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: EOKP26JICZ6FD4AEB6TM5ZH6MKNABFGI X-Message-ID-Hash: EOKP26JICZ6FD4AEB6TM5ZH6MKNABFGI X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/rt5663.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt5663.c b/sound/soc/intel/avs/boards/rt5663.c index 2e84bd629766..3effd789a45e 100644 --- a/sound/soc/intel/avs/boards/rt5663.c +++ b/sound/soc/intel/avs/boards/rt5663.c @@ -15,6 +15,7 @@ #include #include #include "../../../codecs/rt5663.h" +#include "../utils.h" #define RT5663_CODEC_DAI "rt5663-aif" @@ -133,7 +134,7 @@ static const struct snd_soc_ops avs_rt5663_ops = { static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -145,13 +146,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-10EC5663:00"); dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT5663_CODEC_DAI); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) @@ -200,13 +203,16 @@ static int avs_rt5663_probe(struct platform_device *pdev) struct rt5663_private *priv; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret; From patchwork Thu Oct 12 08:35:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 733743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23144CDB46E for ; Thu, 12 Oct 2023 08:43:19 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 56F08E0E; Thu, 12 Oct 2023 10:42:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 56F08E0E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697100197; bh=LTitOrMvMgzbdcon2GhG+WpR7FKeXOOd7HD6xMEORLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=CLXK9cWljZnzZmod09uoovBShU9ulyXlb7/ZiGL5yeP43xXOUjbW970B1EGFntG1H afeikrKDzlL8Q0otM5/6PbWxwraaB/TH7yfp6ZZD9rqSec8mHytn/mTuiXQ7fyfdos uQNf7yBP4kQ+ThlZNmxb6akp4RLwqXZtytyjGEuA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7CB05F80605; Thu, 12 Oct 2023 10:39:09 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E3B67F80600; Thu, 12 Oct 2023 10:39:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4BA6FF802BE; Thu, 12 Oct 2023 10:36:03 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C8A08F8057A for ; Thu, 12 Oct 2023 10:35:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C8A08F8057A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=E2C2vxqo DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697099740; x=1728635740; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LTitOrMvMgzbdcon2GhG+WpR7FKeXOOd7HD6xMEORLM=; b=E2C2vxqojG7BYYilU+mIZ4rTczDr0GxgRCdoZkTTuaTFigG/cEcmczgn iC+HvvhewEIPXK0alG5FpuxZ2yjlJ52HsaXY3z8gSr41qaQcrXFSY43DW 2/WAP2L+xPumi5vKK5aMugFORDCZgfUWzO5z0t+pHqoD9R846wUODF4H3 B30o4+wo/zM7gibNTW7c4JwKiAO4SI6ZO2DPRFlqPbxAM0WzgCmD74vQ0 0S3kp/C4mPPFaBkPFQQ8RAgWut9yE9JNA4238sLEJl7/lAimpMs9lQ4TT HRLB+0lbs31JFKj8q5/2eaZeauunNOJUsmlzG3vM8Sl+0Bsl7SoPtJtRa g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6417328" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="6417328" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 01:35:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="824516717" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="824516717" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga004.fm.intel.com with ESMTP; 12 Oct 2023 01:35:36 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH v2 16/16] ASoC: Intel: avs: ssm4567: Validate machine board configuration Date: Thu, 12 Oct 2023 10:35:14 +0200 Message-Id: <20231012083514.492626-17-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> References: <20231012083514.492626-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: OW36SHCDT24FKIEDR6WOIPQNAKXFLJ7O X-Message-ID-Hash: OW36SHCDT24FKIEDR6WOIPQNAKXFLJ7O X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/boards/ssm4567.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/avs/boards/ssm4567.c b/sound/soc/intel/avs/boards/ssm4567.c index 27eca051122d..6bcab9deae5c 100644 --- a/sound/soc/intel/avs/boards/ssm4567.c +++ b/sound/soc/intel/avs/boards/ssm4567.c @@ -14,6 +14,7 @@ #include #include #include "../../../codecs/nau8825.h" +#include "../utils.h" #define SKL_SSM_CODEC_DAI "ssm4567-hifi" @@ -83,7 +84,7 @@ avs_ssm4567_be_fixup(struct snd_soc_pcm_runtime *runrime, struct snd_pcm_hw_para } static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, - struct snd_soc_dai_link **dai_link) + int tdm_slot, struct snd_soc_dai_link **dai_link) { struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; @@ -95,13 +96,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in platform->name = platform_name; - dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); + dl->name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs) * 2, GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; - dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); + dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot)); dl->codecs[0].name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT343B:00"); dl->codecs[0].dai_name = devm_kasprintf(dev, GFP_KERNEL, "ssm4567-hifi"); dl->codecs[1].name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT343B:01"); @@ -136,13 +139,16 @@ static int avs_ssm4567_probe(struct platform_device *pdev) struct snd_soc_card *card; struct device *dev = &pdev->dev; const char *pname; - int ssp_port, ret; + int ssp_port, tdm_slot, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; - ssp_port = __ffs(mach->mach_params.i2s_link_mask); - ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link); + ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot); + if (ret) + return ret; + + ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link); if (ret) { dev_err(dev, "Failed to create dai link: %d", ret); return ret;