From patchwork Wed Oct 11 12:16:48 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: 732514 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 26329CD6E5D for ; Wed, 11 Oct 2023 12:19: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 EA87E15CA; Wed, 11 Oct 2023 14:18:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EA87E15CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026745; bh=pSM2bHawGazkr86J1ByDoPl8fCxvna3URNjEwCyngA4=; 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=gn1lnVTAL8mzahYNvSNdlKH0xLqtSkRfzhAqkMWPLyL24EhbsJ+EdgG6z7zDMqoG7 lLdrq9dhmWs3vBgOlg9EXx7u5d9+lR7PObjz8Eg1WcTfiARbYug1/LMGtIdv4vH4L5 QvVdeZnIIRCKz/n/A0uNHHjvi0ReCCws+WI1wljg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 930D6F80568; Wed, 11 Oct 2023 14:17:32 +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 D7360F8055C; Wed, 11 Oct 2023 14:17:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0CD07F80557; Wed, 11 Oct 2023 14:17:20 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 AD0D6F8027B for ; Wed, 11 Oct 2023 14:17:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AD0D6F8027B 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=QxQvZLlT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026630; x=1728562630; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pSM2bHawGazkr86J1ByDoPl8fCxvna3URNjEwCyngA4=; b=QxQvZLlTd39eervmvGJpGHFkUy5H31Ws8wQJ0MSZwZYgNNYK7fSWweoT flidkzehHbuguP4f+KuSY9X14dQ0O5SybGSnEhgTZj7OyLNyKrM8UAB0i 2W5GsbLc8W4+TPcdRYn0sj4YnSBYoZz3D7u0REQRXQHMaUPj2HDDEBTzb 19cFeUFm+dodufCq7zzAAVztGbLGKBwo5uOn3voRTuXSLfVEnIUaxXfIa NIBb5+33PUUExtnThOzStXIy52YjbdoO+Lg2wcUXIIL2hrpjJx+UceYMM CAeQuH5hMWp64Gzio0Ep3c+YEKZTvrw8MphIfHYArUioziCeoHnOBIXF3 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988346" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988346" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:16:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428334" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428334" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:16:56 -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 01/16] ASoC: Intel: avs: Only create SSP%d snd_soc_dai_driver when requested Date: Wed, 11 Oct 2023 14:16:48 +0200 Message-Id: <20231011121703.363652-2-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 4XBEDFRUR5AID5SLOIL5Z3OBOX4XJK27 X-Message-ID-Hash: 4XBEDFRUR5AID5SLOIL5Z3OBOX4XJK27 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16:49 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: 732513 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 1B845CD6E5D for ; Wed, 11 Oct 2023 12:19:35 +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 1CE00163F; Wed, 11 Oct 2023 14:18:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1CE00163F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026773; bh=IcR2+alp7ZQ8W1Uf3jAEvOViV8wtUWhbVQLtTTY/Fu8=; 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=g72G7Fd0JCZqV9FqYPx6/9uDAXzQ2b/ahrlEPDoMma1kmJUrsA1FSGmOSC0uldOxi ZHGfLJNQeaCkzamKNlHPL87eXL89IgME9nmyLqj/V76i/9+bwmTEmdc1ZDuOYrUlGr DI3uAuPtoCy3T+zLXi2IFL1GTv9F/GgWrgdH5TqM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4DACEF80589; Wed, 11 Oct 2023 14:17:38 +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 7FF72F80589; Wed, 11 Oct 2023 14:17:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A2D6EF80553; Wed, 11 Oct 2023 14:17:22 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 5CB89F80310 for ; Wed, 11 Oct 2023 14:17:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5CB89F80310 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=j/Ka3sV6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026637; x=1728562637; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IcR2+alp7ZQ8W1Uf3jAEvOViV8wtUWhbVQLtTTY/Fu8=; b=j/Ka3sV64EMtTy9SKTAmBiYy9fMF6KUfQEB0KRWxCx3MIDwRaqkCXIu2 6GcEDibc2kZtxsuYquixo6x9xMQZ9oEHk2o09rSSl4OWnB+JT3ZuObNLQ zjI3iAcn7A82hogvTHqW9e1QHEhLGv3O3qwDWNdfJIQPCb0RNoeIAbXE5 EXrsONlm4yOAcoNNv6X3tM9mQ9e9k2ZvAEGBj0L8INuRwZEgBx/kPBgqQ OrJDy/VjUorzo0oT5HNXl5PrYRPTaREvxnEc9IYCUy7ZfMXZrJPE7yDWZ YexeBzdcvwRVVOGLTvErRXA+iLb6cGw3ytC+nEAmSDOcFsHDrwT6ZzrCD Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988361" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988361" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:16:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428340" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428340" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:16:58 -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 02/16] ASoC: Intel: avs: Introduce helper functions for SSP and TDM handling Date: Wed, 11 Oct 2023 14:16:49 +0200 Message-Id: <20231011121703.363652-3-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: O66GQ5P2QVLIMCMAAXHBQQAW6ZPJNKYQ X-Message-ID-Hash: O66GQ5P2QVLIMCMAAXHBQQAW6ZPJNKYQ 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)); Reviewed-by: Cezary Rojewski 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..6123fab527ec --- /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 + +inline bool avs_mach_singular_ssp(struct snd_soc_acpi_mach *mach) +{ + return hweight_long(mach->mach_params.i2s_link_mask) == 1; +} + +inline u32 avs_mach_ssp_port(struct snd_soc_acpi_mach *mach) +{ + return __ffs(mach->mach_params.i2s_link_mask); +} + +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); +} + +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; +} + +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 Wed Oct 11 12:16:50 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: 731989 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 9E065CD6E5D for ; Wed, 11 Oct 2023 12:19:15 +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 CAD5D1630; Wed, 11 Oct 2023 14:18:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CAD5D1630 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026753; bh=RjzeVBmff2KzOJYRI5jafsFgWIyYG/K0re+96L+lS88=; 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=EELxCWRFviYzfZCzsdgz8UbdI1xzL6Wb6Kcc3MaaOBOQgmx40AyFMEsi9o3ZimdrU lRJBPw4Kn7EBXMbGmXh3o1ByEw8NJRK3LOameGVeJxWokavVoTNvM3XIREH8Gg+UfC h5QZpmNUQMZ22u/C0mGuZ8xg2vdQRQHAmFxVnRK0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7E219F8057B; Wed, 11 Oct 2023 14:17:35 +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 9473FF8057D; Wed, 11 Oct 2023 14:17:34 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 83EEBF80553; Wed, 11 Oct 2023 14:17:20 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 8BB31F80166 for ; Wed, 11 Oct 2023 14:17:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8BB31F80166 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=k4yQ+vi7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026633; x=1728562633; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RjzeVBmff2KzOJYRI5jafsFgWIyYG/K0re+96L+lS88=; b=k4yQ+vi7PGet0AV4BrwNvhyphLb0SVMW2F7TK4D1PGHKbZ4L585aAQ0/ TqAhtXFxVfSekUGrsZYSE6GXAiXUNhkK5+rK0aUz4KLXN8icEBIFciUf5 iERj5rJsodWz9NQeamvCLWELkwvGYGj2FUQgBaPdvo7tzcxCVAC9IilsP piSa61NacMCJUyj++wNB2IfOkL/FghuZtN/SZQGCtnj13JqYOdiwEwf52 S444GI/JtdawTZBK2ZoK2ROEtHpZUr3yFzFLu4Q03oS3VMmTIrDz8SGwn 9hTq8IwCHHdRWSkD4/Ha0dPCGts+Nz1lqgUXbROJ5zvjRP23aOIWeo06m w==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988376" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988376" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428351" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428351" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:00 -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 03/16] ASoC: Intel: avs: Improve topology parsing of dynamic strings Date: Wed, 11 Oct 2023 14:16:50 +0200 Message-Id: <20231011121703.363652-4-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: BK7OMNYU7PGFVMFD5KGHUZKIITNLHJTE X-Message-ID-Hash: BK7OMNYU7PGFVMFD5KGHUZKIITNLHJTE 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16:51 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: 732507 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 9EA46CD6E60 for ; Wed, 11 Oct 2023 12:22:49 +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 D275916D5; Wed, 11 Oct 2023 14:21:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D275916D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026967; bh=Ym72QCp0pYvKGTuUavzqX0XL60x93uJTIpye1XHqgGk=; 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=PSiJvi69y9nbJDrA4bgiZ+X0cd87zR5h2RJ0TSi8MNUrUD7NDEotlb48Im0SJN4d4 m7SrFBk4fODeTw14AJFGw4Bu6TaISFnI4wZ+f/+w5WA39wDDdQdQs3I0POpUt947/v P5LMDGWPsvxUboDrLc4J04i6EPAh+mOWFOO8yG5w= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3E04AF8057B; Wed, 11 Oct 2023 14:20:20 +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 3F074F8055C; Wed, 11 Oct 2023 14:20:20 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8C438F80310; Wed, 11 Oct 2023 14:20:14 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 616D5F802BE for ; Wed, 11 Oct 2023 14:17:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 616D5F802BE 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=M5BT+H7u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026634; x=1728562634; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ym72QCp0pYvKGTuUavzqX0XL60x93uJTIpye1XHqgGk=; b=M5BT+H7u16lxwe3tcWi+y7j4G4+SZMTqeJYN9ANrnMho6f5ksN0qzYRN 1kcCXtZFp0I8CSNqtEJy1O1PEMHQQauPEzb2eXjst93/3mWWI6oi0jkuu pTJ4dsiqjct7B6b7E+1bK9V+gFhoQZkJM6+5jtSW2xP6dnzubXwGRFV9t 8BXQNXNJhdWqUC3jqdtC1kIOX4MdMhM9LhXKcUlti22uakUgg8+TtrIbl gdum4l+a8qGds/AJDdiZxNlU06MIVy9zI6HMoUN4I3rzr7TY8n9E07boM IfqmtcsBU74jGzzh+nmyEMoeG3uhHwELLX3yDzwmVfu7isun7J+XLPoy6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988397" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988397" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428360" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428360" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:02 -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 04/16] ASoC: Intel: avs: i2s_test: Validate machine board configuration Date: Wed, 11 Oct 2023 14:16:51 +0200 Message-Id: <20231011121703.363652-5-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 7JW2PNQTWNRALFVVKYXWDW6TSSJVOQUH X-Message-ID-Hash: 7JW2PNQTWNRALFVVKYXWDW6TSSJVOQUH 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16:52 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: 731983 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 83D56CD6E60 for ; Wed, 11 Oct 2023 12:22: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 E569C16C7; Wed, 11 Oct 2023 14:21:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E569C16C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026946; bh=rig0i5SlHvNLnqyGWw6lYF6YH9YHeCbrKue532/lv/I=; 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=sjK/oG/L4RFKtIXs0NUWOt4NKhWUSLsNPNjOjFNSitCBwuef6Dy090nWx0WCW0ivv XXuJjL18DU+rQb94OwBttWErQ8fphauMTJ1th53e4jO1LzjIBZMFjchdWblViAfPJI cSsuSVhjfzlG8azA799DU5Ns7V1e/iJgdPRlejIo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 06985F80130; Wed, 11 Oct 2023 14:20:18 +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 416E3F802BE; Wed, 11 Oct 2023 14:20:18 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C73C3F80553; Wed, 11 Oct 2023 14:20:13 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 A1756F802E8 for ; Wed, 11 Oct 2023 14:17:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A1756F802E8 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=UfsWXQxZ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026635; x=1728562635; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rig0i5SlHvNLnqyGWw6lYF6YH9YHeCbrKue532/lv/I=; b=UfsWXQxZOpyIjl4NwkUy7S5WcsKkO2mp5aDeL9PK0+UiH50Ze1ER4AxB cRhIkw2lzadDchyIDL/t3twy+lEKVJp98X+blXpz+cQZAExfjGPVvYSUI LmIz5ZZBVJzghp8rGVKehCMNHLt6oHb1TbY3B17jHFCxTLkCVn3Um4J57 +OkuwYnHxgOlLnqm22GGV9DLGucOIQz3bPs2IJe1qFTHU54xXsHQ4v6Xh M3bGDRmFfBzvPIm9mtRF1OngFKvn8dklDZdP8zsmhww0Vdd13OiEsBgo3 yac90kQf68qzo4H+i0RgNjpAlf4zthrWU6+ut4qnWmMC8EJMFyyE4LX5L g==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988415" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988415" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428364" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428364" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:04 -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 05/16] ASoC: Intel: avs: rt274: Validate machine board configuration Date: Wed, 11 Oct 2023 14:16:52 +0200 Message-Id: <20231011121703.363652-6-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: XZIQEEIKJXNTB5F3E27FBAUGZBUBU6LU X-Message-ID-Hash: XZIQEEIKJXNTB5F3E27FBAUGZBUBU6LU 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16:53 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: 731982 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 9AE2CCD6E60 for ; Wed, 11 Oct 2023 12:23:00 +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 DCFFC16BB; Wed, 11 Oct 2023 14:22:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DCFFC16BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026978; bh=MNCqj+3y6qwDFuD72VqvmFh0zmno2m2RtrzbdBeTD3c=; 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=ALnsNrFMN2lOE2La4O8mHO90RHCWc7a7KVeMFMAGcggNe1p4XA872hRJZIAHcroDS 62Bnr7wOJikCFwiRHuas70ExPkLu+ycLx4VWRPJP9AC0YhzHX6YoysfoGddfryJwho qOoCTHM3UTXPUb9NPVkDY7SKpav1Y6gqijprTU04= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7AE57F8057D; Wed, 11 Oct 2023 14:20:23 +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 D9225F8057D; Wed, 11 Oct 2023 14:20:22 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CFA13F80130; Wed, 11 Oct 2023 14:20:16 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 0E2E2F80130 for ; Wed, 11 Oct 2023 14:17:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0E2E2F80130 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=h5eS6kWs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026636; x=1728562636; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MNCqj+3y6qwDFuD72VqvmFh0zmno2m2RtrzbdBeTD3c=; b=h5eS6kWspyUuQG3Ly7hexYy3XwgxyZWVr/fqK6ilMljnDmK7cRb+EV5S YhimhUXHlp2abmH1E17kjoaUQpqZwqMHn5WWPh/dIPy54N8yegr3qa9kf yJleI1rNzocJKHS1mUDtjDAG7eG7aYxyGF7Nn8UIeyxOZK0Tj27jR9r9Q 7GtYtvXrVGa3fmiWABCZPM5bP/UjwSTCodT5NrcfbCkD8VyVfc7iMy9r+ nxKrBzzwKKAsR+Yd99Y5B4WKkBVuYOB2uZIblfpthMPd4M6ZY9Kol0yeG tnhrAkXGMP6cYUh7r7jH/Q3E5kYbpnqTVP2vgvhH5+zGuZ5faJPE07OCu Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988437" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988437" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428387" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428387" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:06 -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 06/16] ASoC: Intel: avs: rt5682: Validate machine board configuration Date: Wed, 11 Oct 2023 14:16:53 +0200 Message-Id: <20231011121703.363652-7-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: CHEBMFWKZLMO5TOESWLW7HMCGIANMGQW X-Message-ID-Hash: CHEBMFWKZLMO5TOESWLW7HMCGIANMGQW 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16:54 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: 731987 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 2C9ABCD6E5D for ; Wed, 11 Oct 2023 12:20: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 89A971633; Wed, 11 Oct 2023 14:19:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 89A971633 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026821; bh=RyO1xqGSW3MjafxHkADBd+GajxGrSgb35YSpbUerElU=; 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=Ej7Q6noHeQSy9bIkCIt4le6ZgCKzyFqLNPllEAeURt8JpH002ajEMn6sK1tRUa3w3 oWr8TwD4dNcR5v5bMwzHhkUTyvU46c/GZEL/APIXuLaDuPocQc+n/x+NVRV3B0bgw/ WGcv6y/AUS+opum5YJAt+VNv9OxJMWGK3F6gHATs= Received: by alsa1.perex.cz (Postfix, from userid 50401) id DB9A9F805D2; Wed, 11 Oct 2023 14:17: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 6B779F805CB; Wed, 11 Oct 2023 14:17:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8ECABF8055C; Wed, 11 Oct 2023 14:17:27 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 324F2F80552 for ; Wed, 11 Oct 2023 14:17:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 324F2F80552 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=KFkv/cx2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026638; x=1728562638; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RyO1xqGSW3MjafxHkADBd+GajxGrSgb35YSpbUerElU=; b=KFkv/cx25ouZgbL5DI/q8hHPnFX320ynEP4UDDDcCnzTdxn4Or0x7pzr EHsjNRkZWQfWWL6ODQ74ydxeAHpvrc1xHfS1C0CpzhKaW4y5ckHIMZUEJ pNr1zU0jO9C/ZxpY2Q64boz0+h76StUawOkA+b+MBIHjz74kCAUHGp11m IHiK18XJYWxY/AV4WRiIRyRlmuitb2fxNOA6xoYF1McwL9wCltVZGE4ge QP9JGjlHlcgNf/T+XQpqolTnoG+Pmr0mB3KOm39bZ9k9BXFUUvTmBu2AD GzSYPjFHVoSrtslHWG1mErZ7UaL1DXoOLqds5LW5kETnYJAT3LkHwaDVQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988453" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988453" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428394" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428394" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:08 -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 07/16] ASoC: Intel: avs: max98357a: Validate machine board configuration Date: Wed, 11 Oct 2023 14:16:54 +0200 Message-Id: <20231011121703.363652-8-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 5GKQXJDKH7NCC37LKKC2ECGD7KYGIQL7 X-Message-ID-Hash: 5GKQXJDKH7NCC37LKKC2ECGD7KYGIQL7 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16:55 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: 731988 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 83F9DCD6E5D for ; Wed, 11 Oct 2023 12:19: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 C0B6D15C2; Wed, 11 Oct 2023 14:19:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C0B6D15C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026795; bh=GbOzPQQUOLORMqMhIRGHwtUKovXKoKrfzGwDUlXX9Ng=; 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=FZNfiD1GtXIqXlUniGTjwn73DeqB2RSXRTEGVCnPtPl1BUnlCPV826xg9Ixai6WxK GJVFyl2GsAlAHvriBsPb9FxjvmQ2vrBLVWswq3+SMtr/+sLHbZhbj0oofUzgH7EuxA hkxWrclUY3fOQJg8koShYDum9ufVa7rVMdbgHcGc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 97AE4F805BA; Wed, 11 Oct 2023 14:17:40 +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 E16B5F805B5; Wed, 11 Oct 2023 14:17:39 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 37002F80568; Wed, 11 Oct 2023 14:17:25 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 4DCFAF8027B for ; Wed, 11 Oct 2023 14:17:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4DCFAF8027B 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=Gqo0P6Ll DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026641; x=1728562641; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GbOzPQQUOLORMqMhIRGHwtUKovXKoKrfzGwDUlXX9Ng=; b=Gqo0P6Ll/dUN8NldgP9zfBh2puDm5MrENYIG27uXziphs/VBHMYllTAT 93ah6TIxWISlVPIfljqAt0th0SV49hhdjlNXjbhxHwKHVt49qua0OpZfN OPhUruBb4Ejg7a72Ftn/Pe+Ukb7kFOea3mPfMlZoY+aBt5wJMrfHLII90 awUdJtd7wMDQ6sK2SvgQ4Zvjde2xC0IUymMP+fEP3K95Uimti0kCpM7/j kfMkNWV6xcV3pdDGSFExrTAiVtf4kUiYSeJcJkobb2s1oSGgpdC/0A6jz QIS1CpBwbDnxlf+e5dHyj7SrD3HU+DMD8W5I/6L9kLYKjqeXezoMvmO7D Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988469" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988469" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428403" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428403" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:10 -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 08/16] ASoC: Intel: avs: rt298: Validate machine board configuration Date: Wed, 11 Oct 2023 14:16:55 +0200 Message-Id: <20231011121703.363652-9-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: RW7QUC47VF4T5UNS47A3Q35ZGFMLOT4P X-Message-ID-Hash: RW7QUC47VF4T5UNS47A3Q35ZGFMLOT4P 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16:56 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: 732512 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 8656ECD6E60 for ; Wed, 11 Oct 2023 12:20:03 +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 D137E166A; Wed, 11 Oct 2023 14:19:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D137E166A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026801; bh=5tXw1zmt1FTgGfifk2kSXRya/bnXNJZr9AL2wJXlois=; 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=MoDnOS+qB70yxMNJJOhDmQXEXRYdUQIrc+OWnQ/k90i3Tg/xrmzuRX5HjOzeUp79w Ng/dcmRvw/vRpfL4atSNqivke9+HuT1gLJCPBKGLTsGWeXE0eMypz5xPk2XwdoLytg F9bmHPEKog5waFE2o1rbkVerd3/HbXSCAf5h2nUk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9C67EF805AA; Wed, 11 Oct 2023 14:17:42 +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 E9C43F805C2; Wed, 11 Oct 2023 14:17:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B036BF80563; Wed, 11 Oct 2023 14:17:26 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 17F25F80536 for ; Wed, 11 Oct 2023 14:17:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 17F25F80536 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=JKoYfrQx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026642; x=1728562642; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5tXw1zmt1FTgGfifk2kSXRya/bnXNJZr9AL2wJXlois=; b=JKoYfrQxjUuoq1orIEuGL8VdpL7uO+CN+0DPaVqQTss1YMRUHQBMHJjQ lsqKOwU2KpchHLL7nzJ9TS7PNFpnr3BSuCBIbV4OghD22Wkb64RTjMeNS PhTPse6aEvEUJd/M6YC/O8yAD8NpPToM5n4lm05K8mDRLHyD/2BQQ/cgl uqXbNI19ooJkb4NJaHe+IUeAil0ebOKQGuM9LWf6/OPRdhlW4W27JKhmR x7HXnNVDGXPFjuzv82/+kvHO80uHY/pUV3l4WmTg386LT5sI73I2+KJbP 8VAQuOBbM2QoTSMizKCf3Wp4OgEmSSR2LWigl13a12OFNW0mz36X5z9v7 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988485" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988485" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428410" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428410" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:12 -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 09/16] ASoC: Intel: avs: da7219: Validate machine board configuration Date: Wed, 11 Oct 2023 14:16:56 +0200 Message-Id: <20231011121703.363652-10-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: GTZZBIEUEYV2XHWFDHXPCG4N3DHCT4W6 X-Message-ID-Hash: GTZZBIEUEYV2XHWFDHXPCG4N3DHCT4W6 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16:57 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: 732511 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 490E7CD6E5D for ; Wed, 11 Oct 2023 12:20: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 A0F691687; Wed, 11 Oct 2023 14:19:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A0F691687 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026835; bh=VTiICC6KmlcwKKN/dkXlAhZianYGCC4dHohXfpqewmU=; 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=SPx1UOK0/s4pMtLHLvD3oCtg2xnfPqrS3N1hzeqMQ57yAOjS3pcxjz7Y60Oby8jmD EQvYwSuukhwsxc+YAhJweMoTI2Ng2mW1U3TxbEKOdc960kyFQ+hdGL6+FsJ8nS5BAM LPi/9R4bHpY0eRuhZ2tslAabe2oHftxl1Pe1dhtw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E8402F805DF; Wed, 11 Oct 2023 14:17:46 +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 55FCDF805DA; Wed, 11 Oct 2023 14:17:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5AD41F805AC; Wed, 11 Oct 2023 14:17:38 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 5800BF8057C for ; Wed, 11 Oct 2023 14:17:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5800BF8057C 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=NhfWAmAb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026655; x=1728562655; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VTiICC6KmlcwKKN/dkXlAhZianYGCC4dHohXfpqewmU=; b=NhfWAmAbWqyfBTrX/RQoUFc1Wl0aj4GmIN+O+Em/IBFfuhxf70IjvCIG pIHcxXZ06mlBrDbEwVy5I30GNpBi+BsoSdlrQDqfTFF2nRaVZGUv8risV Wz35F3wLYUJmxljv9nOeGPAqzIejJOAn2GAfkY9K9MvTYSoGm7XCyR8G4 z49Zp6TfrMjwT1uyWy6CqQzABhxXSj3NyLVdMU/mfT3k9iNgtaKFMHjC0 24p19C5ZqYPZlOliNb1dNoyQd4r9ePp2chQKuTVwyXApWGJJhjOGa6afC ss9aU5H6BAznGKhQswBNlClVHKoce0UKB07HUpJA7UHlaQvqU/pH8jeQ5 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988554" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988554" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428419" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428419" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:14 -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 10/16] ASoC: Intel: avs: es8336: Validate machine board configuration Date: Wed, 11 Oct 2023 14:16:57 +0200 Message-Id: <20231011121703.363652-11-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: YXHRKHDV3ZAWCFPVG6S75UFQMIPFD6G3 X-Message-ID-Hash: YXHRKHDV3ZAWCFPVG6S75UFQMIPFD6G3 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16:58 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: 731985 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 2995DCD6E61 for ; Wed, 11 Oct 2023 12:21:29 +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 87947167F; Wed, 11 Oct 2023 14:20:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 87947167F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026887; bh=ahNt5IlFJob3SAq8b6d0eCyh9kkGDFCWrzmGzgYcIbY=; 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=Xn0gr8tw8Dn/OfFKRt+RFntU4ORbvXaDjMQWfcTs1RPnw1wf5hAt+txPZ4zngHoqe qiVNB3Kgm0fhYyITOWNfwi7T1ad8whaBBrYHy5NPIBjlH5MbtZEDy++cbcMapnQ6ag ze0pDJzrwdEmINJad8Qxyggr81w+3X2RHxRVzseY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8F17AF80557; Wed, 11 Oct 2023 14:17: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 11E35F805F2; Wed, 11 Oct 2023 14:17:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F2579F805CB; Wed, 11 Oct 2023 14:17:43 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 4EB97F8057C for ; Wed, 11 Oct 2023 14:17:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4EB97F8057C 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=cx+IOeg0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026658; x=1728562658; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ahNt5IlFJob3SAq8b6d0eCyh9kkGDFCWrzmGzgYcIbY=; b=cx+IOeg0hoU9ZYOGY3jQJcGKOsAclGHbItVCIvjYRc1X58kBGib7H9G8 FhEWUlb/0xRkikI6DeyM4+m1O4ZLaD2iqhgmkvR9u7eN7HD5DNd9tOLo9 PXoN5jCeLkhZo2bLuEtFR07go5DY7SpAZZR0dQ8xihznYPqNmAvN8TFSM aI8YpwwwMft4jxhDC5xxc/4CMCrb4h4PLJ83129Q3PSV3vjWbdXe5ksTL L2aUdEhSMuyakutGD6qg92OucZ7C6cGGGentXOjyv7crASkXcAA9kjEZS 1u5gbBeEY9CmMrJSDttUAc58GpATq1pACNqZPUhO7tqhM1tF0XfVPy6FM Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988566" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988566" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428428" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428428" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17: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 11/16] ASoC: Intel: avs: max98373: Validate machine board configuration Date: Wed, 11 Oct 2023 14:16:58 +0200 Message-Id: <20231011121703.363652-12-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 7DUN6WYAHSLJBASV54RXDBFBDKWA6DBX X-Message-ID-Hash: 7DUN6WYAHSLJBASV54RXDBFBDKWA6DBX 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:16: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: 731986 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 8869CCD6E60 for ; Wed, 11 Oct 2023 12:20: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 8BD74166F; Wed, 11 Oct 2023 14:20:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8BD74166F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026856; bh=zWW5LFzUPDAuhoUWVbaHJzvTc4UEJX254YfWuutsWHo=; 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=N72hnd3YzvxV4FUT1VOZKAbgK00PwLyTvAEmEKRC6svFXH4f0lEZwRUXxUfhn84vv AcGEQp620ZRAkptwfx/GePZf59Yv4WNmMGrXT7Yt9L+vGR11/SCAqUjQx0ImXc24fc WVvQea2+u3dQsqKoYDNzNFUEGnR6xxoHTAlfSjuQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 65368F805EE; Wed, 11 Oct 2023 14:17: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 CD66CF805E6; Wed, 11 Oct 2023 14:17:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 325D6F805BA; Wed, 11 Oct 2023 14:17:40 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 590DDF8058C for ; Wed, 11 Oct 2023 14:17:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 590DDF8058C 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=P6OIFsGg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026657; x=1728562657; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zWW5LFzUPDAuhoUWVbaHJzvTc4UEJX254YfWuutsWHo=; b=P6OIFsGgI+u91Bhalqul4azCu8ZAD5TXI7uRZ9NeGaMWeqqw8t2ANkz+ Krwh6LWTiNI3dP60Lt2eHoZlBehDvzwLlB5RyOR4FHe3N+HmPZOtdnSy5 Yp1uOAamcL5Qf+Co/9qY4E8RlLNOdCe6KsUpy7b3jd3d0KCXDVoP4UFhc E/Af/TN2T/aYvRXz6KcvoRTH0HLAjdm3bzO/y4yC4hpkA3F8GMWsUvJez w+QdZi93BHbfbJme+LwjQN33rEM9/wfL4rDjwJSpnRZRTRWohQtS+JTJM T1EUQMZNBslbQTLwnK3Y6B5o8cxE0haPGZqovGGnbwv6xrZn3a8t3VrHp Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988558" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988558" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428437" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428437" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17: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 12/16] ASoC: Intel: avs: max98927: Validate machine board configuration Date: Wed, 11 Oct 2023 14:16:59 +0200 Message-Id: <20231011121703.363652-13-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: RERQACSMWV2EZ7OQYDLJMHXXDBATE5M3 X-Message-ID-Hash: RERQACSMWV2EZ7OQYDLJMHXXDBATE5M3 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:17: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: 732510 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 95F71CD6E60 for ; Wed, 11 Oct 2023 12:21:08 +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 4D49F169F; Wed, 11 Oct 2023 14:20:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4D49F169F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026866; bh=mTUfkhD+bLCavKRYuhi1NAup231xxJ+NAZ9vfmKkOfc=; 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=iw+/0MV9jtqRCBrKJeoCc1c1eA6ul5nFFJyxYQnmBtWWS81EEULZv3+AZz2knv1aU 17B5H0zMXBggF2FNLoCkeLdWBtBiGkuw3uGhWI0wmcils9+AK1bvMbKAcg7ea+mzc1 OUAQCFoNJw+6bJnA3X+nADCUBAnFIhxfPe2kUR04= Received: by alsa1.perex.cz (Postfix, from userid 50401) id DEF14F805FC; Wed, 11 Oct 2023 14:17:50 +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 5AFEFF805F2; Wed, 11 Oct 2023 14:17:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 62F80F805CA; Wed, 11 Oct 2023 14:17:42 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 17E77F805AA for ; Wed, 11 Oct 2023 14:17:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 17E77F805AA 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=HuSJSAMs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026658; x=1728562658; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mTUfkhD+bLCavKRYuhi1NAup231xxJ+NAZ9vfmKkOfc=; b=HuSJSAMs18MCghb27k1yLL/83O5sohaZLPbDKz4fk7d/UAKjVK9sqp/d 1GfZFMrXCJcwKMMxspTFeuNARAMJrsmJ9Zjbs5O3py4XdnLdxDyAn9LpY I+iul2WGTF1qfY/WPPv9ApfvD4vdsamJ4nj87RWN531kpfIzzOQ95LFUu 7qtrxkMCXJOS/2lfjKJQECSXCTY4OMVvnl0LOfWrBD25ln7diuFW6ByPu h8x2omVlUdYlI02MS65Tfwcvp7xwyjsMJUO8j6bGGbl1BdhW6ZEsJF/Z1 4mSj9Q49K6lgdTte6+hfCvUdvjs47GYI+aSZkRXrzNqGYjslcpdAGPHiX w==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988561" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988561" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428468" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428468" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17: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 13/16] ASoC: Intel: avs: nau8825: Validate machine board configuration Date: Wed, 11 Oct 2023 14:17:00 +0200 Message-Id: <20231011121703.363652-14-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: SO4WTW5FQ6743H4AXCEXUJ5VDQG232GS X-Message-ID-Hash: SO4WTW5FQ6743H4AXCEXUJ5VDQG232GS 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:17: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: 732509 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 C3777CD6E5D for ; Wed, 11 Oct 2023 12:21:55 +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 9FA2F1633; Wed, 11 Oct 2023 14:21:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9FA2F1633 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026913; bh=7TuKqbEfXkjGCEPcsZSEPKhSqQ5/qs0rsxMvBIoNZJg=; 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=Nt/Z3DKgh3EgExkdElt4E8FG7dOgHSoBHP4KjPghpo2wqqgVeGGI/5Q7IAIy3Yvkc 3VsOlFxJz4XfacAPOjMO40J49rkfUVEdIZsR8xsWUDePhhQo/uPnANA+5Jc0f0o751 K+QSyMx1CH3Cwk26uNYSs1Q+sD6UySL9A0/p4Dso= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2687FF805FB; Wed, 11 Oct 2023 14:17: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 89CD9F805FD; Wed, 11 Oct 2023 14:17:58 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A9D27F805FB; Wed, 11 Oct 2023 14:17:53 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 0F093F805C0 for ; Wed, 11 Oct 2023 14:17:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0F093F805C0 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=kXJikLZB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026660; x=1728562660; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7TuKqbEfXkjGCEPcsZSEPKhSqQ5/qs0rsxMvBIoNZJg=; b=kXJikLZBjhEc+Mz6Ru8Jp0JN4qSZHtR/PfTGxESe73BZbVWMT2zuQW1Q yRxumLG//O2nsJw6jwB1G0x1tCxbNHOCHHFCta4BMpM8V40vlDy+bIap/ qv0F3gQK135hhoOaHlXRWPG03mZ1El8No8AXj1J2cLUchMdvs0Sx6UJdH zr/SSGJ5PB8c2fXF0asG6c06zgxuYi1CW50QraJgfdGqiUtnNAJtF2sYk DYwJHSWWTz5boJfthVMkpMzpqzKFA4fJmJ85ElS87o+et/vU3TLZTAqoc d3Lp1E5Em0Kz2frzbmWbWQklmhWxfyAr/6Ap202ixTRJ9+h27G2MpCQEX g==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988570" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988570" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428470" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428470" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17: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 14/16] ASoC: Intel: avs: rt286: Validate machine board configuration Date: Wed, 11 Oct 2023 14:17:01 +0200 Message-Id: <20231011121703.363652-15-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: V5HUHLOK4NZF7D76WEVWA4MFS3VX2RPP X-Message-ID-Hash: V5HUHLOK4NZF7D76WEVWA4MFS3VX2RPP 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:17: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: 732508 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 BCC61CD6E63 for ; Wed, 11 Oct 2023 12:22:18 +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 D5A161572; Wed, 11 Oct 2023 14:21:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D5A161572 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026936; bh=NQ7vZ6j7F5HfqeEPxfo4iyRV1yIRcfK4T1JFIp7ATIQ=; 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=mo3i5PPgZJ+xFP/mj6g8t1VvBgG/fVTDiA2iHTR61NrDmwKFxbz3jLuzdrlkQT3aV aejBD3aSDdV4em2B9ACSNrew28stnqj9GDErwhi57RWEjAFpG373mklpdOCD7S7Qm2 BLPvf4hhe97f9PH1MBfUfrPDSC8cTPe+hot+isXo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B0DDEF80616; Wed, 11 Oct 2023 14:18: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 74E1EF80616; Wed, 11 Oct 2023 14:18:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5F5FCF805FD; Wed, 11 Oct 2023 14:17:56 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 38BDEF805C1 for ; Wed, 11 Oct 2023 14:17:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 38BDEF805C1 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=WLCe06gC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026660; x=1728562660; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NQ7vZ6j7F5HfqeEPxfo4iyRV1yIRcfK4T1JFIp7ATIQ=; b=WLCe06gCRdux7+v/MNcLDVpmtSHefsxeHOhv5HkpNUR50PMpAwbN4TDG mXIFjlJXlf3W7ZyHlTQoJGKm2gU++jiVnR+t61JOeWxGGCpHYkQVeRF0K 8VbhnqIRMNvcFzLKV4r+agcL+fdThlOYyoZQ0Sb5K8hkgkuqsoplNiaJf BnRTrMjbYrsbwb7d7a7x86gS3r5YzjIfvlsXRCzkGKoOzTT+FJOJStvjr b7xfDIvNtXlg6BUK9iZ0g7wWj5nXpn1pVeNlGFDJpfTYN5P3yrHQYEVn8 pvtwjyN6yv7LppR3I8m6OvOFpfPmKj6vSU+2b178YFeBgWXO614NN7q5C Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988581" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988581" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428472" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428472" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:25 -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 15/16] ASoC: Intel: avs: rt5663: Validate machine board configuration Date: Wed, 11 Oct 2023 14:17:02 +0200 Message-Id: <20231011121703.363652-16-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: KHMG2LSQANPWAV3AQLBXE2T7UP3YZLT6 X-Message-ID-Hash: KHMG2LSQANPWAV3AQLBXE2T7UP3YZLT6 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. Reviewed-by: Cezary Rojewski 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 Wed Oct 11 12:17: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: 731984 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 74FCCCD6E60 for ; Wed, 11 Oct 2023 12:21: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 A982D16B5; Wed, 11 Oct 2023 14:21:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A982D16B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697026916; bh=dGKyuaVmkYf9mEZDA8Wx2248pVUiQ9RihY4+HOZT9xY=; 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=YOd9BlkM9iAQk0t72EdSAcjWbStHQVkzBtvuTlolNzzpcaiIjW2L4R9Sxclm/Ud9s BhrAxFQcY5FJsOoQrFx4v2GjC+amTlkKZO+laYzSf508Rn5nRnKfr61/s0KLFNowlV DaUAP2E8+EXgtdFzbdHM5A0QJQrye5h2UX948GTA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C00FFF8060A; Wed, 11 Oct 2023 14:18: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 02528F8060B; Wed, 11 Oct 2023 14:18:00 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 21A9CF805FE; Wed, 11 Oct 2023 14:17:55 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 0EE0CF805BF for ; Wed, 11 Oct 2023 14:17:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0EE0CF805BF 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=QKEs47cB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697026660; x=1728562660; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dGKyuaVmkYf9mEZDA8Wx2248pVUiQ9RihY4+HOZT9xY=; b=QKEs47cBdY9JsS0Gn6LTtwuGECNt5ReSIJAK/n1t4w2tyAaX2oxxVBvD 2mE0GAlIiLMQ+lCkjAWq8qk1RWX9jWD4SIc1ezlaksu8nNR99jUsvqEKK TIAKE29rciAw3VXy78KLzR/1lMHskRUWZRy0KLOt8cQXZDmC/Vw03gQ5x zglcEZFLWmu/MtE1XuoEE+mopQJQmilRBey1+If3P3cCctgTPaujXykTi Gp9+xKjUDBJYYA2skqXQ0z7MRUh4UoVXdteEn47IG6gL6hGl5g3aY1787 z5fRm4GcqVfh5ePpuYnT52GjK5QSPz2G2+vJtIMddu/CFTfz5+3lBz8iB w==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="374988575" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="374988575" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 05:17:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747428474" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747428474" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2023 05:17:27 -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 16/16] ASoC: Intel: avs: ssm4567: Validate machine board configuration Date: Wed, 11 Oct 2023 14:17:03 +0200 Message-Id: <20231011121703.363652-17-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> References: <20231011121703.363652-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: Y7XPNOHZDAG5GQEH2AMTO7D7ZPVUE65Y X-Message-ID-Hash: Y7XPNOHZDAG5GQEH2AMTO7D7ZPVUE65Y 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. Reviewed-by: Cezary Rojewski 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;