From patchwork Tue Mar 26 16:03:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604569 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CED823D98E for ; Tue, 26 Mar 2024 16:05:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469121; cv=none; b=JX8VO7nb/yKXBhD/jWaBbrgvIaTFiGSdI+fz59XppIQWwUnRpiSxrjRgn8Sju6d+gIxA3N5AC/2LhoXhsKQDi1xAY5HdkUScLQ0vncnHYdS7T5XLDUDt3FDZKoId7atYyx+Tm4o0btkqWWWHtma4iFCxf6IpQ4iRqm4voGeS/7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469121; c=relaxed/simple; bh=a39cz9cQqdObx78EZ2RJ/GmVrKVOdmW+jIk/kbOio/w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eRLaf2AMtWeBLWNgpv2W0NS2OS8mTgWu7nYeSksLrx5UOuEQtBbk6vWNBBxbnSr0h2nweSZNKDeRECVUue8fVE+2N7Vfgqzyt3vKx12AAu7DqSs9QBLkirSugxCQcUGS47Mgy6xDoJwyE55NJgBIGqURKgTl8wZI3djYbvqRVEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aFMB3r7+; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aFMB3r7+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469119; x=1743005119; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a39cz9cQqdObx78EZ2RJ/GmVrKVOdmW+jIk/kbOio/w=; b=aFMB3r7+rGqa+FCY/BSOuknLvawuuRZsnasdMAfdrYhIOaA4xYRQaLC1 eC7eaNfm8apcNU+Cxs29erAzWtNhyMZdadkdSufdRwqj2lRn0AB2K5DPQ tGnwSGlJYYgWfcXzNBhvbZBciC/yONsHpW24c2z9kbvfSxL1XIhNKufVv XSRclNiE041VrrxuWjyXrYJ6R8bCPyeMRz4IsaBE6ELN4ul0tFtTxdyI8 Fwu/nvZQjkrKi6mkXPyTmWoDYGGs63vNgfzZfywK7q2B2UfBc+VqQv5Ta sU4PpkkxJuth6Qf+CwyO599LXTj7YKafABvVNpUI/lUa6aSfam/wfPeQu A==; X-CSE-ConnectionGUID: REj8ciciRNGT+kXNtIatGg== X-CSE-MsgGUID: 0oAj/d9YRByPOEDx9G/5qA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260328" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260328" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482104" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:42 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 01/34] ASoC: intel: sof_sdw: Make find_codec_info_part() return a pointer Date: Tue, 26 Mar 2024 11:03:56 -0500 Message-Id: <20240326160429.13560-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Rather than returning an index simply return a pointer to the located codec info, this simplifies all the callers which only want to access the codec info structure. Also remove the inline specifier the function is fairly large for an inline function, let the compiler decide. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 79 +++++++++++++++----------------- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 08f330ed5c2e..08b19a32cf9c 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1055,7 +1055,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { }, }; -static inline int find_codec_info_part(const u64 adr) +static struct sof_sdw_codec_info *find_codec_info_part(const u64 adr) { unsigned int part_id, sdw_version; int i; @@ -1070,9 +1070,9 @@ static inline int find_codec_info_part(const u64 adr) if (part_id == codec_info_list[i].part_id && (!codec_info_list[i].version_id || sdw_version == codec_info_list[i].version_id)) - return i; + return &codec_info_list[i]; - return -EINVAL; + return NULL; } @@ -1116,7 +1116,6 @@ static int get_dailink_info(struct device *dev, for (; adr_link->num_adr; adr_link++) { const struct snd_soc_acpi_endpoint *endpoint; struct sof_sdw_codec_info *codec_info; - int codec_index; int stream; u64 adr; @@ -1126,11 +1125,9 @@ static int get_dailink_info(struct device *dev, for (i = 0; i < adr_link->num_adr; i++) { adr = adr_link->adr_d[i].adr; - codec_index = find_codec_info_part(adr); - if (codec_index < 0) - return codec_index; - - codec_info = &codec_info_list[codec_index]; + codec_info = find_codec_info_part(adr); + if (!codec_info) + return -EINVAL; *codecs_num += codec_info->dai_num; @@ -1257,11 +1254,11 @@ static int fill_sdw_codec_dlc(struct device *dev, { unsigned int sdw_version, unique_id, mfg_id, link_id, part_id, class_id; u64 adr = adr_link->adr_d[adr_index].adr; - int codec_index; + struct sof_sdw_codec_info *codec_info; - codec_index = find_codec_info_part(adr); - if (codec_index < 0) - return codec_index; + codec_info = find_codec_info_part(adr); + if (!codec_info) + return -EINVAL; sdw_version = SDW_VERSION(adr); link_id = SDW_DISCO_LINK_ID(adr); @@ -1270,10 +1267,8 @@ static int fill_sdw_codec_dlc(struct device *dev, part_id = SDW_PART_ID(adr); class_id = SDW_CLASS_ID(adr); - if (codec_info_list[codec_index].codec_name) - codec->name = devm_kstrdup(dev, - codec_info_list[codec_index].codec_name, - GFP_KERNEL); + if (codec_info->codec_name) + codec->name = devm_kstrdup(dev, codec_info->codec_name, GFP_KERNEL); else if (is_unique_device(adr_link, sdw_version, mfg_id, part_id, class_id, adr_index)) codec->name = devm_kasprintf(dev, GFP_KERNEL, @@ -1287,7 +1282,7 @@ static int fill_sdw_codec_dlc(struct device *dev, if (!codec->name) return -ENOMEM; - codec->dai_name = codec_info_list[codec_index].dais[dai_index].dai_name; + codec->dai_name = codec_info->dais[dai_index].dai_name; return 0; } @@ -1309,22 +1304,22 @@ static int set_codec_init_func(struct snd_soc_card *card, * we should end immediately if it is not aggregated (group_id=0) */ for ( ; i < adr_link->num_adr; i++) { - int codec_index; + struct sof_sdw_codec_info *codec_info; - codec_index = find_codec_info_part(adr_link->adr_d[i].adr); - if (codec_index < 0) - return codec_index; + codec_info = find_codec_info_part(adr_link->adr_d[i].adr); + if (!codec_info) + return -EINVAL; /* The group_id is > 0 iff the codec is aggregated */ if (adr_link->adr_d[i].endpoints->group_id != group_id) continue; - if (codec_info_list[codec_index].dais[dai_index].init) - codec_info_list[codec_index].dais[dai_index].init(card, - adr_link, - dai_links, - &codec_info_list[codec_index], - playback); + if (codec_info->dais[dai_index].init) + codec_info->dais[dai_index].init(card, + adr_link, + dai_links, + codec_info, + playback); if (!group_id) return 0; } @@ -1481,7 +1476,6 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, int cpu_dai_num; unsigned int group_id; int codec_dlc_index = 0; - int codec_index; int codec_num; int stream; int i = 0; @@ -1541,10 +1535,9 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, } /* find codec info to create BE DAI */ - codec_index = find_codec_info_part(adr_link->adr_d[adr_index].adr); - if (codec_index < 0) - return codec_index; - codec_info = &codec_info_list[codec_index]; + codec_info = find_codec_info_part(adr_link->adr_d[adr_index].adr); + if (!codec_info) + return -EINVAL; if (codec_info->ignore_pch_dmic) *ignore_pch_dmic = true; @@ -1631,7 +1624,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, ret = set_codec_init_func(card, adr_link, dai_links + (*link_index)++, playback, group_id, adr_index, dai_index); if (ret < 0) { - dev_err(dev, "failed to init codec %d\n", codec_index); + dev_err(dev, "failed to init codec 0x%x\n", codec_info->part_id); return ret; } } @@ -1649,6 +1642,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) const struct snd_soc_acpi_link_adr *adr_link = mach_params->links; bool aggregation = !(sof_sdw_quirk & SOF_SDW_NO_AGGREGATION); struct snd_soc_codec_conf *codec_conf; + struct sof_sdw_codec_info *codec_info; bool append_dai_type = false; bool ignore_pch_dmic = false; int codec_conf_num = 0; @@ -1660,7 +1654,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) char *name, *cpu_dai_name; char *codec_name, *codec_dai_name; int i, j, be_id = 0; - int codec_index; int hdmi_num; int ret; @@ -1729,10 +1722,10 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) */ for (i = 0; i < adr_link->num_adr; i++) { /* find codec info to get dai_num */ - codec_index = find_codec_info_part(adr_link->adr_d[i].adr); - if (codec_index < 0) - return codec_index; - if (codec_info_list[codec_index].dai_num > 1) { + codec_info = find_codec_info_part(adr_link->adr_d[i].adr); + if (!codec_info) + return -EINVAL; + if (codec_info->dai_num > 1) { append_dai_type = true; goto out; } @@ -1762,11 +1755,11 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) continue; /* find codec info to get dai_num */ - codec_index = find_codec_info_part(adr_link->adr_d[i].adr); - if (codec_index < 0) - return codec_index; + codec_info = find_codec_info_part(adr_link->adr_d[i].adr); + if (!codec_info) + return -EINVAL; - for (j = 0; j < codec_info_list[codec_index].dai_num ; j++) { + for (j = 0; j < codec_info->dai_num ; j++) { int current_be_id; ret = create_sdw_dailink(card, &link_index, dai_links, From patchwork Tue Mar 26 16:03:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604570 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D122713C8EC for ; Tue, 26 Mar 2024 16:05:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469122; cv=none; b=pj3htgbbk4dgt/fy1VSyNlTb8cNtycmrb5HdREHWoP4fClEbp9sK/BYXz718w3H3mvMbwaBGhx+pyfQe5TTJCx+iEk+d2CbP9TC1uhpSbhBlGFpJEn0GJbg61aW3kCj+0xFs91fSPwernKV8gJAFyQttF5/k4AWuMEYtQz3THXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469122; c=relaxed/simple; bh=mfp9MUGKgMyzz9N1Rro0RHkR500BoW+UsQ7SEPZ7h0s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jyFG8xnKafQrJ5dz26gXw0edGw/rpAYG6EJ8Ad60G1BM1ShwXAJAFxStzESR8eKsiFksGrAQLwVyMbNolG6wEAcuuMaGbnQg39pmIwQiI2k11lSqk0OKbYw0OWOV/u2ECHyeeEh9Uv3UZaeDovADagPx2gsC5BPNF3DddStxOI4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=X8uEmw8g; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="X8uEmw8g" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469120; x=1743005120; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mfp9MUGKgMyzz9N1Rro0RHkR500BoW+UsQ7SEPZ7h0s=; b=X8uEmw8gww6iDiXPU0aAqqexg/8XNo6yEGeeX4JJt6aa2fQVDnWrx1c2 JuMhcG0TcW3EDRfJY1UaYm89zqgg1Pni5XzHzHKOEBjqGeWzA9evpbI9+ 2iDoUffDFwFIVk4JSgtXEqUrKMrpOl0ZYaVy6uzFvuXALZBEd2DIIkO3Y jhRKouvWQ2oQBlq4yovQijWBiR6GaNyiS0PudiA4f60OA5BhOfJUKIl/L CHDctUj3jUH9qt1FQ9XMXvkorklP2avlhgCXZupa2bKZQnKMxoMo7QB6Y a3m9OrI+4ff41U4H/NftBvbn8WquitZusU+1gMMUbst5ZrQfR8etPKXFQ w==; X-CSE-ConnectionGUID: dEPouzynRvKhzl5G0C+Fjg== X-CSE-MsgGUID: Q1spee12S0+2xwvXBdLL8g== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260334" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260334" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482115" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:43 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 02/34] ASoC: intel: sof_sdw: Make find_codec_info_acpi() return a pointer Date: Tue, 26 Mar 2024 11:03:57 -0500 Message-Id: <20240326160429.13560-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Rather than returning an index simply return a pointer to the located codec info, this simplifies all the callers which only want to access the codec info structure. Also remove the inline specifier the function is fairly large for an inline function, let the compiler decide. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 08b19a32cf9c..517ff44de1f0 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1076,18 +1076,18 @@ static struct sof_sdw_codec_info *find_codec_info_part(const u64 adr) } -static inline int find_codec_info_acpi(const u8 *acpi_id) +static struct sof_sdw_codec_info *find_codec_info_acpi(const u8 *acpi_id) { int i; if (!acpi_id[0]) - return -EINVAL; + return NULL; for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) if (!memcmp(codec_info_list[i].acpi_id, acpi_id, ACPI_ID_LEN)) - return i; + return &codec_info_list[i]; - return -EINVAL; + return NULL; } /* @@ -1643,18 +1643,19 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) bool aggregation = !(sof_sdw_quirk & SOF_SDW_NO_AGGREGATION); struct snd_soc_codec_conf *codec_conf; struct sof_sdw_codec_info *codec_info; + struct sof_sdw_codec_info *ssp_info; bool append_dai_type = false; bool ignore_pch_dmic = false; int codec_conf_num = 0; int codec_conf_index = 0; bool group_generated[SDW_MAX_GROUPS] = { }; - int ssp_codec_index, ssp_mask; struct snd_soc_dai_link *dai_links; int num_links, link_index = 0; char *name, *cpu_dai_name; char *codec_name, *codec_dai_name; int i, j, be_id = 0; int hdmi_num; + int ssp_mask; int ret; ret = get_dailink_info(dev, adr_link, &sdw_be_num, &codec_conf_num); @@ -1669,8 +1670,8 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) * system only when I2S mode is supported, not sdw mode. * Here check ACPI ID to confirm I2S is supported. */ - ssp_codec_index = find_codec_info_acpi(mach->id); - if (ssp_codec_index >= 0) { + ssp_info = find_codec_info_acpi(mach->id); + if (ssp_info) { ssp_mask = SOF_SSP_GET_PORT(sof_sdw_quirk); ssp_num = hweight_long(ssp_mask); } @@ -1788,30 +1789,28 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto DMIC; for (i = 0, j = 0; ssp_mask; i++, ssp_mask >>= 1) { - struct sof_sdw_codec_info *info; int playback, capture; if (!(ssp_mask & 0x1)) continue; - info = &codec_info_list[ssp_codec_index]; - name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", i); cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", i); codec_name = devm_kasprintf(dev, GFP_KERNEL, "i2c-%s:0%d", - info->acpi_id, j++); + ssp_info->acpi_id, j++); - playback = info->dais[0].direction[SNDRV_PCM_STREAM_PLAYBACK]; - capture = info->dais[0].direction[SNDRV_PCM_STREAM_CAPTURE]; + playback = ssp_info->dais[0].direction[SNDRV_PCM_STREAM_PLAYBACK]; + capture = ssp_info->dais[0].direction[SNDRV_PCM_STREAM_CAPTURE]; ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name, playback, capture, cpu_dai_name, - codec_name, info->dais[0].dai_name, - NULL, info->ops); + codec_name, ssp_info->dais[0].dai_name, + NULL, ssp_info->ops); if (ret) return ret; - ret = info->dais[0].init(card, NULL, dai_links + link_index, info, 0); + ret = ssp_info->dais[0].init(card, NULL, dai_links + link_index, + ssp_info, 0); if (ret < 0) return ret; From patchwork Tue Mar 26 16:03:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604571 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9375913C8F7 for ; Tue, 26 Mar 2024 16:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469122; cv=none; b=kT6c1wJwiaSg8OKRc3lULO9XvDjeuVn7VwYPUzAkL5/zEyE5bFgW5y6Dx2LAhwiA/kFK8/jUCN1iAtQ62xWTuL2MN28i7BrsDclLOSY3j6dR7f4mpAEyLbpnaC9LYGjJuZ/JI9Q7ONz9x8TGzvZnii+HTWWku1WzMM0BfzFHy+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469122; c=relaxed/simple; bh=6SlSTg+Vo1TIgstqNm9sEWuuniZN2L+wo5SBrGWgI60=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=h0oIDLe7aTjqjUpm6iQBPB+M1yUbqHABLS5kodX0LfEfSwflFwUlFA1lqS8ub1ZJyzZaLHQ4QDuojP6CjfUHVpy02x8CEIsoSFQPtZAbidZqfI+Zo9N02f6wsU37PRE0j3hrj8+/aM0RhsmmBVZqqKb/YmyOmUlZOVy3q8if0CU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Sd1jzDi/; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Sd1jzDi/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469120; x=1743005120; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6SlSTg+Vo1TIgstqNm9sEWuuniZN2L+wo5SBrGWgI60=; b=Sd1jzDi/3+d+icmrmOBHh+8yAB5sIMr/6HQSUn4ucvfqS1kx0g/mzHTq 3X6tNQ5GRO9lQGqd5PuxT5fzWdnOJZYL8NqpdGV//N0BX6T5Ov30+RXdU LvkCax5dq2CAJ12gUYABcm4R7La77erOrPh4SBgExuvmSEbSn0i8uBZeO 0eAW1BJACD7t04x+z4tKKfCE4kukSfG68QgMz36f6OYROtz+vcjghMGcK Ul0qLrZostOYmMrdCuw41p7txDOTHO0H+5VuYmneIuSvj/bNIoAnax8Su xJbdRnBPBD6oM+L5xDpGGmbBCdrk8tsfwhjUflP7ECjntp4saX/A8FabA A==; X-CSE-ConnectionGUID: CKnHnbg7SdWrtwOdRJvA5A== X-CSE-MsgGUID: 8TLVnt2mS/i+tCMuVLqf0Q== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260340" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260340" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482125" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:43 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 03/34] ASoC: intel: sof_sdw: Make find_codec_info_dai() return a pointer Date: Tue, 26 Mar 2024 11:03:58 -0500 Message-Id: <20240326160429.13560-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Rather than returning an index simply return a pointer to the located codec info, this simplifies all the callers which only want to access the codec info structure. Also remove the inline specifier the function is fairly large for an inline function, let the compiler decide. And move the function such that it is located with the other find_codec_info_*() functions. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 39 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 517ff44de1f0..4bd9f62c48fc 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1090,6 +1090,23 @@ static struct sof_sdw_codec_info *find_codec_info_acpi(const u8 *acpi_id) return NULL; } +static struct sof_sdw_codec_info *find_codec_info_dai(const char *dai_name, + int *dai_index) +{ + int i, j; + + for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) { + for (j = 0; j < codec_info_list[i].dai_num; j++) { + if (!strcmp(codec_info_list[i].dais[j].dai_name, dai_name)) { + *dai_index = j; + return &codec_info_list[i]; + } + } + } + + return NULL; +} + /* * get BE dailink number and CPU DAI number based on sdw link adr. * Since some sdw slaves may be aggregated, the CPU DAI number @@ -1403,37 +1420,19 @@ static void set_dailink_map(struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps, } } -static inline int find_codec_info_dai(const char *dai_name, int *dai_index) -{ - int i, j; - - for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) { - for (j = 0; j < codec_info_list[i].dai_num; j++) { - if (!strcmp(codec_info_list[i].dais[j].dai_name, dai_name)) { - *dai_index = j; - return i; - } - } - } - - return -EINVAL; -} - static int sof_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd) { struct sof_sdw_codec_info *codec_info; struct snd_soc_dai *dai; - int codec_index; int dai_index; int ret; int i; for_each_rtd_codec_dais(rtd, i, dai) { - codec_index = find_codec_info_dai(dai->name, &dai_index); - if (codec_index < 0) + codec_info = find_codec_info_dai(dai->name, &dai_index); + if (!codec_info) return -EINVAL; - codec_info = &codec_info_list[codec_index]; /* * A codec dai can be connected to different dai links for capture and playback, * but we only need to call the rtd_init function once. From patchwork Tue Mar 26 16:03:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604572 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9808E13C8FC for ; Tue, 26 Mar 2024 16:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469123; cv=none; b=Rkt++IoQN4IQox7CJsfcs/aTIUI6F3lFAXpAupLi/FUbbTApUAzFBxTgxQwCKC5+UQyeW2GThxH5W7PVdJwxlNSgrIaAtP4HL3OEL7Gp1BgAw/tgeOyJe720RNQPF3S02Muw46juxQt7ENcB4APrCiAUI/NN/zvPqm41MobOsSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469123; c=relaxed/simple; bh=IGaUX8YJZXWAmr7zoW4xLN1MTZeKcfPI99f/516aWdw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EBbfOFXpOP/I15wvXfGZoae1Rk3a//UVyDPaZ3xhHn5b/x51JUdlK3YqrEbA8NE/i18OM2mzFblT7WkYZlhPC6sjEJr1PYZ/pWT7Wt5+p9Y8TUId8RKIn9RlxtWIKfWjcXKlG//fF+cRAcf4Z9abvEfy0VIXz5SulrSM9UsHjn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=K5XLuPin; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="K5XLuPin" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469121; x=1743005121; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IGaUX8YJZXWAmr7zoW4xLN1MTZeKcfPI99f/516aWdw=; b=K5XLuPinEGqrcwT0QwI5zi0MCNzLfMGe5lFkl10uRBHR2naBi3sz/nXe MgWiYeSi6201PAG0Rmhoyx0yL360DwvVHBR1fk8Ax18p+Zi1EM3LkYJCB JH2Lguriz17mMch5EZsmGW/oYqNtmqxU+2cWoqvbs7GwWcYT+9DCJ7aJ4 wuJtgGn6z5KhGGme6BnJK7IBBJbqm2gcSBZPJthV6rFpkFe8lbSwwZPXg pfhg2Obtux/XPMa/baRHoVU6I3dE3U6fWiVh6Y3tLOnn67HXVc4KIy/l1 T7mFeWQ1U4XnTaOosCzL1sVYbtTHaFj8JICqBUmfwsLr4xAbpmZpgz7Vd w==; X-CSE-ConnectionGUID: WUtBWkggRruSA0xmfIo4Wg== X-CSE-MsgGUID: HPr+lncRSsaKWlIPQSLabA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260346" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260346" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482146" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:44 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 04/34] ASoC: intel: sof_sdw: Only pass codec_conf pointer around Date: Tue, 26 Mar 2024 11:03:59 -0500 Message-Id: <20240326160429.13560-5-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Rather than passing around a pointer to the codec_conf array, an index into it and a size, simply pass around a pointer to the current codec_conf. This reduces the amount of state moving around. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 4bd9f62c48fc..7b61d45df5da 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1457,10 +1457,8 @@ static const char * const type_strings[] = {"SimpleJack", "SmartAmp", "SmartMic" static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, struct snd_soc_dai_link *dai_links, int sdw_be_num, const struct snd_soc_acpi_link_adr *adr_link, - struct snd_soc_codec_conf *codec_conf, - int codec_count, int *be_id, - int *codec_conf_index, - bool *ignore_pch_dmic, + struct snd_soc_codec_conf **codec_conf, + int *be_id, bool *ignore_pch_dmic, bool append_dai_type, int adr_index, int dai_index) @@ -1509,7 +1507,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, continue; /* sanity check */ - if (*codec_conf_index >= codec_count) { + if (*codec_conf >= card->codec_conf + card->num_configs) { dev_err(dev, "codec_conf array overflowed\n"); return -EINVAL; } @@ -1520,12 +1518,11 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, if (ret) return ret; - codec_conf[*codec_conf_index].dlc = codecs[codec_dlc_index]; - codec_conf[*codec_conf_index].name_prefix = - adr_link_next->adr_d[j].name_prefix; + (*codec_conf)->dlc = codecs[codec_dlc_index]; + (*codec_conf)->name_prefix = adr_link_next->adr_d[j].name_prefix; codec_dlc_index++; - (*codec_conf_index)++; + (*codec_conf)++; } j = 0; @@ -1646,7 +1643,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) bool append_dai_type = false; bool ignore_pch_dmic = false; int codec_conf_num = 0; - int codec_conf_index = 0; bool group_generated[SDW_MAX_GROUPS] = { }; struct snd_soc_dai_link *dai_links; int num_links, link_index = 0; @@ -1706,6 +1702,9 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (!codec_conf) return -ENOMEM; + card->codec_conf = codec_conf; + card->num_configs = codec_conf_num; + /* SDW */ if (!sdw_be_num) goto SSP; @@ -1764,9 +1763,9 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) ret = create_sdw_dailink(card, &link_index, dai_links, sdw_be_num, adr_link, - codec_conf, codec_conf_num, - ¤t_be_id, &codec_conf_index, - &ignore_pch_dmic, append_dai_type, i, j); + &codec_conf, ¤t_be_id, + &ignore_pch_dmic, + append_dai_type, i, j); if (ret < 0) { dev_err(dev, "failed to create dai link %d\n", link_index); return ret; @@ -1886,9 +1885,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) card->dai_link = dai_links; card->num_links = num_links; - card->codec_conf = codec_conf; - card->num_configs = codec_conf_num; - return 0; } From patchwork Tue Mar 26 16:04:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604574 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D20E13C901 for ; Tue, 26 Mar 2024 16:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469124; cv=none; b=DuIiQrVY6lhAozvoNOI1M+R40/D/C7E4RMCtT2fhmaihhB/ccGxRg4j7gcDyY8Slcjy5Mys/REFU+0nvMaZegGh4XsC18Ls7FgfhY3kp2s2yMYCD3Pl0/Mojj4dQluaHrdX56rYOE8LnvJOaKnaWXZXE+gsslxCNG6UwtRH6gGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469124; c=relaxed/simple; bh=U4OtHoNqJ+4hCKh/I0uepPXi2zqFsbV/bIV5qmonHx0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KZqO//zeopKu13lDy4Uc1JZ+XRYLr0M+y4LEj0JYb3EvpEbJYdoOVD7UFNBO5nQlI1v/UlVL4uG7NyUH6VWJfp5hC1da3S8rpndsa0D0qErTYHiowUnsDsgPws9oy7AddD9z0cl7tDnkDbkUaOgKahsU3Ykq7AgW2IqKjaEbwm4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Qbd8ALSG; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Qbd8ALSG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469122; x=1743005122; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U4OtHoNqJ+4hCKh/I0uepPXi2zqFsbV/bIV5qmonHx0=; b=Qbd8ALSGOeAqMo0Rk+dy+cJvtJ337O65gKpivimJjVUuFD+0Wz9QpnTZ 7y2/DN8Xcsmf/IuNYsQnaYkggm6NrAB93G5M9kZnOmf/X2To5DLnpypkn XQWZlk6LGL/ZldbJdW67870/J+Vpf3e2FbZsg2Vxdfwbx/evzGKvQryIl qwysZzJ0oyo2ZiOsAG15lPtxspui0GXVAVXeFZcX8LLOEfY8WL7J2Z3G8 G/9Nf/7MAy+qJKNTIWQdycR3UISAR+fj7pABGZIja529YnCUIzr2/ZAC1 TbsCMdEH8OAQuLqi8kJK1czhZeZYAexnsmc9mFmxvuFhnUSGMjm+sM09m g==; X-CSE-ConnectionGUID: mfeixbkVTh+l3pwZGgV6HA== X-CSE-MsgGUID: FpB7AowwRiGy7XWzEp75MQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260353" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260353" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482158" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:45 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 05/34] ASoC: intel: sof_sdw: Set channel map directly from endpoints Date: Tue, 26 Mar 2024 11:04:00 -0500 Message-Id: <20240326160429.13560-6-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax The current code evenly distributes the CODEC DAIs across the CPU DAIs in the DAI link, but this is just an assumption about how the devices are connected to the host. All the information about which CODEC is connected to which CPU DAI is contained in the endpoints datastructures and those structures are already parsed to work out which CODECs to include in the DAI link. Simply fill in the mapping from CPUs -> CODECs as we parse through the endpoints structures, this will ensure that mapping matches the physical layout. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 7b61d45df5da..e2c1822b185f 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1407,19 +1407,6 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, return 0; } -static void set_dailink_map(struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps, - int codec_num, int cpu_num) -{ - int step; - int i; - - step = codec_num / cpu_num; - for (i = 0; i < codec_num; i++) { - sdw_codec_ch_maps[i].cpu = i / step; - sdw_codec_ch_maps[i].codec = i; - } -} - static int sof_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd) { struct sof_sdw_codec_info *codec_info; @@ -1466,6 +1453,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct device *dev = card->dev; const struct snd_soc_acpi_link_adr *adr_link_next; + struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps; struct snd_soc_dai_link_component *codecs; struct snd_soc_dai_link_component *cpus; struct sof_sdw_codec_info *codec_info; @@ -1488,6 +1476,11 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, if (!codecs) return -ENOMEM; + sdw_codec_ch_maps = devm_kcalloc(dev, codec_num, + sizeof(*sdw_codec_ch_maps), GFP_KERNEL); + if (!sdw_codec_ch_maps) + return -ENOMEM; + /* generate codec name on different links in the same group */ j = adr_index; for (adr_link_next = adr_link; adr_link_next && adr_link_next->num_adr && @@ -1521,6 +1514,9 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, (*codec_conf)->dlc = codecs[codec_dlc_index]; (*codec_conf)->name_prefix = adr_link_next->adr_d[j].name_prefix; + sdw_codec_ch_maps[codec_dlc_index].cpu = i; + sdw_codec_ch_maps[codec_dlc_index].codec = codec_dlc_index; + codec_dlc_index++; (*codec_conf)++; } @@ -1539,7 +1535,6 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, *ignore_pch_dmic = true; for_each_pcm_streams(stream) { - struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps; char *name, *cpu_name; int playback, capture; static const char * const sdw_stream_name[] = { @@ -1558,11 +1553,6 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, return -EINVAL; } - sdw_codec_ch_maps = devm_kcalloc(dev, codec_num, - sizeof(*sdw_codec_ch_maps), GFP_KERNEL); - if (!sdw_codec_ch_maps) - return -ENOMEM; - /* create stream name according to first link id */ if (append_dai_type) { name = devm_kasprintf(dev, GFP_KERNEL, @@ -1614,9 +1604,8 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, * based on wait_for_completion(), tag them as 'nonatomic'. */ dai_links[*link_index].nonatomic = true; - - set_dailink_map(sdw_codec_ch_maps, codec_num, cpu_dai_num); dai_links[*link_index].ch_maps = sdw_codec_ch_maps; + ret = set_codec_init_func(card, adr_link, dai_links + (*link_index)++, playback, group_id, adr_index, dai_index); if (ret < 0) { From patchwork Tue Mar 26 16:04:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604573 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C459013C90A for ; Tue, 26 Mar 2024 16:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469124; cv=none; b=A9Sdm0xUESSnzIOcx7SgRrfzUWlbeYxGM2f9j90H2wjTb62d+6r1CrpDjBRXWJh/5Zur4cagnxz8uJDHgt48G95sW4COIV0rpYqAuL7RCqNNHxQqncbyXOO9/Q95gL5V3bdbP5oow76uSRs5FY3yIfDhTL80oRjh14ownaBhE/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469124; c=relaxed/simple; bh=fZxnibU93p/ekxAxl4/k7QCGk+QjngNBvoyRs5ReYv4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=a87yGgyNN9mjw657Sl6oyuEBVrrckyu9prb8+glIZAhFtG6t39WQS2Zj5fB+BGqNDzg5LDGmek5/VFL+yppe2kIwYxSHGWAplwqEtawMztjVetIXajyS8aljBd2gakVi1fCFPbe7AvXdggsa+bflUmaw83qf46JVbhsdX7xTTL4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dPMeiYZU; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dPMeiYZU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469123; x=1743005123; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fZxnibU93p/ekxAxl4/k7QCGk+QjngNBvoyRs5ReYv4=; b=dPMeiYZUGVmQmEwG2dJh/rFOA1SZPZ3PyS9dBiXwJ9HH8UGKu6rGka0I Y1NujOFqwDjCBG+T1zRg99Hryh2POBK8fJmw854IdBQ06UpI7v6wHFZxM 4heUGWUTBP4oFSJuUBPt7rYTh4K85LtfZECpVqwr3CkfP4BmR8ld8cEmC 6UQJ9J7UB4vGdvG3BapJ9bcNKz323CqV7EcpKPEpev4VFzFCu1E0bmc6D FCuNy739rbc+Vx+8c1LkVvBTNoxWqp6zUFX+JwHOjCWlaIXIBvnfcXieQ XMVFcfNVm/miRopeOTmBtL7grOKS5tFmV1i2fEQOJJsqxK1vknc4+fg7l A==; X-CSE-ConnectionGUID: OvgCQz3zTiOnFoqgVqCiqQ== X-CSE-MsgGUID: QaJKjg/PSQWag70W1VXZLQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260359" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260359" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482166" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:46 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 06/34] ASoC: Intel: sof_sdw: Move get_codec_dai_by_name() into sof_sdw itself Date: Tue, 26 Mar 2024 11:04:01 -0500 Message-Id: <20240326160429.13560-7-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Currently sof_sdw relies on sof_board_helpers to provide get_codec_dai_by_name(), but that is the only function from sof_board_helpers it uses and no other machine driver requires that function. There is no reason for sof_sdw to select SSP_COMMON but more and more functions in sof_board_helpers are gaining dependencies on functions that would require stubs for sof_sdw to build without it. Firstly it was sof_ssp_get_codec_name(), as was fixed in commit c1469c3a8a30 ("ASoC: Intel: ssp-common: Add stub for sof_ssp_get_codec_name"), now it is: ERROR: modpost: "sof_ssp_detect_amp_type" [sound/soc/intel/boards/snd-soc-intel-sof-board-helpers.ko] undefined! ERROR: modpost: "sof_ssp_detect_codec_type" [sound/soc/intel/boards/snd-soc-intel-sof-board-helpers.ko] undefined! Rather than adding more stubs, simply move the affected function to the sof_sdw machine driver itself and no longer select SND_SOC_INTEL_SOF_BOARD_HELPERS at all. This should allow work on SSP_COMMON to progress without affecting sof_sdw. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/Kconfig | 1 - sound/soc/intel/boards/sof_board_helpers.c | 18 ------------------ sound/soc/intel/boards/sof_board_helpers.h | 3 --- sound/soc/intel/boards/sof_sdw.c | 18 ++++++++++++++++++ sound/soc/intel/boards/sof_sdw_common.h | 4 ++++ sound/soc/intel/boards/sof_sdw_cs42l42.c | 1 - sound/soc/intel/boards/sof_sdw_rt5682.c | 1 - sound/soc/intel/boards/sof_sdw_rt700.c | 1 - sound/soc/intel/boards/sof_sdw_rt711.c | 1 - sound/soc/intel/boards/sof_sdw_rt712_sdca.c | 1 - .../intel/boards/sof_sdw_rt_sdca_jack_common.c | 1 - sound/soc/intel/boards/sof_ssp_common.h | 7 ------- 12 files changed, 22 insertions(+), 35 deletions(-) diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig index e5df64fec319..b7a6ac4b6c0c 100644 --- a/sound/soc/intel/boards/Kconfig +++ b/sound/soc/intel/boards/Kconfig @@ -678,7 +678,6 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH depends on MFD_INTEL_LPSS || COMPILE_TEST depends on SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES || COMPILE_TEST depends on SOUNDWIRE - select SND_SOC_INTEL_SOF_BOARD_HELPERS select SND_SOC_MAX98363 select SND_SOC_MAX98373_I2C select SND_SOC_MAX98373_SDW diff --git a/sound/soc/intel/boards/sof_board_helpers.c b/sound/soc/intel/boards/sof_board_helpers.c index a5135be94f32..586600680e84 100644 --- a/sound/soc/intel/boards/sof_board_helpers.c +++ b/sound/soc/intel/boards/sof_board_helpers.c @@ -630,24 +630,6 @@ sof_intel_board_get_ctx(struct device *dev, unsigned long board_quirk) } EXPORT_SYMBOL_NS(sof_intel_board_get_ctx, SND_SOC_INTEL_SOF_BOARD_HELPERS); -struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd, - const char * const dai_name[], int num_dais) -{ - struct snd_soc_dai *dai; - int index; - int i; - - for (index = 0; index < num_dais; index++) - for_each_rtd_codec_dais(rtd, i, dai) - if (strstr(dai->name, dai_name[index])) { - dev_dbg(rtd->card->dev, "get dai %s\n", dai->name); - return dai; - } - - return NULL; -} -EXPORT_SYMBOL_NS(get_codec_dai_by_name, SND_SOC_INTEL_SOF_BOARD_HELPERS); - MODULE_DESCRIPTION("ASoC Intel SOF Machine Driver Board Helpers"); MODULE_AUTHOR("Brent Lu "); MODULE_LICENSE("GPL"); diff --git a/sound/soc/intel/boards/sof_board_helpers.h b/sound/soc/intel/boards/sof_board_helpers.h index 2f27ad8726f8..b6a83ca14fa8 100644 --- a/sound/soc/intel/boards/sof_board_helpers.h +++ b/sound/soc/intel/boards/sof_board_helpers.h @@ -167,7 +167,4 @@ int sof_intel_board_set_dai_link(struct device *dev, struct snd_soc_card *card, struct sof_card_private * sof_intel_board_get_ctx(struct device *dev, unsigned long board_quirk); -struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd, - const char * const dai_name[], int num_dais); - #endif /* __SOF_INTEL_BOARD_HELPERS_H */ diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index e2c1822b185f..45732884e310 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -514,6 +514,24 @@ static struct snd_soc_dai_link_component platform_component[] = { } }; +struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd, + const char * const dai_name[], + int num_dais) +{ + struct snd_soc_dai *dai; + int index; + int i; + + for (index = 0; index < num_dais; index++) + for_each_rtd_codec_dais(rtd, i, dai) + if (strstr(dai->name, dai_name[index])) { + dev_dbg(rtd->card->dev, "get dai %s\n", dai->name); + return dai; + } + + return NULL; +} + /* these wrappers are only needed to avoid typecast compilation errors */ int sdw_startup(struct snd_pcm_substream *substream) { diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index b1d57034361c..a04cbab9bc70 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -107,6 +107,10 @@ struct mc_private { extern unsigned long sof_sdw_quirk; +struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd, + const char * const dai_name[], + int num_dais); + int sdw_startup(struct snd_pcm_substream *substream); int sdw_prepare(struct snd_pcm_substream *substream); int sdw_trigger(struct snd_pcm_substream *substream, int cmd); diff --git a/sound/soc/intel/boards/sof_sdw_cs42l42.c b/sound/soc/intel/boards/sof_sdw_cs42l42.c index 0dc297f7de01..b999f4e7901a 100644 --- a/sound/soc/intel/boards/sof_sdw_cs42l42.c +++ b/sound/soc/intel/boards/sof_sdw_cs42l42.c @@ -15,7 +15,6 @@ #include #include #include -#include "sof_board_helpers.h" #include "sof_sdw_common.h" static const struct snd_soc_dapm_widget cs42l42_widgets[] = { diff --git a/sound/soc/intel/boards/sof_sdw_rt5682.c b/sound/soc/intel/boards/sof_sdw_rt5682.c index 6b008a5a343b..f812aea64322 100644 --- a/sound/soc/intel/boards/sof_sdw_rt5682.c +++ b/sound/soc/intel/boards/sof_sdw_rt5682.c @@ -15,7 +15,6 @@ #include #include #include -#include "sof_board_helpers.h" #include "sof_sdw_common.h" static const struct snd_soc_dapm_widget rt5682_widgets[] = { diff --git a/sound/soc/intel/boards/sof_sdw_rt700.c b/sound/soc/intel/boards/sof_sdw_rt700.c index 88e785a54b16..a2648c900e74 100644 --- a/sound/soc/intel/boards/sof_sdw_rt700.c +++ b/sound/soc/intel/boards/sof_sdw_rt700.c @@ -13,7 +13,6 @@ #include #include #include -#include "sof_board_helpers.h" #include "sof_sdw_common.h" static const struct snd_soc_dapm_widget rt700_widgets[] = { diff --git a/sound/soc/intel/boards/sof_sdw_rt711.c b/sound/soc/intel/boards/sof_sdw_rt711.c index cdd1587b246c..9762c48ba7a9 100644 --- a/sound/soc/intel/boards/sof_sdw_rt711.c +++ b/sound/soc/intel/boards/sof_sdw_rt711.c @@ -15,7 +15,6 @@ #include #include #include -#include "sof_board_helpers.h" #include "sof_sdw_common.h" /* diff --git a/sound/soc/intel/boards/sof_sdw_rt712_sdca.c b/sound/soc/intel/boards/sof_sdw_rt712_sdca.c index ebb4b58c198b..9c898c7286af 100644 --- a/sound/soc/intel/boards/sof_sdw_rt712_sdca.c +++ b/sound/soc/intel/boards/sof_sdw_rt712_sdca.c @@ -13,7 +13,6 @@ #include #include #include -#include "sof_board_helpers.h" #include "sof_sdw_common.h" static const struct snd_soc_dapm_widget rt712_spk_widgets[] = { diff --git a/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c b/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c index 5253d8332780..fe59a144efef 100644 --- a/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c +++ b/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c @@ -15,7 +15,6 @@ #include #include #include -#include "sof_board_helpers.h" #include "sof_sdw_common.h" /* diff --git a/sound/soc/intel/boards/sof_ssp_common.h b/sound/soc/intel/boards/sof_ssp_common.h index d24888bc99fd..ff84154ce60a 100644 --- a/sound/soc/intel/boards/sof_ssp_common.h +++ b/sound/soc/intel/boards/sof_ssp_common.h @@ -68,13 +68,6 @@ enum sof_ssp_codec { enum sof_ssp_codec sof_ssp_detect_codec_type(struct device *dev); enum sof_ssp_codec sof_ssp_detect_amp_type(struct device *dev); -#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SOF_SSP_COMMON) const char *sof_ssp_get_codec_name(enum sof_ssp_codec codec_type); -#else -static inline const char *sof_ssp_get_codec_name(enum sof_ssp_codec codec_type) -{ - return NULL; -} -#endif #endif /* __SOF_SSP_COMMON_H */ From patchwork Tue Mar 26 16:04:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604576 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAA0413C916 for ; Tue, 26 Mar 2024 16:05:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469128; cv=none; b=J/tsiqAZ8RYPJMkR4l1Ut+djhAWFwPQ4n2bSmQsr1CKWmaqqjEJK8tEaYmBVLePeakW7DtNkVYDfZ5AIG04UlAFL0mf56S0zVVK0GE7clAaYhAhWr15UBbCWjg+Bie3n2wnpdWDfLscRWCzI7zgNvhR+34U2IeOiItjMsH0Je/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469128; c=relaxed/simple; bh=p4bcEeZvlLZOeW2O2yiVYCUk6wRlaf1Q9CsfKwwjbvA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gJczwpvmYzbK3uUe8Si2b9GRJqeE+5FmLgN/KQYhnqlN5mhAY7BH1fhcisTXUD2Ik1bpGGYIpnt2tWcAF1zHTGRmo4Nsj2cdMTgzFrP9z5VSutW7IU7+sLtb6MhzmgyGPHqz5/cJ4eCjBVxSMpFe3n8hp4NjMxZNuiC87KHUL1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mtIQ/Y8K; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mtIQ/Y8K" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469124; x=1743005124; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p4bcEeZvlLZOeW2O2yiVYCUk6wRlaf1Q9CsfKwwjbvA=; b=mtIQ/Y8KFDOw/ThOnh1ZXBaYvTUDt7mtLEwtVwHastHwGKKI3R+ZUdbb 5FxbQXQK39MPawizheRpiOu+LXYScg+2h6D+OUvPzCzOZ4kRob33izpN9 kFczpOZvWVwsr2NWlmgDU6DSwh+H4pZYrGInUMW6H/7Cy7sUPWU/geZTS aUgsYGPOiY+vr2CzzhI3KtUrUEW8LCWcGeOuymcgwueUpvy2SA3cOjxEy R5vyHcPxy4gHBX6hcVtUtPI8E4bwFa6yULSfmEP3jzTrBIyvJ4unEiwTM hHtw06jfleAT5PCApxaLF1mu9qWpQtQ/2etk6IKKFGSr3oWdYQLJM7PSX Q==; X-CSE-ConnectionGUID: 3Q+TillcSESUgtL1TAtboQ== X-CSE-MsgGUID: RpRaUyF0Sl22CywQWFSDkQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260367" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260367" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482180" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:46 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 07/34] ASoC: Intel: sof_sdw: Move flags to private struct Date: Tue, 26 Mar 2024 11:04:02 -0500 Message-Id: <20240326160429.13560-8-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Move the flags ignore_pch_dmic and append_dai_type into the drivers private structure rather than passing them around between functions. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 21 +++++++-------------- sound/soc/intel/boards/sof_sdw_common.h | 2 ++ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 45732884e310..5557db68a002 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1463,10 +1463,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, struct snd_soc_dai_link *dai_links, int sdw_be_num, const struct snd_soc_acpi_link_adr *adr_link, struct snd_soc_codec_conf **codec_conf, - int *be_id, bool *ignore_pch_dmic, - bool append_dai_type, - int adr_index, - int dai_index) + int *be_id, int adr_index, int dai_index) { struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct device *dev = card->dev; @@ -1549,8 +1546,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, if (!codec_info) return -EINVAL; - if (codec_info->ignore_pch_dmic) - *ignore_pch_dmic = true; + ctx->ignore_pch_dmic |= codec_info->ignore_pch_dmic; for_each_pcm_streams(stream) { char *name, *cpu_name; @@ -1572,7 +1568,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, } /* create stream name according to first link id */ - if (append_dai_type) { + if (ctx->append_dai_type) { name = devm_kasprintf(dev, GFP_KERNEL, sdw_stream_name[stream + 2], cpu_dai_id[0], type_strings[codec_info->dais[dai_index].dai_type]); @@ -1647,8 +1643,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) struct snd_soc_codec_conf *codec_conf; struct sof_sdw_codec_info *codec_info; struct sof_sdw_codec_info *ssp_info; - bool append_dai_type = false; - bool ignore_pch_dmic = false; int codec_conf_num = 0; bool group_generated[SDW_MAX_GROUPS] = { }; struct snd_soc_dai_link *dai_links; @@ -1732,7 +1726,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (!codec_info) return -EINVAL; if (codec_info->dai_num > 1) { - append_dai_type = true; + ctx->append_dai_type = true; goto out; } for (j = 0; j < i; j++) { @@ -1740,7 +1734,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) SDW_PART_ID(adr_link->adr_d[j].adr)) || (SDW_MFG_ID(adr_link->adr_d[i].adr) != SDW_MFG_ID(adr_link->adr_d[j].adr))) { - append_dai_type = true; + ctx->append_dai_type = true; goto out; } } @@ -1771,8 +1765,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) ret = create_sdw_dailink(card, &link_index, dai_links, sdw_be_num, adr_link, &codec_conf, ¤t_be_id, - &ignore_pch_dmic, - append_dai_type, i, j); + i, j); if (ret < 0) { dev_err(dev, "failed to create dai link %d\n", link_index); return ret; @@ -1825,7 +1818,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) DMIC: /* dmic */ if (dmic_num > 0) { - if (ignore_pch_dmic) { + if (ctx->ignore_pch_dmic) { dev_warn(dev, "Ignoring PCH DMIC\n"); goto HDMI; } diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index a04cbab9bc70..1daf98a5849f 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -103,6 +103,8 @@ struct mc_private { struct device *amp_dev1, *amp_dev2; /* To store SDW Pin index for each SoundWire link */ unsigned int sdw_pin_index[SDW_MAX_LINKS]; + bool append_dai_type; + bool ignore_pch_dmic; }; extern unsigned long sof_sdw_quirk; From patchwork Tue Mar 26 16:04:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604577 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A372713C8FC for ; Tue, 26 Mar 2024 16:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469129; cv=none; b=AEqW/Jb5SnH/P1UlKBNqlMbJkWGy6o6dvYF84aw7h/xBGUxDcHSJchuoS7+ouROHuuLd1tPz94sgvY6aNOzmVY4nYyZNAQ8XHCZJ7S/tzb4kfTDb/CLVmtEEbo7msdtO8A7LZI+yMPvJz4HNlQeGYJP0qQV9TALfjIb4RtsBBB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469129; c=relaxed/simple; bh=IC2RlwDvtxL8qrJSQldmoJ23HS9asJZ5NZo+X58uK6k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UYCynJ9pm4cXZM833MA/qZV3TGwEq2yrdNr8M4aA9Ao7AsDQfuCXlwGZTGlEWnx/o5WT3ir8wD5JnUzDXZb6KbrnQPGBbZMdbgoeR4U7XrGK3NSrWHSTvAgWV4SWdGKGta+5wSR/kz9moQa1NU0CjYeghjdnt9yYHCuc82S77c8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KofSkngc; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KofSkngc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469125; x=1743005125; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IC2RlwDvtxL8qrJSQldmoJ23HS9asJZ5NZo+X58uK6k=; b=KofSkngcvszzvhMe1Rjq4CWyan9HPMuqjziVn1wM0y0kamPN87Yi+Aw1 oJWglVaCjSzmaTv6ih+hmbhriYdpQA43JqBNiUO8t+jK9G+s+w3qIrLtf hxvrP1M4mThF+1ssCGYvK0AY7l3cFqXuRaveN/UKChDmbw22tarsxv/7R vi808mHToTUdwUCk51afD/KDkCjKqDREzKybkH/B4FKf85rQxXMx4jml/ a/Xz920TsBkMy0Xar5+XeqfPW4p5XyaLqd6K0fdp37nsdyiap+xwHI52g f2YxTf1GE7keAcp63cdg2plHt10w8+7WnEQoGpCQZ7knwfAexMSd/1i8W w==; X-CSE-ConnectionGUID: kMWGQL1mR7uWvufGkSxc+w== X-CSE-MsgGUID: +MoJgk5cQHeLKWQnKBXuwg== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260374" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260374" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482188" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:47 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 08/34] ASoC: Intel: sof_sdw: Only pass dai_link pointer around Date: Tue, 26 Mar 2024 11:04:03 -0500 Message-Id: <20240326160429.13560-9-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Rather than passing around a pointer to the dai_link array and an index into this array, simply pass a pointer to the current dai_link. Also move the DAI link pointer sanity check to the end of the DAI link creation, and change it to a warn on. This check should only be hit if there is a serious bug in the machine driver, so checking it on each iteration is excessive. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 62 +++++++++++++++----------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 5557db68a002..0ffa6e36dbed 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1459,8 +1459,8 @@ static int sof_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd) static const char * const type_strings[] = {"SimpleJack", "SmartAmp", "SmartMic"}; -static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, - struct snd_soc_dai_link *dai_links, int sdw_be_num, +static int create_sdw_dailink(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, const struct snd_soc_acpi_link_adr *adr_link, struct snd_soc_codec_conf **codec_conf, int *be_id, int adr_index, int dai_index) @@ -1597,35 +1597,28 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, cpus[k].dai_name = cpu_name; } - /* - * We create sdw dai links at first stage, so link index should - * not be larger than sdw_be_num - */ - if (*link_index >= sdw_be_num) { - dev_err(dev, "invalid dai link index %d\n", *link_index); - return -EINVAL; - } - playback = (stream == SNDRV_PCM_STREAM_PLAYBACK); capture = (stream == SNDRV_PCM_STREAM_CAPTURE); - init_dai_link(dev, dai_links + *link_index, be_id, name, - playback, capture, cpus, cpu_dai_num, codecs, codec_num, + init_dai_link(dev, *dai_links, be_id, name, playback, capture, + cpus, cpu_dai_num, codecs, codec_num, sof_sdw_rtd_init, &sdw_ops); /* * SoundWire DAILINKs use 'stream' functions and Bank Switch operations * based on wait_for_completion(), tag them as 'nonatomic'. */ - dai_links[*link_index].nonatomic = true; - dai_links[*link_index].ch_maps = sdw_codec_ch_maps; + (*dai_links)->nonatomic = true; + (*dai_links)->ch_maps = sdw_codec_ch_maps; - ret = set_codec_init_func(card, adr_link, dai_links + (*link_index)++, + ret = set_codec_init_func(card, adr_link, *dai_links, playback, group_id, adr_index, dai_index); if (ret < 0) { dev_err(dev, "failed to init codec 0x%x\n", codec_info->part_id); return ret; } + + (*dai_links)++; } return 0; @@ -1646,7 +1639,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) int codec_conf_num = 0; bool group_generated[SDW_MAX_GROUPS] = { }; struct snd_soc_dai_link *dai_links; - int num_links, link_index = 0; + int num_links; char *name, *cpu_dai_name; char *codec_name, *codec_dai_name; int i, j, be_id = 0; @@ -1703,6 +1696,8 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (!codec_conf) return -ENOMEM; + card->dai_link = dai_links; + card->num_links = num_links; card->codec_conf = codec_conf; card->num_configs = codec_conf_num; @@ -1762,12 +1757,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) for (j = 0; j < codec_info->dai_num ; j++) { int current_be_id; - ret = create_sdw_dailink(card, &link_index, dai_links, - sdw_be_num, adr_link, + ret = create_sdw_dailink(card, &dai_links, adr_link, &codec_conf, ¤t_be_id, i, j); if (ret < 0) { - dev_err(dev, "failed to create dai link %d\n", link_index); + dev_err(dev, + "failed to create dai link %d on 0x%x\n", + j, codec_info->part_id); return ret; } @@ -1800,19 +1796,18 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) playback = ssp_info->dais[0].direction[SNDRV_PCM_STREAM_PLAYBACK]; capture = ssp_info->dais[0].direction[SNDRV_PCM_STREAM_CAPTURE]; - ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name, + ret = init_simple_dai_link(dev, dai_links, &be_id, name, playback, capture, cpu_dai_name, codec_name, ssp_info->dais[0].dai_name, NULL, ssp_info->ops); if (ret) return ret; - ret = ssp_info->dais[0].init(card, NULL, dai_links + link_index, - ssp_info, 0); + ret = ssp_info->dais[0].init(card, NULL, dai_links, ssp_info, 0); if (ret < 0) return ret; - link_index++; + dai_links++; } DMIC: @@ -1823,16 +1818,16 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto HDMI; } - ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, "dmic01", + ret = init_simple_dai_link(dev, dai_links, &be_id, "dmic01", 0, 1, // DMIC only supports capture "DMIC01 Pin", "dmic-codec", "dmic-hifi", sof_sdw_dmic_init, NULL); if (ret) return ret; - link_index++; + dai_links++; - ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, "dmic16k", + ret = init_simple_dai_link(dev, dai_links, &be_id, "dmic16k", 0, 1, // DMIC only supports capture "DMIC16k Pin", "dmic-codec", "dmic-hifi", /* don't call sof_sdw_dmic_init() twice */ @@ -1840,7 +1835,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (ret) return ret; - link_index++; + dai_links++; } HDMI: @@ -1858,14 +1853,14 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) codec_dai_name = "snd-soc-dummy-dai"; } - ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name, + ret = init_simple_dai_link(dev, dai_links, &be_id, name, 1, 0, // HDMI only supports playback cpu_dai_name, codec_name, codec_dai_name, i == 0 ? sof_sdw_hdmi_init : NULL, NULL); if (ret) return ret; - link_index++; + dai_links++; } if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) { @@ -1875,15 +1870,16 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port); - ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name, + ret = init_simple_dai_link(dev, dai_links, &be_id, name, 1, 1, cpu_dai_name, snd_soc_dummy_dlc.name, snd_soc_dummy_dlc.dai_name, NULL, NULL); if (ret) return ret; + + dai_links++; } - card->dai_link = dai_links; - card->num_links = num_links; + WARN_ON(dai_links != card->dai_link + card->num_links); return 0; } From patchwork Tue Mar 26 16:04:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604575 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC48313C90A for ; Tue, 26 Mar 2024 16:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469127; cv=none; b=gRGrq/7kNynH1ojja2Rp93D5maf5l5HsnsLHRu42ailZ5K49XGp0hyvaGi5xoCdsPxat8uHgFGBBUTF7TtuJ4uDSQCGLJdLumRRkcKtINkUvzcmOA3KJGE4uhk8TurmNebRq8LaXRRDfq7tagwYhrFHN0zF08AQDvI7tO5BrMkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469127; c=relaxed/simple; bh=CqMw0hQCpoYpsInZ7ccCCDW4BJ6/9Rb+vQzek9KYCzw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OS94rGsKErjt9hxv6QltBW27ES8D1bGte0T0MlO3F/pn17h2j5BAFoEvoWxYgpx9yMWm+lxxR3/ZMBH/THBxs173/j1ycrRa/G68H1LKA5AyuheyqcDd+kfSPwCCh4/F5YsEPpQx6k+Lv11cyIgwbp9eRmSbqpuiBvdEGcDt13M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZiRbiDDj; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZiRbiDDj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469125; x=1743005125; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CqMw0hQCpoYpsInZ7ccCCDW4BJ6/9Rb+vQzek9KYCzw=; b=ZiRbiDDjZQ71mMW6yuAI6/3tdH4ypqPpoB9IGUMLab066c++VjFcFW/d B06odjB5/sFs6A2P5VnfpaawfgtPmYjmYNLien/Mo0Y9j36jVmi2arZnP 4b8JiCnXzJQE05WYT5u+324BZ6likosjq9svrf/AMILJVKWh3jzqR7nbh LJKKx3IHd/bM17qckKftsw0kKXCsmcAGNt/W1toBRJ6anhI4XNNv6GbT5 okQwYrMhqOLAFU6F1g7JFuMa+tzZ+WtUVbxF+JGOjagoHVcg1sXkji1qU /OUuBhUn81AfOSFHcBTPwzGrDanFtTp++y+50D2450YlEFvgUrwakwn2X Q==; X-CSE-ConnectionGUID: zPsk8okzTq2VeQHRiWm8bg== X-CSE-MsgGUID: 8kzTARrTTSmJ5qKxXQaXCQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260381" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260381" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482198" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:48 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 09/34] ASoC: Intel: sof_sdw: Use for_each_set_bit Date: Tue, 26 Mar 2024 11:04:04 -0500 Message-Id: <20240326160429.13560-10-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Rather than open coding a loop to process each bit use for_each_set_bit. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 0ffa6e36dbed..a12283d3e1cc 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -5,6 +5,7 @@ * sof_sdw - ASOC Machine driver for Intel SoundWire platforms */ +#include #include #include #include @@ -1644,7 +1645,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) char *codec_name, *codec_dai_name; int i, j, be_id = 0; int hdmi_num; - int ssp_mask; + unsigned long ssp_mask; int ret; ret = get_dailink_info(dev, adr_link, &sdw_be_num, &codec_conf_num); @@ -1782,12 +1783,10 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (!ssp_num) goto DMIC; - for (i = 0, j = 0; ssp_mask; i++, ssp_mask >>= 1) { + j = 0; + for_each_set_bit(i, &ssp_mask, BITS_PER_TYPE(ssp_mask)) { int playback, capture; - if (!(ssp_mask & 0x1)) - continue; - name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", i); cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", i); codec_name = devm_kasprintf(dev, GFP_KERNEL, "i2c-%s:0%d", From patchwork Tue Mar 26 16:04:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604580 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23D3513C8F5 for ; Tue, 26 Mar 2024 16:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469133; cv=none; b=j9bV9m42+FjApwl2Ymgi3ZIUqtm/2eGFqHvzfOPQA+oTjdR4Zu0Jy/u5OlhDOwSTaYk1h/ODgQNe43ebCrOYWfImCjmkdL98Ft3xvMJFpmcbBSPG2bzbQaKRaaV9salJzyaDZU+bSh88AuZWBlbT3UdrFjwxB+FNI/Koc6G2pPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469133; c=relaxed/simple; bh=BCGUnmel3nMig/J6x2o3QtQOnlesmw1kiPswkn4iK8o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Q3KJCfHgFOy/ounQbDCcAW8zRgVf236DuCGfW/x5/7sOKCcAD/CFaMmsgIQ+xN3S2KYM8m/ZS8pxUYo04OQcM58NsHGJc5Y6RLiNN196vnCA6ShXRIrhJzm6qaNe3SVCxh+HNjC6PAmS2bvkPnxdpvphcz9rPryfhkkg7jDo5Uo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NJQE4tsl; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NJQE4tsl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469127; x=1743005127; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BCGUnmel3nMig/J6x2o3QtQOnlesmw1kiPswkn4iK8o=; b=NJQE4tsl99PGxZPlUa6YXp2DGf+iKXdRjWpqbYkoznOe6mE5mjhgm9AE W3DhCstgWoVI980LATQh1pahh6PteAZnSHCyzjk/NJGx4LnL9YiFVwRTQ tFmt625in5zwmERU/9mXAaCefnWPz1qOlOfmreJLk/OC44D1ajFZOFIpd d9tXJ9HUxB9xi1rtqe6qhZ74p1pH4vTyx7LdOdYZJxrocgZHT1BgJRYeX jODkTlMQtqPdmEkRGHtPRHofJgDpJUkbsC0v0hdBDibtgQuRIc+U9jBzl 3KRo50tJuZjstMK1HwNn1t5A35Zq0hwuDP+VLhtMl2GSqXWGNrxOb0yje g==; X-CSE-ConnectionGUID: 7idMwA+7S9iIJDRMl2S2mA== X-CSE-MsgGUID: bqd1vU4ZSMe82ke5VlK+xQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260388" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260388" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482209" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:49 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 10/34] ASoC: Intel: sof_sdw: Factor out SSP DAI creation Date: Tue, 26 Mar 2024 11:04:05 -0500 Message-Id: <20240326160429.13560-11-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Factor out the creation of the SSP DAI links into a helper function. No functional change. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 63 +++++++++++++++++++------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index a12283d3e1cc..9980652c901b 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1625,6 +1625,40 @@ static int create_sdw_dailink(struct snd_soc_card *card, return 0; } +static int create_ssp_dailinks(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, int *be_id, + struct sof_sdw_codec_info *ssp_info, + unsigned long ssp_mask) +{ + struct device *dev = card->dev; + int i, j = 0; + int ret; + + for_each_set_bit(i, &ssp_mask, BITS_PER_TYPE(ssp_mask)) { + char *name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", i); + char *cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", i); + char *codec_name = devm_kasprintf(dev, GFP_KERNEL, "i2c-%s:0%d", + ssp_info->acpi_id, j++); + int playback = ssp_info->dais[0].direction[SNDRV_PCM_STREAM_PLAYBACK]; + int capture = ssp_info->dais[0].direction[SNDRV_PCM_STREAM_CAPTURE]; + + ret = init_simple_dai_link(dev, *dai_links, be_id, name, + playback, capture, cpu_dai_name, + codec_name, ssp_info->dais[0].dai_name, + NULL, ssp_info->ops); + if (ret) + return ret; + + ret = ssp_info->dais[0].init(card, NULL, *dai_links, ssp_info, 0); + if (ret < 0) + return ret; + + (*dai_links)++; + } + + return 0; +} + static int sof_card_dai_links_create(struct snd_soc_card *card) { struct device *dev = card->dev; @@ -1780,36 +1814,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) SSP: /* SSP */ - if (!ssp_num) - goto DMIC; - - j = 0; - for_each_set_bit(i, &ssp_mask, BITS_PER_TYPE(ssp_mask)) { - int playback, capture; - - name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", i); - cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", i); - codec_name = devm_kasprintf(dev, GFP_KERNEL, "i2c-%s:0%d", - ssp_info->acpi_id, j++); - - playback = ssp_info->dais[0].direction[SNDRV_PCM_STREAM_PLAYBACK]; - capture = ssp_info->dais[0].direction[SNDRV_PCM_STREAM_CAPTURE]; - - ret = init_simple_dai_link(dev, dai_links, &be_id, name, - playback, capture, cpu_dai_name, - codec_name, ssp_info->dais[0].dai_name, - NULL, ssp_info->ops); + if (ssp_num) { + ret = create_ssp_dailinks(card, &dai_links, &be_id, + ssp_info, ssp_mask); if (ret) return ret; - - ret = ssp_info->dais[0].init(card, NULL, dai_links, ssp_info, 0); - if (ret < 0) - return ret; - - dai_links++; } -DMIC: /* dmic */ if (dmic_num > 0) { if (ctx->ignore_pch_dmic) { From patchwork Tue Mar 26 16:04:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604581 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F39D113C90D for ; Tue, 26 Mar 2024 16:05:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469132; cv=none; b=ZK3r+NB+8APQ0Xe0K9pASaZHaD3tkrwkx1rEJbqnR+DZE4MnNYtvDG0xH17HXO1PDRlUCeargd64bP3d9VdLW9iPg3JBZb+xJSqU0LWMBmJhF0H2ZlyJVSferFE7voeDRx/jVHJmxvXWhh5zXNWlNzpxko2U1gyNSahqFIKROlY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469132; c=relaxed/simple; bh=+RqUgqGIVdP7peYMwm0LbrXLh8sPQbx6LB6mT/cLrZQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pExTKrkXX1XTUY5vSnhuz8VgVV7OLgCiaCVKfaA2kopXrYnwmPs1yT3Q4quBp+WNXUm7ng2/zLttTgrwfcDE72H/tkVKrYMT2SQRcs3E8/gVtUVaqydOo0o7EJwwmBYqe3Pl29Ok3JebJULrvUn6P8WeattVPg2FWGIlD+xmkkY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UVhy2bnP; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UVhy2bnP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469128; x=1743005128; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+RqUgqGIVdP7peYMwm0LbrXLh8sPQbx6LB6mT/cLrZQ=; b=UVhy2bnPPOq1KV6bwXygZONvy6FL2qc9g4MpQk5SP3bkYHke5EPYx8Rr qjbWr946Db4z4laWiHUowOcB3ZprrJUVAelau8JAgDSFPWEZ7R8KkHUH+ juqzEUBqbUx2dqM0VAXijqC9SNQPyzVyikwGTQ33ttG0mDqbuDM6tofNu b3h3Z5PDC4QgxjDSUBIsi4SDtJSou9tWEUyqdBbUuY5Q0d9jYetXBpUX+ 5NlnWkpEnR3q3SJlsqS2z9oFfROFoW8TerKx9Vd3X9ayB0nr52bDm+kAZ ajiSVu6XDeyKKffuTkMeKDtIiWjM1UDzZIuE98pqQwOXpxKckUzEvH83j Q==; X-CSE-ConnectionGUID: DlMM9ZM4QF2C4lXJEUDCqA== X-CSE-MsgGUID: lJK54WBnSb6eM5tMnlzWPQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260396" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260396" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482218" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:49 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 11/34] ASoC: Intel: sof_sdw: Factor out DMIC DAI creation. Date: Tue, 26 Mar 2024 11:04:06 -0500 Message-Id: <20240326160429.13560-12-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Factor out the creation of the DMIC DAI links into a helper function. No functional change. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 53 +++++++++++++++++++------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 9980652c901b..5571c9e85dd7 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1659,6 +1659,34 @@ static int create_ssp_dailinks(struct snd_soc_card *card, return 0; } +static int create_dmic_dailinks(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, int *be_id) +{ + struct device *dev = card->dev; + int ret; + + ret = init_simple_dai_link(dev, *dai_links, be_id, "dmic01", + 0, 1, // DMIC only supports capture + "DMIC01 Pin", "dmic-codec", "dmic-hifi", + sof_sdw_dmic_init, NULL); + if (ret) + return ret; + + (*dai_links)++; + + ret = init_simple_dai_link(dev, *dai_links, be_id, "dmic16k", + 0, 1, // DMIC only supports capture + "DMIC16k Pin", "dmic-codec", "dmic-hifi", + /* don't call sof_sdw_dmic_init() twice */ + NULL, NULL); + if (ret) + return ret; + + (*dai_links)++; + + return 0; +} + static int sof_card_dai_links_create(struct snd_soc_card *card) { struct device *dev = card->dev; @@ -1825,30 +1853,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (dmic_num > 0) { if (ctx->ignore_pch_dmic) { dev_warn(dev, "Ignoring PCH DMIC\n"); - goto HDMI; + } else { + ret = create_dmic_dailinks(card, &dai_links, &be_id); + if (ret) + return ret; } - - ret = init_simple_dai_link(dev, dai_links, &be_id, "dmic01", - 0, 1, // DMIC only supports capture - "DMIC01 Pin", "dmic-codec", "dmic-hifi", - sof_sdw_dmic_init, NULL); - if (ret) - return ret; - - dai_links++; - - ret = init_simple_dai_link(dev, dai_links, &be_id, "dmic16k", - 0, 1, // DMIC only supports capture - "DMIC16k Pin", "dmic-codec", "dmic-hifi", - /* don't call sof_sdw_dmic_init() twice */ - NULL, NULL); - if (ret) - return ret; - - dai_links++; } -HDMI: /* HDMI */ for (i = 0; i < hdmi_num; i++) { name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d", i + 1); From patchwork Tue Mar 26 16:04:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604579 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BECBE13C8F9 for ; Tue, 26 Mar 2024 16:05:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469132; cv=none; b=eu0fYULxS6zeI9Mt0SJY8quapIuxlgZO0qF2SEBhwW3pcC5Q7/xXpk+wD7NN2qsY/HPqk2erwyfyqZs8pLaiDWf6TtI5haoqysMk54r4ABUDWEisAFqcmaYpx6RCQ087fow9deBiQsr6Tvj7samMAgB9NYsGZKa3szDaf+eB2zE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469132; c=relaxed/simple; bh=bdB/FytdahnLxveJ+wKWW/oBK+jrUjYb5O+XidYfLS0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AGOW2mUMEzqTugUWRYfktpbDWf/ym8/4kz6ytmoaVik8VUPnBQxbEMDCKp2/YzJfoU8KehfWjBXK9yDQ0FFwY7d+8gWmYZUTUnNWkb0H4KGcCFRdv37NI/5rNDA6ZmFyZUFo/7HEI0OnFhJymCnHPc18+9dpO2KGdEqMHn32QFM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Pu+rh1sV; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Pu+rh1sV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469129; x=1743005129; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bdB/FytdahnLxveJ+wKWW/oBK+jrUjYb5O+XidYfLS0=; b=Pu+rh1sVtL5+8KXEihbxgSXfZYJN84wYC1szrN8s8oZxYs25W9vrw/cn RuAgQgkQPfXDR+pLPNBgxSSnc/L4wLpjLwdt/TBnMzH7W6cn/+n+plin/ XP0zE2+uC7nvVj3LsSx8uzL/bdur2LuaqRqHFjBvSMvZ+PNdTr/1pEcwN nvGUkrhJLBIEIabIbfdariOBQV17Y2/H2llb6i90DD97kuz1XH0nUa0aT 4yIeui2AbWUWbmE2xvo7GDyXyzdyR/BIwH2megVdOHlcUty5B3Y68Szp3 k3Jriqi/+KqcX64jBMUGTtHknKsMd60I5J22hDhwq88RB9CLbgf8+lgdt g==; X-CSE-ConnectionGUID: Irjv2TbgRvum0Em+HyirOA== X-CSE-MsgGUID: u4dMMfc9S4232rEdaKXE/g== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260404" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260404" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482224" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:50 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 12/34] ASoC: Intel: sof_sdw: Factor out HDMI DAI creation Date: Tue, 26 Mar 2024 11:04:07 -0500 Message-Id: <20240326160429.13560-13-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Factor out the creation of the HDMI DAI links into a helper function. No functional change. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 61 ++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 5571c9e85dd7..7dc3559bf988 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1687,6 +1687,41 @@ static int create_dmic_dailinks(struct snd_soc_card *card, return 0; } +static int create_hdmi_dailinks(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, int *be_id, + int hdmi_num) +{ + struct device *dev = card->dev; + struct mc_private *ctx = snd_soc_card_get_drvdata(card); + int i, ret; + + for (i = 0; i < hdmi_num; i++) { + char *name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d", i + 1); + char *cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d Pin", i + 1); + char *codec_name, *codec_dai_name; + + if (ctx->hdmi.idisp_codec) { + codec_name = "ehdaudio0D2"; + codec_dai_name = devm_kasprintf(dev, GFP_KERNEL, + "intel-hdmi-hifi%d", i + 1); + } else { + codec_name = "snd-soc-dummy"; + codec_dai_name = "snd-soc-dummy-dai"; + } + + ret = init_simple_dai_link(dev, *dai_links, be_id, name, + 1, 0, // HDMI only supports playback + cpu_dai_name, codec_name, codec_dai_name, + i == 0 ? sof_sdw_hdmi_init : NULL, NULL); + if (ret) + return ret; + + (*dai_links)++; + } + + return 0; +} + static int sof_card_dai_links_create(struct snd_soc_card *card) { struct device *dev = card->dev; @@ -1704,7 +1739,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) struct snd_soc_dai_link *dai_links; int num_links; char *name, *cpu_dai_name; - char *codec_name, *codec_dai_name; int i, j, be_id = 0; int hdmi_num; unsigned long ssp_mask; @@ -1861,28 +1895,9 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) } /* HDMI */ - for (i = 0; i < hdmi_num; i++) { - name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d", i + 1); - cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d Pin", i + 1); - - if (ctx->hdmi.idisp_codec) { - codec_name = "ehdaudio0D2"; - codec_dai_name = devm_kasprintf(dev, GFP_KERNEL, - "intel-hdmi-hifi%d", i + 1); - } else { - codec_name = "snd-soc-dummy"; - codec_dai_name = "snd-soc-dummy-dai"; - } - - ret = init_simple_dai_link(dev, dai_links, &be_id, name, - 1, 0, // HDMI only supports playback - cpu_dai_name, codec_name, codec_dai_name, - i == 0 ? sof_sdw_hdmi_init : NULL, NULL); - if (ret) - return ret; - - dai_links++; - } + ret = create_hdmi_dailinks(card, &dai_links, &be_id, hdmi_num); + if (ret) + return ret; if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) { int port = (sof_sdw_quirk & SOF_BT_OFFLOAD_SSP_MASK) >> From patchwork Tue Mar 26 16:04:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604578 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67EF713C8FC for ; Tue, 26 Mar 2024 16:05:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469131; cv=none; b=gz5OhAI08thVvFS23m9svJFOKlPyhgd1fxoZy+V1ox4kAlZGFA9ViInQNfprJvOXSbx4TkzMnQtcuNI9Aye5CdTOeNzht7i516V5a3RTYbG81ataMyKRGqIKKYtOG/Zno6xNr2Tm9WJBA+GYMJ2yZqQBnj0l728o5Ss0iwaUU3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469131; c=relaxed/simple; bh=cl79tFpLx86aSOuqh9+F1+bk9CD5uzAwzEa9y9oGOjg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Cu8ChuEblhbwvQIEwltltnUYz3m90L2gZhc3MSIDjNEjf0StZRjepbukjQrHP0CcPWbUVNwqe7S7Zf0iVztJ9MxK/HPLj1Xz4BYUvq7nFWtqBIeZ05qMIzH6Vg4g3vDT9OlUtyQ2IfLxYP1J/KDj4LVosyZ1fe9zCBx42Eu8+c0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=e534tae+; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="e534tae+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469129; x=1743005129; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cl79tFpLx86aSOuqh9+F1+bk9CD5uzAwzEa9y9oGOjg=; b=e534tae+YYTTG0znGAN0pk46ArKfC68nxVLkdqnztUJ+3n2NjuWNGkbf aRxBPwnwXX/Ttzb/sMgj409fe/m1PlwjldOdSoQ3/4o6m0bKOqSoR2sK9 e0qpgRVoFtN+g+dj0bxf/F9p9mCFAl2lurOfqbNmb5CNC6ecUmiXdSKuD 1uZ5T3trcpBMwjb75n++8b5zGD+d1HEwTs5MKigmJP9Wvcm0eN5/tKEv1 qsvkVC7QqWKkc8hVuX5pIO3EzsgJUAHhCZDablYvFxRdSxlFIcdyM7xrx 1TZO8CVXWLS2fX7J5Oapplh14pnTiwJfsYCp6tr+/EhwziXVc/9EyfK1P g==; X-CSE-ConnectionGUID: AFcd+wVrRD2wWhsZU+UpjA== X-CSE-MsgGUID: hf8I8YGASnWHbo4dENxnaQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260412" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260412" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482234" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:51 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 13/34] ASoC: Intel: sof_sdw: Factor out BlueTooth DAI creation Date: Tue, 26 Mar 2024 11:04:08 -0500 Message-Id: <20240326160429.13560-14-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Factor out the creation of the BlueTooth DAI links into a helper function. No functional change. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 35 +++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 7dc3559bf988..6e2e934e1246 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1722,6 +1722,27 @@ static int create_hdmi_dailinks(struct snd_soc_card *card, return 0; } +static int create_bt_dailinks(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, int *be_id) +{ + struct device *dev = card->dev; + int port = (sof_sdw_quirk & SOF_BT_OFFLOAD_SSP_MASK) >> + SOF_BT_OFFLOAD_SSP_SHIFT; + char *name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); + char *cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port); + int ret; + + ret = init_simple_dai_link(dev, *dai_links, be_id, name, + 1, 1, cpu_dai_name, snd_soc_dummy_dlc.name, + snd_soc_dummy_dlc.dai_name, NULL, NULL); + if (ret) + return ret; + + (*dai_links)++; + + return 0; +} + static int sof_card_dai_links_create(struct snd_soc_card *card) { struct device *dev = card->dev; @@ -1738,7 +1759,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) bool group_generated[SDW_MAX_GROUPS] = { }; struct snd_soc_dai_link *dai_links; int num_links; - char *name, *cpu_dai_name; int i, j, be_id = 0; int hdmi_num; unsigned long ssp_mask; @@ -1899,20 +1919,11 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (ret) return ret; + /* BT */ if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) { - int port = (sof_sdw_quirk & SOF_BT_OFFLOAD_SSP_MASK) >> - SOF_BT_OFFLOAD_SSP_SHIFT; - - name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); - cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port); - - ret = init_simple_dai_link(dev, dai_links, &be_id, name, - 1, 1, cpu_dai_name, snd_soc_dummy_dlc.name, - snd_soc_dummy_dlc.dai_name, NULL, NULL); + ret = create_bt_dailinks(card, &dai_links, &be_id); if (ret) return ret; - - dai_links++; } WARN_ON(dai_links != card->dai_link + card->num_links); From patchwork Tue Mar 26 16:04:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604582 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75C3A13C908 for ; Tue, 26 Mar 2024 16:05:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469134; cv=none; b=QV53aUF4wBgIEMYzGCH9tp9JXskE3+EXTRPZlArJQjHMMeKjShZUKAR4QsKKK+UnjaKA7Bc2QKcmLp/3FOKtpAhjE+p/lwkUD0xSKWEtmqXPAwrn6M2TcfLW8Kal5zNerBVjvM9mfo7rPCxy97cjH6nJ/6RRCfQsGkmjwDbNYZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469134; c=relaxed/simple; bh=dKIIrBR+5IlIW8PfUvHWuroIi9TvHZfaA9fL/TlXcjE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KwcDQrg6I7EZLZVJWB+Q+4cd7SIWc4L2DztWRrr0eobwEPPZFd880DLJcMu4uifSrrosT0zTauAaLDRVtYqt1uQEGTuifY5NttLeKwnU5R3CSim8OqfJr1wpnJyQ7tNyJGGBWVasY6uupBWP7RPMSiNZwMV12yVdVfC3oNSqoHE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cZjvc1lP; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cZjvc1lP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469133; x=1743005133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dKIIrBR+5IlIW8PfUvHWuroIi9TvHZfaA9fL/TlXcjE=; b=cZjvc1lP7sdEyHaZmuWrBuKvEnNlYL+AMRkU600CLjgtBrPDYtGJXJ22 fvDozWjYIBm5zr0Y0Tj1LvDX0lCVq2BYkARUGKDnxPOg77ZCf21/atMLd ++U2s3zhZxWFxwc0Gqve19zQpvn4+1ersFZfU+aTWRk8wOrJq1kR6q8oj eh7dP6D53+hBxzOTc8tC+fGAe8/jEagI1otPDiEXsr4V2NOzjAcdYNPJl 5drfUQst32kV7oz/foOtcZ60djfiaCozI6ABm/Z9JU2IU13fK5PAiQWNn 3hkzNojEyf0M8waOMz6JhkuD9vU2r1pGfI4TxY45Tbk9MGe82v2062xP4 Q==; X-CSE-ConnectionGUID: fpZIO6jMQUiE1+Tb5L3OXw== X-CSE-MsgGUID: QPBOY1G2SG+GLwBGwg+zYg== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260419" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260419" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482244" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:51 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 14/34] ASoC: Intel: sof_sdw: Factor out codec name generation Date: Tue, 26 Mar 2024 11:04:09 -0500 Message-Id: <20240326160429.13560-15-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax In preparation for future refactoring pull out a helper specifically for generating the codec name. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 47 ++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 6e2e934e1246..1253a2dc33d2 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1283,12 +1283,37 @@ static bool is_unique_device(const struct snd_soc_acpi_link_adr *adr_link, return true; } +static const char *get_codec_name(struct device *dev, + const struct sof_sdw_codec_info *codec_info, + const struct snd_soc_acpi_link_adr *adr_link, + int adr_index) +{ + u64 adr = adr_link->adr_d[adr_index].adr; + unsigned int sdw_version = SDW_VERSION(adr); + unsigned int link_id = SDW_DISCO_LINK_ID(adr); + unsigned int unique_id = SDW_UNIQUE_ID(adr); + unsigned int mfg_id = SDW_MFG_ID(adr); + unsigned int part_id = SDW_PART_ID(adr); + unsigned int class_id = SDW_CLASS_ID(adr); + + if (codec_info->codec_name) + return devm_kstrdup(dev, codec_info->codec_name, GFP_KERNEL); + else if (is_unique_device(adr_link, sdw_version, mfg_id, part_id, + class_id, adr_index)) + return devm_kasprintf(dev, GFP_KERNEL, "sdw:0:%01x:%04x:%04x:%02x", + link_id, mfg_id, part_id, class_id); + else + return devm_kasprintf(dev, GFP_KERNEL, "sdw:0:%01x:%04x:%04x:%02x:%01x", + link_id, mfg_id, part_id, class_id, unique_id); + + return NULL; +} + static int fill_sdw_codec_dlc(struct device *dev, const struct snd_soc_acpi_link_adr *adr_link, struct snd_soc_dai_link_component *codec, int adr_index, int dai_index) { - unsigned int sdw_version, unique_id, mfg_id, link_id, part_id, class_id; u64 adr = adr_link->adr_d[adr_index].adr; struct sof_sdw_codec_info *codec_info; @@ -1296,25 +1321,7 @@ static int fill_sdw_codec_dlc(struct device *dev, if (!codec_info) return -EINVAL; - sdw_version = SDW_VERSION(adr); - link_id = SDW_DISCO_LINK_ID(adr); - unique_id = SDW_UNIQUE_ID(adr); - mfg_id = SDW_MFG_ID(adr); - part_id = SDW_PART_ID(adr); - class_id = SDW_CLASS_ID(adr); - - if (codec_info->codec_name) - codec->name = devm_kstrdup(dev, codec_info->codec_name, GFP_KERNEL); - else if (is_unique_device(adr_link, sdw_version, mfg_id, part_id, - class_id, adr_index)) - codec->name = devm_kasprintf(dev, GFP_KERNEL, - "sdw:0:%01x:%04x:%04x:%02x", link_id, - mfg_id, part_id, class_id); - else - codec->name = devm_kasprintf(dev, GFP_KERNEL, - "sdw:0:%01x:%04x:%04x:%02x:%01x", link_id, - mfg_id, part_id, class_id, unique_id); - + codec->name = get_codec_name(dev, codec_info, adr_link, adr_index); if (!codec->name) return -ENOMEM; From patchwork Tue Mar 26 16:04:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604584 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9922D13C9A9 for ; Tue, 26 Mar 2024 16:05:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469135; cv=none; b=YAQuNJKa/wztdxKc2n3t5mtNa0MSyul3o/p+PyK3Kg+VXmto2wPgSOzgzByvVGBg2GLHZVhORLC4dC19zUsn5O4S/wrQzeIXa8a8EhtN2tcII7d2WDf9N6DRo5tsCoearT4iwCs3JkDqBVbULeLLZhMF8YvkAIi1YKkNqmhDxPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469135; c=relaxed/simple; bh=NdCG1hXCdJ2Yk3G4mstPgE3sClduDXEn2se54Xajods=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=i8bWpl9m1OCGzKcy48EPWBcDlzzNpVuJ/BLS9IJAbxYSLesdfGHKOyFGMmb+lhblw5tkgz6T0WaqAYK6OR+SwCPmJKFQZZQZ4B7/+59SsiWlkO0KKRe77F1AE2m2t6lpETVuBrflnqABjL4tzItWCouhPKK0a0TGJEv1njSSffE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MJ8OvZrN; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MJ8OvZrN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469133; x=1743005133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NdCG1hXCdJ2Yk3G4mstPgE3sClduDXEn2se54Xajods=; b=MJ8OvZrNCiiBDqYexN8vkpbZQXTN+uNZ0HP5JS2c9ZjmemXhZj9oYeqm TR/eFx0V3EqgUhjbJQL5xBtk0TpxmhIOEaqwamRP50bNDZXtu9QbJABPP FVWI4ZYX4sf8K3AGl51+Sf1JBchIj+Ria1uNqPnMW0ymGLfIT7FCaxcU/ 8sxRulou/yc12G8aE+aD9ro1T/E46wh7gQDJ5ZWGAcSulDqLzh/1RFxAi wkeLjzN2u8wQuzHnK3SOuTmdIZjhSSvqjzVfVepvLm4ijk/OvxlP8/jM5 O30RTKFbBXxjv8XQnrZ6K9UGPzpiNYAvVcib33d9a6t5kp77AJm2GJPmc g==; X-CSE-ConnectionGUID: +i9HqUrtTX2xKkQFApLXSw== X-CSE-MsgGUID: QY1bFc9mQW2A7MgQPnIMiw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260426" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260426" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482274" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:52 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Balamurugan C , Chao Song , Pierre-Louis Bossart Subject: [PATCH 15/34] ASoC: Intel: soc-acpi-intel-arl-match: Add rt711 sdca codec support Date: Tue, 26 Mar 2024 11:04:10 -0500 Message-Id: <20240326160429.13560-16-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Balamurugan C Adding rt711 sdca codec support for arl boards. Reviewed-by: Bard Liao Reviewed-by: Chao Song Signed-off-by: Balamurugan C Signed-off-by: Pierre-Louis Bossart --- .../intel/common/soc-acpi-intel-arl-match.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sound/soc/intel/common/soc-acpi-intel-arl-match.c b/sound/soc/intel/common/soc-acpi-intel-arl-match.c index e52797aae6e6..79d26e0f2c28 100644 --- a/sound/soc/intel/common/soc-acpi-intel-arl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-arl-match.c @@ -24,6 +24,15 @@ static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { } }; +static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { + { + .adr = 0x000030025D071101ull, + .num_endpoints = 1, + .endpoints = &single_endpoint, + .name_prefix = "rt711" + } +}; + static const struct snd_soc_acpi_link_adr arl_rvp[] = { { .mask = BIT(0), @@ -33,6 +42,15 @@ static const struct snd_soc_acpi_link_adr arl_rvp[] = { {} }; +static const struct snd_soc_acpi_link_adr arl_sdca_rvp[] = { + { + .mask = BIT(0), + .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), + .adr_d = rt711_sdca_0_adr, + }, + {} +}; + struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_machines[] = { {}, }; @@ -46,6 +64,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = { .drv_name = "sof_sdw", .sof_tplg_filename = "sof-arl-rt711.tplg", }, + { + .link_mask = 0x1, /* link0 required */ + .links = arl_sdca_rvp, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-arl-rt711-l0.tplg", + }, {}, }; EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_arl_sdw_machines); From patchwork Tue Mar 26 16:04:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604585 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 991E413C91B for ; Tue, 26 Mar 2024 16:05:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469135; cv=none; b=hbuwEhU0nXsAkZvWWVuXSLZY/FgPpcaY2z0wYEihkLCfBSIBA3ZMnSzevB+IHSfmlrkwp7kzr3IfXg0QikfS69RBjptgPxZyRgxzPvXLNRgxVAy+5I2I2jLm6RGhSLOufdw5ReBhxrOV/WHMTdZ/yPqLFqCz+apTi+NOcYT1L3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469135; c=relaxed/simple; bh=fQwkz9pcHM4JWHddRqJbn3Gbw0hCIVSlITvF7FgBPpY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Jl8HrrOu2Mrqja8HDsCs22Gbe1iV4EIvVletbQYC4OdoUfNQpvMe1NqmWORmWK5jAPLqKpPo5jHaqWtvG4U1bDTICXhfECLSBNaqYcmb9i/P/5un1/52EwoHqrVa+EmI303NTr0O3BQgGcGOWJGdL81jZ+igo7vTt46VTF0jcLw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KwmhZVBD; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KwmhZVBD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469133; x=1743005133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fQwkz9pcHM4JWHddRqJbn3Gbw0hCIVSlITvF7FgBPpY=; b=KwmhZVBDd7T0DEXz/w82gMcBTl6uVd6wzdjEaehtaI/4M0MSfsDBiHmW eM7OqAOL5n3ukw43XnVj+sOtvfrz7vIo2Pb9Xc+qaaIzFGfHnM1hyNovf AgMgDrzH9iu9tvop903H/6HPNvASVhiLQ7ktdwquR0pkfbEHJNgaDuydo EN1jCjH8o9IeEIK5Mi8i0ArskIesYqUeuuRdqShA+vR33I6MgfFMOmhch sPEfxTtrVcOkj4U2TE4rUIMljoBvDRDuy+mCLQZCeMTz9CbIRaEFAVmfh FcaxZVmoekGUxLMGl18NRFg5ZR+W8x5Ui0u3HZj/FNLgK6MSyAKF8FjaF w==; X-CSE-ConnectionGUID: fodRgD+7RnG8EbUbkCbDOw== X-CSE-MsgGUID: rY721kTIT4uwH/yXfh4fVA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260436" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260436" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482275" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:53 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 16/34] ASoC: Intel: sof_sdw: Remove no longer supported quirk Date: Tue, 26 Mar 2024 11:04:11 -0500 Message-Id: <20240326160429.13560-17-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax The SOF_SDW_NO_AGGREGATION quirk is mostly for debug and no longer works correctly with the current state of the machine driver. Remove it from the code and add an error message if someone uses it. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 12 ++++-------- sound/soc/intel/boards/sof_sdw_common.h | 1 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 1253a2dc33d2..fdedc32291f0 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -36,7 +36,7 @@ static void log_quirks(struct device *dev) dev_dbg(dev, "SSP port %ld\n", SOF_SSP_GET_PORT(sof_sdw_quirk)); if (sof_sdw_quirk & SOF_SDW_NO_AGGREGATION) - dev_dbg(dev, "quirk SOF_SDW_NO_AGGREGATION enabled\n"); + dev_err(dev, "quirk SOF_SDW_NO_AGGREGATION enabled but no longer supported\n"); } static int sof_sdw_quirk_cb(const struct dmi_system_id *id) @@ -1136,11 +1136,9 @@ static int get_dailink_info(struct device *dev, int *sdw_be_num, int *codecs_num) { bool group_visited[SDW_MAX_GROUPS]; - bool no_aggregation; int i; int j; - no_aggregation = sof_sdw_quirk & SOF_SDW_NO_AGGREGATION; *sdw_be_num = 0; if (!adr_link) @@ -1187,7 +1185,7 @@ static int get_dailink_info(struct device *dev, continue; /* count BE for each non-aggregated slave or group */ - if (!endpoint->aggregated || no_aggregation || + if (!endpoint->aggregated || !group_visited[endpoint->group_id]) (*sdw_be_num)++; } @@ -1393,10 +1391,9 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, int *codec_num, unsigned int *group_id, int adr_index) { - bool no_aggregation = sof_sdw_quirk & SOF_SDW_NO_AGGREGATION; int i; - if (!adr_link->adr_d[adr_index].endpoints->aggregated || no_aggregation) { + if (!adr_link->adr_d[adr_index].endpoints->aggregated) { cpu_dai_id[0] = ffs(adr_link->mask) - 1; *cpu_dai_num = 1; *codec_num = 1; @@ -1758,7 +1755,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; const struct snd_soc_acpi_link_adr *adr_link = mach_params->links; - bool aggregation = !(sof_sdw_quirk & SOF_SDW_NO_AGGREGATION); struct snd_soc_codec_conf *codec_conf; struct sof_sdw_codec_info *codec_info; struct sof_sdw_codec_info *ssp_info; @@ -1896,7 +1892,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) be_id = current_be_id; } - if (aggregation && endpoint->aggregated) + if (endpoint->aggregated) group_generated[endpoint->group_id] = true; } } diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 1daf98a5849f..e21ef79126b2 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -50,6 +50,7 @@ enum { #define SOF_SDW_PCH_DMIC BIT(6) #define SOF_SSP_PORT(x) (((x) & GENMASK(5, 0)) << 7) #define SOF_SSP_GET_PORT(quirk) (((quirk) >> 7) & GENMASK(5, 0)) +/* Deprecated and no longer supported by the code */ #define SOF_SDW_NO_AGGREGATION BIT(14) /* BT audio offload: reserve 3 bits for future */ From patchwork Tue Mar 26 16:04:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604583 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FE9413C9B0 for ; Tue, 26 Mar 2024 16:05:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469135; cv=none; b=WJirXSpeVM3VKTC2I8M4rOO9dPgq84HB1p7URRpLbmLnz2LQRp7UgMsg4Sw7JzRHvwHKxUCT/h0IR6NhLDTlyO8DtVvK/AbzsNeUOZ/V4TPQK7UZL4hBS+KS/th+hWej/BaAqV361ZUKBEYaxlBYA5uPR3zI7l2VoAXuCiuJ650= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469135; c=relaxed/simple; bh=sTf7iewjShTLIpZ76HtMb1ZNJ2Egbdu079zsrWu6ef0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PYpG3aeYWCE2RSPf5dz4xgVN/J3KZGN6bEJg3TXImYkJF7MIqAQJwQArJM/3mA43csBAPI10QyU9VfxpHS5NAqa8eQLiuMmiZP/6ui5UQQ9zT/1ujUGVGYmmZoazMDsrRDo+afFxKc1Tb6bidGf0mhl6CjXpWwUKfO0Wo8urcfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kxENwxrv; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kxENwxrv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469134; x=1743005134; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sTf7iewjShTLIpZ76HtMb1ZNJ2Egbdu079zsrWu6ef0=; b=kxENwxrvq65VPmiwJMzMemX+ErB+v8PWsihrbd8HIy1Q/pc9oOHKhPnq BQ0Oc8eu359UY/ro/mioUjT3/ZvXPAr1Nzsic92zNqXqwaFEnJ/TMpnz5 lpCWyyr6t5Y6Rrs3XGnoWkWOSgzGKb9geSQiWGJe8qcILfi784MP4q9IV 1yB379d0upxZO4/Q6D68coNuu856Wff/nE+VT2vu8F99DmZa0AQpNOCUo 50YX5UJHf5TcQNtO4Vd8rrp2sNNwfM+hIkPXI+5TeiLgt/yyCUr0m3I+a WFT3r1TNigjuQTlbUSTQKG8AGTLK2GTv51RM4SZzD2g8gOj83eBarg6C2 w==; X-CSE-ConnectionGUID: 5pmw8lRrRDmOEdQ8bpguPA== X-CSE-MsgGUID: cLJ3imq5RIeeGAKjec64RQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260444" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260444" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482289" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:54 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 17/34] ASoC: intel: soc-acpi: Add missing cs42l43 endpoints Date: Tue, 26 Mar 2024 11:04:12 -0500 Message-Id: <20240326160429.13560-18-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Currently the cs42l43 just specifies a single endpoint, as the current machine driver only looks at the first endpoint specified. Future refactoring will process all endpoints, as such proper specification should be added for all the cs42l43 endpoints. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- .../intel/common/soc-acpi-intel-mtl-match.c | 25 +++++++++++++++++-- .../intel/common/soc-acpi-intel-tgl-match.c | 25 +++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c index e9a5da079089..e06efc5b1457 100644 --- a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c @@ -338,11 +338,32 @@ static const struct snd_soc_acpi_link_adr mtl_712_only[] = { {} }; +static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { + { /* Jack Playback Endpoint */ + .num = 0, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, + { /* DMIC Capture Endpoint */ + .num = 1, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, + { /* Jack Capture Endpoint */ + .num = 2, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, +}; + static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { { .adr = 0x00003001FA424301ull, - .num_endpoints = 1, - .endpoints = &single_endpoint, + .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), + .endpoints = cs42l43_endpoints, .name_prefix = "cs42l43" } }; diff --git a/sound/soc/intel/common/soc-acpi-intel-tgl-match.c b/sound/soc/intel/common/soc-acpi-intel-tgl-match.c index 0fba0a60d9c7..007f1ac2327a 100644 --- a/sound/soc/intel/common/soc-acpi-intel-tgl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-tgl-match.c @@ -414,11 +414,32 @@ static const struct snd_soc_acpi_link_adr tgl_712_only[] = { {} }; +static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { + { /* Jack Playback Endpoint */ + .num = 0, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, + { /* DMIC Capture Endpoint */ + .num = 1, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, + { /* Jack Capture Endpoint */ + .num = 2, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, +}; + static const struct snd_soc_acpi_adr_device cs42l43_3_adr[] = { { .adr = 0x00033001FA424301ull, - .num_endpoints = 1, - .endpoints = &single_endpoint, + .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), + .endpoints = cs42l43_endpoints, .name_prefix = "cs42l43" } }; From patchwork Tue Mar 26 16:04:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604589 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7547E13C9B0 for ; Tue, 26 Mar 2024 16:05:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469137; cv=none; b=TeVS2SaGqXc9gpPUhnOXAIgZASuQR8l4pOaXswlNejmAN4RMUpv3oBgbmmVXdzZoECGx3jiBywXMQfRHOYCd1R9UTbqmRCzof0QCxboyWwO63q9uyEy51h3pADgRXlKcedAQ8YDmkZRD9/GCm/CiDxtc4PGLK7DLHOZqvv30V10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469137; c=relaxed/simple; bh=OyHrtxYt0pTtOYP7K21+cASdvDPSHwyCSUM4YaLh4ok=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=By0n1YCmM2Ur02hGagi9Rd8GjM7HXCwPWZN4eZct44c7B33HIZnfdK04vDKYPrdWo144DsY3oge+qiJ1aR94C6sh2GgsT52NPnQ5Qa8K8f7Qgg+f0Mm18Hh8DCbtaPdMUMDSfTYpiNhFknLbKAy7kjj/mcmwV3WFncYWIQ/wPEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kblz1Uzr; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kblz1Uzr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469135; x=1743005135; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OyHrtxYt0pTtOYP7K21+cASdvDPSHwyCSUM4YaLh4ok=; b=kblz1UzrYFwafVlcoiDEYfuXMlnpBi5dVTca6L/IHLB63sqkR8J2OcXd FGOM7Rhpot17oUs0b4XQjvhKy/WYfkvvAmd9m4HrTVZBXu4fUPFxhdeEF RtFeOnoxomQenRDMHmiFymfylEtkfag9kGy6ZWWInC1/bori4ZNNnYaCA 5wFcw7GKrU2SncoVSiEtVDw5kXtr2uXKloIZeKSHI11UsjAgYPUKhn/Ly gJ0aYJvSNjgC6hXA3yOVKTJLUBmFXYk15wlJIxHqT2aLD1R6JFow9MbwV XABJH0gW5KPY/dOHRkff0t03xrmNLsRb/CqfdDgm9l6VkS7TUTPNNJ9yu A==; X-CSE-ConnectionGUID: z27FsjkMSDmKJyo9FXlW7g== X-CSE-MsgGUID: nhGYxAzwTW6PI7+/U72B2A== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260453" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260453" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482299" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:54 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 18/34] ASoC: Intel: sof-sdw: Add new code for parsing the snd_soc_acpi structs Date: Tue, 26 Mar 2024 11:04:13 -0500 Message-Id: <20240326160429.13560-19-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax The current machine driver code has a lot of loops parsing through the ACPI structs (snd_soc_acpi_link_adr, snd_soc_acpi_adr_device, snd_soc_acpi_endpoint), this makes it hard to understand exactly what information is being extracted and for what purposes. As well as being slightly inefficient, as the same information is looked up multiple times. There are also some issues with the handling of multiple endpoints on a single device, only the first of the snd_soc_acpi_endpoint structures is currently fully processed by the driver. This means doing things like aggregating the second endpoint on a device with another device are not currently possible. Add new parsing code that will count the devices and endpoints, parse them into an intermediate datastructure, and then use that to create the DAI links. This patch does not actually utilise the results of the parsing, items will be moved across in the following patches. This parsing is based around two new structures which are temporarily allocated whilst parsing. Firstly, sof_sdw_endpoint, which represents a specific endpoint for audio on a device and is more or less directly equivalent to snd_soc_acpi_endpoint. Secondly, sof_sdw_dailink which represents a DAI link and contains a linked list of one or more sof_sdw_endpoints. A single trip through the snd_soc_acpi data structures is used to populate these. One important point to note here is the use of the num field in snd_soc_acpi_endpoint to address sof_sdw_dai_info array in the sof_sdw_codec_info struct. This expects a one to one mapping between endpoints on a device and dai infos. It would be fine for a specific system to not specify an endpoint for all of the dai infos available, but two endpoints mapping to the same dai info would make not sense. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 220 +++++++++++++++++++++++++++++-- 1 file changed, 206 insertions(+), 14 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index fdedc32291f0..15bf8fbb3be9 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1462,8 +1462,161 @@ static int sof_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd) return 0; } +struct sof_sdw_endpoint { + struct list_head list; + + u32 link_mask; + const char *codec_name; + + const struct snd_soc_acpi_link_adr *adr_link; + struct sof_sdw_codec_info *codec_info; + const struct sof_sdw_dai_info *dai_info; +}; + +struct sof_sdw_dailink { + bool initialised; + + u8 group_id; + u32 link_mask[SNDRV_PCM_STREAM_LAST + 1]; + int num_devs[SNDRV_PCM_STREAM_LAST + 1]; + struct list_head endpoints; +}; + static const char * const type_strings[] = {"SimpleJack", "SmartAmp", "SmartMic"}; +static int count_sdw_endpoints(struct snd_soc_card *card, int *num_devs, int *num_ends) +{ + struct device *dev = card->dev; + struct snd_soc_acpi_mach *mach = dev_get_platdata(dev); + struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; + const struct snd_soc_acpi_link_adr *adr_link; + int i; + + for (adr_link = mach_params->links; adr_link->num_adr; adr_link++) { + *num_devs += adr_link->num_adr; + + for (i = 0; i < adr_link->num_adr; i++) + *num_ends += adr_link->adr_d[i].num_endpoints; + } + + dev_dbg(dev, "Found %d devices with %d endpoints\n", *num_devs, *num_ends); + + return 0; +} + +static struct sof_sdw_dailink *find_dailink(struct sof_sdw_dailink *dailinks, + const struct snd_soc_acpi_endpoint *new) +{ + while (dailinks->initialised) { + if (new->aggregated && dailinks->group_id == new->group_id) + return dailinks; + + dailinks++; + } + + INIT_LIST_HEAD(&dailinks->endpoints); + dailinks->group_id = new->group_id; + dailinks->initialised = true; + + return dailinks; +} + +static int parse_sdw_endpoints(struct snd_soc_card *card, + struct sof_sdw_dailink *sof_dais, + struct sof_sdw_endpoint *sof_ends) +{ + struct device *dev = card->dev; + struct snd_soc_acpi_mach *mach = dev_get_platdata(dev); + struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; + const struct snd_soc_acpi_link_adr *adr_link; + struct sof_sdw_endpoint *sof_end = sof_ends; + int num_dais = 0; + int i, j; + + for (adr_link = mach_params->links; adr_link->num_adr; adr_link++) { + if (!is_power_of_2(adr_link->mask)) { + dev_err(dev, "link with multiple mask bits: 0x%x\n", + adr_link->mask); + return -EINVAL; + } + + for (i = 0; i < adr_link->num_adr; i++) { + const struct snd_soc_acpi_adr_device *adr_dev = &adr_link->adr_d[i]; + struct sof_sdw_codec_info *codec_info; + const char *codec_name; + + if (!adr_dev->name_prefix) { + dev_err(dev, "codec 0x%llx does not have a name prefix\n", + adr_dev->adr); + return -EINVAL; + } + + codec_info = find_codec_info_part(adr_dev->adr); + if (!codec_info) + return -EINVAL; + + codec_name = get_codec_name(dev, codec_info, adr_link, i); + if (!codec_name) + return -ENOMEM; + + for (j = 0; j < adr_dev->num_endpoints; j++) { + const struct snd_soc_acpi_endpoint *adr_end; + const struct sof_sdw_dai_info *dai_info; + struct sof_sdw_dailink *sof_dai; + int stream; + + adr_end = &adr_dev->endpoints[j]; + dai_info = &codec_info->dais[adr_end->num]; + sof_dai = find_dailink(sof_dais, adr_end); + + dev_dbg(dev, + "Add dev: %d, 0x%llx end: %d, %s, %c/%c to %s: %d\n", + ffs(adr_link->mask) - 1, adr_dev->adr, + adr_end->num, type_strings[dai_info->dai_type], + dai_info->direction[SNDRV_PCM_STREAM_PLAYBACK] ? 'P' : '-', + dai_info->direction[SNDRV_PCM_STREAM_CAPTURE] ? 'C' : '-', + adr_end->aggregated ? "group" : "solo", + adr_end->group_id); + + if (adr_end->num >= codec_info->dai_num) { + dev_err(dev, + "%d is too many endpoints for codec: 0x%x\n", + adr_end->num, codec_info->part_id); + return -EINVAL; + } + + for_each_pcm_streams(stream) { + if (dai_info->direction[stream] && + dai_info->dailink[stream] < 0) { + dev_err(dev, + "Invalid dailink id %d for codec: 0x%x\n", + dai_info->dailink[stream], + codec_info->part_id); + return -EINVAL; + } + + if (dai_info->direction[stream]) { + num_dais += !sof_dai->num_devs[stream]; + sof_dai->num_devs[stream]++; + sof_dai->link_mask[stream] |= adr_link->mask; + } + } + + list_add_tail(&sof_end->list, &sof_dai->endpoints); + + sof_end->link_mask = adr_link->mask; + sof_end->codec_name = codec_name; + sof_end->adr_link = adr_link; + sof_end->codec_info = codec_info; + sof_end->dai_info = dai_info; + sof_end++; + } + } + } + + return num_dais; +} + static int create_sdw_dailink(struct snd_soc_card *card, struct snd_soc_dai_link **dai_links, const struct snd_soc_acpi_link_adr *adr_link, @@ -1758,7 +1911,11 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) struct snd_soc_codec_conf *codec_conf; struct sof_sdw_codec_info *codec_info; struct sof_sdw_codec_info *ssp_info; + struct sof_sdw_endpoint *sof_ends; + struct sof_sdw_dailink *sof_dais; int codec_conf_num = 0; + int num_devs = 0; + int num_ends = 0; bool group_generated[SDW_MAX_GROUPS] = { }; struct snd_soc_dai_link *dai_links; int num_links; @@ -1767,10 +1924,32 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) unsigned long ssp_mask; int ret; + ret = count_sdw_endpoints(card, &num_devs, &num_ends); + if (ret < 0) { + dev_err(dev, "failed to count devices/endpoints: %d\n", ret); + return ret; + } + + /* One per DAI link, worst case is a DAI link for every endpoint */ + sof_dais = kcalloc(num_ends, sizeof(*sof_dais), GFP_KERNEL); + if (!sof_dais) + return -ENOMEM; + + /* One per endpoint, ie. each DAI on each codec/amp */ + sof_ends = kcalloc(num_ends, sizeof(*sof_ends), GFP_KERNEL); + if (!sof_ends) { + ret = -ENOMEM; + goto err_dai; + } + + ret = parse_sdw_endpoints(card, sof_dais, sof_ends); + if (ret < 0) + goto err_end; + ret = get_dailink_info(dev, adr_link, &sdw_be_num, &codec_conf_num); if (ret < 0) { dev_err(dev, "failed to get sdw link info %d\n", ret); - return ret; + goto err_end; } /* @@ -1807,14 +1986,18 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) /* allocate BE dailinks */ num_links = sdw_be_num + ssp_num + dmic_num + hdmi_num + bt_num; dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL); - if (!dai_links) - return -ENOMEM; + if (!dai_links) { + ret = -ENOMEM; + goto err_end; + } /* allocate codec conf, will be populated when dailinks are created */ codec_conf = devm_kcalloc(dev, codec_conf_num, sizeof(*codec_conf), GFP_KERNEL); - if (!codec_conf) - return -ENOMEM; + if (!codec_conf) { + ret = -ENOMEM; + goto err_end; + } card->dai_link = dai_links; card->num_links = num_links; @@ -1838,8 +2021,10 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) for (i = 0; i < adr_link->num_adr; i++) { /* find codec info to get dai_num */ codec_info = find_codec_info_part(adr_link->adr_d[i].adr); - if (!codec_info) - return -EINVAL; + if (!codec_info) { + ret = -EINVAL; + goto err_end; + } if (codec_info->dai_num > 1) { ctx->append_dai_type = true; goto out; @@ -1871,8 +2056,10 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) /* find codec info to get dai_num */ codec_info = find_codec_info_part(adr_link->adr_d[i].adr); - if (!codec_info) - return -EINVAL; + if (!codec_info) { + ret = -EINVAL; + goto err_end; + } for (j = 0; j < codec_info->dai_num ; j++) { int current_be_id; @@ -1903,7 +2090,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) ret = create_ssp_dailinks(card, &dai_links, &be_id, ssp_info, ssp_mask); if (ret) - return ret; + goto err_end; } /* dmic */ @@ -1913,25 +2100,30 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) } else { ret = create_dmic_dailinks(card, &dai_links, &be_id); if (ret) - return ret; + goto err_end; } } /* HDMI */ ret = create_hdmi_dailinks(card, &dai_links, &be_id, hdmi_num); if (ret) - return ret; + goto err_end; /* BT */ if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) { ret = create_bt_dailinks(card, &dai_links, &be_id); if (ret) - return ret; + goto err_end; } WARN_ON(dai_links != card->dai_link + card->num_links); - return 0; +err_end: + kfree(sof_ends); +err_dai: + kfree(sof_dais); + + return ret; } static int sof_sdw_card_late_probe(struct snd_soc_card *card) From patchwork Tue Mar 26 16:04:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604586 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 754E513CA91 for ; Tue, 26 Mar 2024 16:05:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469137; cv=none; b=cUBcBqMbGIMRvoKG2s/8kVg6h48Mv0HvXlvyUXJ2NB0NiMCF6hoHO+oAPI/RfPvG+wenfsqgEfMCF6V5rU5BABxaYHHGwfP4EI3k5f0l7t1owcL9eq2NcY3YEyzAl0InReOUtdFfgiclG1wFaLbnIbJeBhFjv0ji80JeM0mZlFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469137; c=relaxed/simple; bh=vyvQeUPm2UJYX4QPwg3cG/elxp5BlodNhrVktU/ZmIs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iJ5Z0F56HmAj6Yyz10TX2UQv6qvD551A8yVoGddfqDWnHaN+mG9UmhO46mIrUC7M007W/GjDsTj2sKvZcAXrimkBM6QwZvuBlH5PgTyQVxDlymqauiq1gSpEuca8/FWvPJf7yY77f27I16h5qDs/Yh4gtL5QLGR3yqUL96/Pg8U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QQYWQtPE; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QQYWQtPE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469135; x=1743005135; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vyvQeUPm2UJYX4QPwg3cG/elxp5BlodNhrVktU/ZmIs=; b=QQYWQtPEjog1WI3WO0YJ6lh8yoEdlvJdI1BssKyyQqGoFtK/MqkSecvw /9Fmg8mxnbcd2Puebbhx9EDDK08mYaRpoawjoZYDe/ICqE30CAeQrBeCM s245rSYbXmRXaNMwSJM1rTK1hq/Kb4bOWzZk+P2YNPzF2loIp2dWbhkyi j1+Sup43vaf6wn76YjG8HJlAZiD4OIR0ha27SsHOOVuWhjrKkE0POL2t0 bXXkgcx+n/D7KsyVsSK+Ra1pmdhOqKk+mrEMSL70Shn5kZzl2+S6Lu9z+ Vf0bLkA8u2lOx9lri400LROPmyITgmWO8hZRf/gjibvaAHiPykfwNYxQ4 w==; X-CSE-ConnectionGUID: eKnyNQp4QWCEdjof/Xk+2Q== X-CSE-MsgGUID: jP/YZA4jTJ6sIiIA2M8BuA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260462" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260462" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482317" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:55 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 19/34] ASoC: Intel: sof_sdw: Move counting and codec_conf to new parsing Date: Tue, 26 Mar 2024 11:04:14 -0500 Message-Id: <20240326160429.13560-20-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Use the output of the new snd_soc_acpi struct parsing for the purposes of counting the number of SoundWire DAI links and physical devices attached to the SoundWire. These counts are already returned by the parser so those can just be used directly. But the population of the codec_conf structures, is moved from the old parsing code over to the new. As the two parsers currently co-exist it is better to not have them both attempt to modify the same structures. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 124 ++++++------------------------- 1 file changed, 22 insertions(+), 102 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 15bf8fbb3be9..0566ab843c2e 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1126,79 +1126,6 @@ static struct sof_sdw_codec_info *find_codec_info_dai(const char *dai_name, return NULL; } -/* - * get BE dailink number and CPU DAI number based on sdw link adr. - * Since some sdw slaves may be aggregated, the CPU DAI number - * may be larger than the number of BE dailinks. - */ -static int get_dailink_info(struct device *dev, - const struct snd_soc_acpi_link_adr *adr_link, - int *sdw_be_num, int *codecs_num) -{ - bool group_visited[SDW_MAX_GROUPS]; - int i; - int j; - - *sdw_be_num = 0; - - if (!adr_link) - return -EINVAL; - - for (i = 0; i < SDW_MAX_GROUPS; i++) - group_visited[i] = false; - - for (; adr_link->num_adr; adr_link++) { - const struct snd_soc_acpi_endpoint *endpoint; - struct sof_sdw_codec_info *codec_info; - int stream; - u64 adr; - - /* make sure the link mask has a single bit set */ - if (!is_power_of_2(adr_link->mask)) - return -EINVAL; - - for (i = 0; i < adr_link->num_adr; i++) { - adr = adr_link->adr_d[i].adr; - codec_info = find_codec_info_part(adr); - if (!codec_info) - return -EINVAL; - - *codecs_num += codec_info->dai_num; - - if (!adr_link->adr_d[i].name_prefix) { - dev_err(dev, "codec 0x%llx does not have a name prefix\n", - adr_link->adr_d[i].adr); - return -EINVAL; - } - - endpoint = adr_link->adr_d[i].endpoints; - if (endpoint->aggregated && !endpoint->group_id) { - dev_err(dev, "invalid group id on link %x\n", - adr_link->mask); - return -EINVAL; - } - - for (j = 0; j < codec_info->dai_num; j++) { - /* count DAI number for playback and capture */ - for_each_pcm_streams(stream) { - if (!codec_info->dais[j].direction[stream]) - continue; - - /* count BE for each non-aggregated slave or group */ - if (!endpoint->aggregated || - !group_visited[endpoint->group_id]) - (*sdw_be_num)++; - } - } - - if (endpoint->aggregated) - group_visited[endpoint->group_id] = true; - } - } - - return 0; -} - static void init_dai_link(struct device *dev, struct snd_soc_dai_link *dai_links, int *be_id, char *name, int playback, int capture, struct snd_soc_dai_link_component *cpus, int cpus_num, @@ -1528,6 +1455,7 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, struct device *dev = card->dev; struct snd_soc_acpi_mach *mach = dev_get_platdata(dev); struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; + struct snd_soc_codec_conf *codec_conf = card->codec_conf; const struct snd_soc_acpi_link_adr *adr_link; struct sof_sdw_endpoint *sof_end = sof_ends; int num_dais = 0; @@ -1559,6 +1487,13 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, if (!codec_name) return -ENOMEM; + codec_conf->dlc.name = codec_name; + codec_conf->name_prefix = adr_dev->name_prefix; + codec_conf++; + + dev_dbg(dev, "Adding prefix %s for %s\n", + adr_dev->name_prefix, codec_name); + for (j = 0; j < adr_dev->num_endpoints; j++) { const struct snd_soc_acpi_endpoint *adr_end; const struct sof_sdw_dai_info *dai_info; @@ -1614,13 +1549,14 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, } } + WARN_ON(codec_conf != card->codec_conf + card->num_configs); + return num_dais; } static int create_sdw_dailink(struct snd_soc_card *card, struct snd_soc_dai_link **dai_links, const struct snd_soc_acpi_link_adr *adr_link, - struct snd_soc_codec_conf **codec_conf, int *be_id, int adr_index, int dai_index) { struct mc_private *ctx = snd_soc_card_get_drvdata(card); @@ -1672,26 +1608,16 @@ static int create_sdw_dailink(struct snd_soc_card *card, endpoints->group_id != group_id)) continue; - /* sanity check */ - if (*codec_conf >= card->codec_conf + card->num_configs) { - dev_err(dev, "codec_conf array overflowed\n"); - return -EINVAL; - } - ret = fill_sdw_codec_dlc(dev, adr_link_next, &codecs[codec_dlc_index], j, dai_index); if (ret) return ret; - (*codec_conf)->dlc = codecs[codec_dlc_index]; - (*codec_conf)->name_prefix = adr_link_next->adr_d[j].name_prefix; - sdw_codec_ch_maps[codec_dlc_index].cpu = i; sdw_codec_ch_maps[codec_dlc_index].codec = codec_dlc_index; codec_dlc_index++; - (*codec_conf)++; } j = 0; @@ -1913,7 +1839,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) struct sof_sdw_codec_info *ssp_info; struct sof_sdw_endpoint *sof_ends; struct sof_sdw_dailink *sof_dais; - int codec_conf_num = 0; int num_devs = 0; int num_ends = 0; bool group_generated[SDW_MAX_GROUPS] = { }; @@ -1942,15 +1867,21 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto err_dai; } + /* will be populated when acpi endpoints are parsed */ + codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL); + if (!codec_conf) { + ret = -ENOMEM; + goto err_end; + } + + card->codec_conf = codec_conf; + card->num_configs = num_devs; + ret = parse_sdw_endpoints(card, sof_dais, sof_ends); if (ret < 0) goto err_end; - ret = get_dailink_info(dev, adr_link, &sdw_be_num, &codec_conf_num); - if (ret < 0) { - dev_err(dev, "failed to get sdw link info %d\n", ret); - goto err_end; - } + sdw_be_num = ret; /* * on generic tgl platform, I2S or sdw mode is supported @@ -1991,18 +1922,8 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto err_end; } - /* allocate codec conf, will be populated when dailinks are created */ - codec_conf = devm_kcalloc(dev, codec_conf_num, sizeof(*codec_conf), - GFP_KERNEL); - if (!codec_conf) { - ret = -ENOMEM; - goto err_end; - } - card->dai_link = dai_links; card->num_links = num_links; - card->codec_conf = codec_conf; - card->num_configs = codec_conf_num; /* SDW */ if (!sdw_be_num) @@ -2065,8 +1986,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) int current_be_id; ret = create_sdw_dailink(card, &dai_links, adr_link, - &codec_conf, ¤t_be_id, - i, j); + ¤t_be_id, i, j); if (ret < 0) { dev_err(dev, "failed to create dai link %d on 0x%x\n", From patchwork Tue Mar 26 16:04:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604587 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E19613C9BD for ; Tue, 26 Mar 2024 16:05:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469137; cv=none; b=QRbwqks/1j3fjxwUrEGtCzsZ2XUZ+I+alqanwBig7n+iduZ1lH/338p6TOfqX5GXNFXdXJDRYhZ6kY1qEb/k9zx0OOIGsJ3mBMov/yf/Vv6Hj49F3VRg5TB/yzPbpu/Qkyu/fpAPP1vz5LTE5yxyYKVeb3exAHoYJYrzDFqeSsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469137; c=relaxed/simple; bh=mDzSkoz5dkqO6+iiJ4uoAI2nRZkxqWOmEeXtWfmUyek=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FaDInbL3ZwBW0g/CHbwyoW1zOsCXIPfdUc6Kv1q2zjxQWaNiVBKc0CLiVIq7eHx/x8T2eH/+03KmI9Tj3Z7oQGv5UeBWMG0dtrG6Z0qQjqDO2UtKfur/elA4q6Ym7gYi/5HwNi1TA8iVvENqxn5tCZIXPHpTk98s8QKiBOwX6jo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BH0mcBQ4; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BH0mcBQ4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469136; x=1743005136; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mDzSkoz5dkqO6+iiJ4uoAI2nRZkxqWOmEeXtWfmUyek=; b=BH0mcBQ47+X/3397eG+abPxzABw2cZzLNMnmvtHFxK3mt/nexMmsVaIt 4ILV8cNZPxXz585/NhV2Mrgh8so/3Uh2bX2tp/OpnGJNRL9juwFuvaXd0 dlZUCGeJLQCwZr1zpvQpy8hGBhag7l1HRTwKMp0wP6E9yhEykgGk37vyj SCbhioRuxhaKnBl7Wfn8WN+K37AJRg3H09G3Q1VHfyvmaMFK2upuNmyyY e9g03ZYVxocX9rAUNQoKWS/HkEPYUnEh6sPy2FgbCbjUzOhCnHmIP3RVd +jmas9Tw5oqrkfLBySTJKIFlD7TF8c9DrrQV20uHw9JC3NC5T6IxgM4HN w==; X-CSE-ConnectionGUID: iRmLYDd+T+Ow6nbknp15TA== X-CSE-MsgGUID: xKbVxxUATgOc1omwvTYTIw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260468" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260468" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482333" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:56 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 20/34] ASoC: Intel: sof_sdw: Move ignore_pch_dmic to new parsing Date: Tue, 26 Mar 2024 11:04:15 -0500 Message-Id: <20240326160429.13560-21-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Trivial move of the handling of ignore_pch_dmic over to the new parsing code. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 0566ab843c2e..cda759ee6345 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1453,6 +1453,7 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, struct sof_sdw_endpoint *sof_ends) { struct device *dev = card->dev; + struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct snd_soc_acpi_mach *mach = dev_get_platdata(dev); struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; struct snd_soc_codec_conf *codec_conf = card->codec_conf; @@ -1483,6 +1484,8 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, if (!codec_info) return -EINVAL; + ctx->ignore_pch_dmic |= codec_info->ignore_pch_dmic; + codec_name = get_codec_name(dev, codec_info, adr_link, i); if (!codec_name) return -ENOMEM; @@ -1630,8 +1633,6 @@ static int create_sdw_dailink(struct snd_soc_card *card, if (!codec_info) return -EINVAL; - ctx->ignore_pch_dmic |= codec_info->ignore_pch_dmic; - for_each_pcm_streams(stream) { char *name, *cpu_name; int playback, capture; From patchwork Tue Mar 26 16:04:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604588 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D18413CA9C for ; Tue, 26 Mar 2024 16:05:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469137; cv=none; b=uM/D9FTuWoZpxMoIFgYKr1gSfPRYLgJjHYUqdHW0zvKjE2GLvNSZLSG/yZrip9LiPJZ9t6ErnsYhUzbwaNEuuzwPMNVPIzqE4Fb+KMGvbg+xQLQjNIGXcOFZSUE3mgJqbVHBYDmgkPr4wDu+QyzXwITvs1sQkooii7LOFd5GjeU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469137; c=relaxed/simple; bh=3xRsvZ3vHZgzMGxX4qTn0KCbHj9R9neYJ/Ir08g+3As=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gacZQdarLj+s54sw0vKDlrsn9TBsBtf+f5Hk0AxUlP7q5TSQYnTYqH0jaPx0lFFHK9oHgsZIFdt5Zq9EQ5DqX3iJzza/FbFGxqMDcrkHl8M+r5JV4FELDkttmnGGYAqbaysfagrGbZ/l61ndOuBXcsypqzw0mNLWxA2f5U5GbR4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aUNuAtcR; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aUNuAtcR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469136; x=1743005136; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3xRsvZ3vHZgzMGxX4qTn0KCbHj9R9neYJ/Ir08g+3As=; b=aUNuAtcR0yjZnh6WnslCJ1o08LQTRGI/Y3p4hNDGzKmv/lgwTMtKvewA vQfWkOaEA9q8dtkcxHtA2Ttk0j49UIBBqCE2Qte6+07g6fpio45hbml7k pUkM2EcLRIs8MPWmc9nWHJEhBpKnM3lAIPZmXy2NBloy6rerbI8zVHwCe BiP59YSUJdIwlASIMxGhu56vGqBVQMlEKVN5wybaEB+EpAVZGFZj22LXo A6GRab83O0IR1FT/ZTxxKZ5pT3EtD4NdZgZxUOSl8x/+NuuWSwyLJmRgI IDVc72O1c0bXEkrbkJ1K8OpFoRAtOj3G7J+F6buj8SY3qttENx2Y1LlXr A==; X-CSE-ConnectionGUID: /fRn2s9kRcGKxKOlKcGM+g== X-CSE-MsgGUID: 5x9RLeszSZ2Smno1hos1Tw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260474" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260474" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482343" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:57 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 21/34] ASoC: Intel: sof_sdw: Move append_dai_type to new parsing Date: Tue, 26 Mar 2024 11:04:16 -0500 Message-Id: <20240326160429.13560-22-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax append_dai_type should be set to true in any situation that would result in multiple DAI links existing on a single SoundWire bus, because the legacy naming used only the bus number to make things unique. The current code handles this by looking for codecs with multiple dai_info structs and looking for buses that include multiple types of device on them. The first of these assumes that all DAIs on a given device would be in use. The second, with dissimilar aggregation now being supported, isn't really an accurate check either since those devices could be aggregated into a single DAI link. Move the handling for this flag over to the new parsing code and simplify things a little by looking directly for SoundWire links that will contain multiple DAI links to set the flag. These changes should not cause any change in behaviour for any currently supported systems. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 36 +++++--------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index cda759ee6345..89ce77961634 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1463,6 +1463,8 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, int i, j; for (adr_link = mach_params->links; adr_link->num_adr; adr_link++) { + int num_link_dailinks = 0; + if (!is_power_of_2(adr_link->mask)) { dev_err(dev, "link with multiple mask bits: 0x%x\n", adr_link->mask); @@ -1540,6 +1542,7 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, } } + num_link_dailinks += !!list_empty(&sof_dai->endpoints); list_add_tail(&sof_end->list, &sof_dai->endpoints); sof_end->link_mask = adr_link->mask; @@ -1550,6 +1553,8 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, sof_end++; } } + + ctx->append_dai_type |= (num_link_dailinks > 1); } WARN_ON(codec_conf != card->codec_conf + card->num_configs); @@ -1933,37 +1938,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) for (i = 0; i < SDW_MAX_LINKS; i++) ctx->sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE; - for (; adr_link->num_adr; adr_link++) { - /* - * If there are two or more different devices on the same sdw link, we have to - * append the codec type to the dai link name to prevent duplicated dai link name. - * The same type devices on the same sdw link will be in the same - * snd_soc_acpi_adr_device array. They won't be described in different adr_links. - */ - for (i = 0; i < adr_link->num_adr; i++) { - /* find codec info to get dai_num */ - codec_info = find_codec_info_part(adr_link->adr_d[i].adr); - if (!codec_info) { - ret = -EINVAL; - goto err_end; - } - if (codec_info->dai_num > 1) { - ctx->append_dai_type = true; - goto out; - } - for (j = 0; j < i; j++) { - if ((SDW_PART_ID(adr_link->adr_d[i].adr) != - SDW_PART_ID(adr_link->adr_d[j].adr)) || - (SDW_MFG_ID(adr_link->adr_d[i].adr) != - SDW_MFG_ID(adr_link->adr_d[j].adr))) { - ctx->append_dai_type = true; - goto out; - } - } - } - } -out: - /* generate DAI links by each sdw link */ for (adr_link = mach_params->links ; adr_link->num_adr; adr_link++) { for (i = 0; i < adr_link->num_adr; i++) { From patchwork Tue Mar 26 16:04:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604591 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7345513C91A for ; Tue, 26 Mar 2024 16:05:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469139; cv=none; b=DLrkJw/VJJmtVbIMbXLgUiPN7hg7yzkxe0uZH9aR5uTCQZk49gX2CST+nrmjbaTL+CJRikz8NhX2OSbSUXhiudLc1WquzFNM92rNfblM9FdeihOMmXBH5530kLg5efNyufYFUZ4HptHQ5oJNQmycr8FuPkHesbZKhZXuoTqqqEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469139; c=relaxed/simple; bh=Mv4ouSSBc7noGQriz/pJ01JRgynIe96KuX9Wsjb+4qw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=T+cl1P6i/TYcaSp/844SCt4AdqR9PNxUkWm7UPAFeVRsX4bssyythaTg03/eI1dksbQpITtDtuSADSBBb3Cli+mGnqr0LVpkD9bxwq/pjdgLGa2uh6O1FZiVZJrfgY4Qlf9yjVcDTCvmdva+ODBbpbXBYtdcCmjY1gk+wIyKs2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WiJDMF/R; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WiJDMF/R" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469137; x=1743005137; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mv4ouSSBc7noGQriz/pJ01JRgynIe96KuX9Wsjb+4qw=; b=WiJDMF/Ry3jTOO3K7G+EMHeRtz9aEO9ztj0Nv0yORqZW9oxforXP0vXP at+0D3gopNP55e3yWSd1hnxusly90amB97WtSQ8HFiG2A8Lfv/aM+8AD8 8C+rNFbk2pqO3r4Qc+zMyqrKa1aJnKRwL9FuEXVxVvLpMz8EEfyO/Sdpf EE/4ZACDXGh00ApwmtBA2EMeSleeJLGT81mhCafLipzHPl/vBvG+8w7S3 Kw0cYPIKCssHnAFVWYU2Qa1lDEHjQxx+hT/yETayY5AJ79xamXysupnr2 y96+gbVS2Skz4/NxSwF15DelYtY6+zav3jMdY5DoYxebtiTBR14l4a9NH Q==; X-CSE-ConnectionGUID: pD4RyRRsQ9Gg5J1Sha/gtQ== X-CSE-MsgGUID: 20lxlsqpQ8umOJGDRfWsdA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260480" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260480" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482357" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:57 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 22/34] ASoC: Intel: sof_sdw: Move generation of DAI links to new parsing Date: Tue, 26 Mar 2024 11:04:17 -0500 Message-Id: <20240326160429.13560-23-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax The only part left using the old parsing code is now the generation of the actual DAI links. Move this generation over to being based on the new parsing, which allows the removal of the last of the old parsing code. The new DAI link generation is a simple matter of creating a new DAI link for each sof_sdw_dailink struct, and adding a cpu, a codec, and a mapping for each sof_sdw_endpoint contained in that sof_sdw_dailink. Note that the CPUs can be inferred as the endpoint list is iterated, because the endpoints were added into the list sorted by link. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 340 +++++++------------------------ 1 file changed, 78 insertions(+), 262 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 89ce77961634..9f1c49df9cd2 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1234,129 +1234,6 @@ static const char *get_codec_name(struct device *dev, return NULL; } -static int fill_sdw_codec_dlc(struct device *dev, - const struct snd_soc_acpi_link_adr *adr_link, - struct snd_soc_dai_link_component *codec, - int adr_index, int dai_index) -{ - u64 adr = adr_link->adr_d[adr_index].adr; - struct sof_sdw_codec_info *codec_info; - - codec_info = find_codec_info_part(adr); - if (!codec_info) - return -EINVAL; - - codec->name = get_codec_name(dev, codec_info, adr_link, adr_index); - if (!codec->name) - return -ENOMEM; - - codec->dai_name = codec_info->dais[dai_index].dai_name; - - return 0; -} - -static int set_codec_init_func(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *adr_link, - struct snd_soc_dai_link *dai_links, - bool playback, int group_id, int adr_index, int dai_index) -{ - int i = adr_index; - - do { - /* - * Initialize the codec. If codec is part of an aggregated - * group (group_id>0), initialize all codecs belonging to - * same group. - * The first link should start with adr_link->adr_d[adr_index] - * because that is the device that we want to initialize and - * we should end immediately if it is not aggregated (group_id=0) - */ - for ( ; i < adr_link->num_adr; i++) { - struct sof_sdw_codec_info *codec_info; - - codec_info = find_codec_info_part(adr_link->adr_d[i].adr); - if (!codec_info) - return -EINVAL; - - /* The group_id is > 0 iff the codec is aggregated */ - if (adr_link->adr_d[i].endpoints->group_id != group_id) - continue; - - if (codec_info->dais[dai_index].init) - codec_info->dais[dai_index].init(card, - adr_link, - dai_links, - codec_info, - playback); - if (!group_id) - return 0; - } - - i = 0; - adr_link++; - } while (adr_link->mask); - - return 0; -} - -/* - * check endpoint status in slaves and gather link ID for all slaves in - * the same group to generate different CPU DAI. Now only support - * one sdw link with all slaves set with only single group id. - * - * one slave on one sdw link with aggregated = 0 - * one sdw BE DAI <---> one-cpu DAI <---> one-codec DAI - * - * two or more slaves on one sdw link with aggregated = 0 - * one sdw BE DAI <---> one-cpu DAI <---> multi-codec DAIs - * - * multiple links with multiple slaves with aggregated = 1 - * one sdw BE DAI <---> 1 .. N CPU DAIs <----> 1 .. N codec DAIs - */ -static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, - struct device *dev, int *cpu_dai_id, int *cpu_dai_num, - int *codec_num, unsigned int *group_id, - int adr_index) -{ - int i; - - if (!adr_link->adr_d[adr_index].endpoints->aggregated) { - cpu_dai_id[0] = ffs(adr_link->mask) - 1; - *cpu_dai_num = 1; - *codec_num = 1; - *group_id = 0; - return 0; - } - - *codec_num = 0; - *cpu_dai_num = 0; - *group_id = adr_link->adr_d[adr_index].endpoints->group_id; - - /* Count endpoints with the same group_id in the adr_link */ - for (; adr_link && adr_link->num_adr; adr_link++) { - unsigned int link_codecs = 0; - - for (i = 0; i < adr_link->num_adr; i++) { - if (adr_link->adr_d[i].endpoints->aggregated && - adr_link->adr_d[i].endpoints->group_id == *group_id) - link_codecs++; - } - - if (link_codecs) { - *codec_num += link_codecs; - - if (*cpu_dai_num >= SDW_MAX_CPU_DAIS) { - dev_err(dev, "cpu_dai_id array overflowed\n"); - return -EINVAL; - } - - cpu_dai_id[(*cpu_dai_num)++] = ffs(adr_link->mask) - 1; - } - } - - return 0; -} - static int sof_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd) { struct sof_sdw_codec_info *codec_info; @@ -1563,135 +1440,102 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, } static int create_sdw_dailink(struct snd_soc_card *card, + struct sof_sdw_dailink *sof_dai, struct snd_soc_dai_link **dai_links, - const struct snd_soc_acpi_link_adr *adr_link, - int *be_id, int adr_index, int dai_index) + int *be_id) { - struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct device *dev = card->dev; - const struct snd_soc_acpi_link_adr *adr_link_next; - struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps; - struct snd_soc_dai_link_component *codecs; - struct snd_soc_dai_link_component *cpus; - struct sof_sdw_codec_info *codec_info; - int cpu_dai_id[SDW_MAX_CPU_DAIS]; - int cpu_dai_num; - unsigned int group_id; - int codec_dlc_index = 0; - int codec_num; + struct mc_private *ctx = snd_soc_card_get_drvdata(card); + struct sof_sdw_endpoint *sof_end; int stream; - int i = 0; - int j, k; - int ret; - - ret = get_slave_info(adr_link, dev, cpu_dai_id, &cpu_dai_num, &codec_num, - &group_id, adr_index); - if (ret) - return ret; - - codecs = devm_kcalloc(dev, codec_num, sizeof(*codecs), GFP_KERNEL); - if (!codecs) - return -ENOMEM; - - sdw_codec_ch_maps = devm_kcalloc(dev, codec_num, - sizeof(*sdw_codec_ch_maps), GFP_KERNEL); - if (!sdw_codec_ch_maps) - return -ENOMEM; - - /* generate codec name on different links in the same group */ - j = adr_index; - for (adr_link_next = adr_link; adr_link_next && adr_link_next->num_adr && - i < cpu_dai_num; adr_link_next++) { - /* skip the link excluded by this processed group */ - if (cpu_dai_id[i] != ffs(adr_link_next->mask) - 1) - continue; - - /* j reset after loop, adr_index only applies to first link */ - for (; j < adr_link_next->num_adr && codec_dlc_index < codec_num; j++) { - const struct snd_soc_acpi_endpoint *endpoints; - - endpoints = adr_link_next->adr_d[j].endpoints; - - if (group_id && (!endpoints->aggregated || - endpoints->group_id != group_id)) - continue; - - ret = fill_sdw_codec_dlc(dev, adr_link_next, - &codecs[codec_dlc_index], - j, dai_index); - if (ret) - return ret; - - sdw_codec_ch_maps[codec_dlc_index].cpu = i; - sdw_codec_ch_maps[codec_dlc_index].codec = codec_dlc_index; - - codec_dlc_index++; - } - j = 0; - - /* check next link to create codec dai in the processed group */ - i++; - } - - /* find codec info to create BE DAI */ - codec_info = find_codec_info_part(adr_link->adr_d[adr_index].adr); - if (!codec_info) - return -EINVAL; for_each_pcm_streams(stream) { - char *name, *cpu_name; - int playback, capture; static const char * const sdw_stream_name[] = { "SDW%d-Playback", "SDW%d-Capture", "SDW%d-Playback-%s", "SDW%d-Capture-%s", }; + struct snd_soc_dai_link_ch_map *codec_maps; + struct snd_soc_dai_link_component *codecs; + struct snd_soc_dai_link_component *cpus; + int num_cpus = hweight32(sof_dai->link_mask[stream]); + int num_codecs = sof_dai->num_devs[stream]; + int playback, capture; + int cur_link = 0; + int i = 0, j = 0; + char *name; - if (!codec_info->dais[dai_index].direction[stream]) + if (!sof_dai->num_devs[stream]) continue; - *be_id = codec_info->dais[dai_index].dailink[stream]; + sof_end = list_first_entry(&sof_dai->endpoints, + struct sof_sdw_endpoint, list); + + *be_id = sof_end->dai_info->dailink[stream]; if (*be_id < 0) { dev_err(dev, "Invalid dailink id %d\n", *be_id); return -EINVAL; } /* create stream name according to first link id */ - if (ctx->append_dai_type) { + if (ctx->append_dai_type) name = devm_kasprintf(dev, GFP_KERNEL, - sdw_stream_name[stream + 2], cpu_dai_id[0], - type_strings[codec_info->dais[dai_index].dai_type]); - } else { + sdw_stream_name[stream + 2], + ffs(sof_end->link_mask) - 1, + type_strings[sof_end->dai_info->dai_type]); + else name = devm_kasprintf(dev, GFP_KERNEL, - sdw_stream_name[stream], cpu_dai_id[0]); - } + sdw_stream_name[stream], + ffs(sof_end->link_mask) - 1); if (!name) return -ENOMEM; - cpus = devm_kcalloc(dev, cpu_dai_num, sizeof(*cpus), GFP_KERNEL); + cpus = devm_kcalloc(dev, num_cpus, sizeof(*cpus), GFP_KERNEL); if (!cpus) return -ENOMEM; - /* - * generate CPU DAI name base on the sdw link ID and - * PIN ID with offset of 2 according to sdw dai driver. - */ - for (k = 0; k < cpu_dai_num; k++) { - cpu_name = devm_kasprintf(dev, GFP_KERNEL, - "SDW%d Pin%d", cpu_dai_id[k], - ctx->sdw_pin_index[cpu_dai_id[k]]++); - if (!cpu_name) - return -ENOMEM; - - cpus[k].dai_name = cpu_name; + codecs = devm_kcalloc(dev, num_codecs, sizeof(*codecs), GFP_KERNEL); + if (!codecs) + return -ENOMEM; + + codec_maps = devm_kcalloc(dev, num_codecs, sizeof(*codec_maps), GFP_KERNEL); + if (!codec_maps) + return -ENOMEM; + + list_for_each_entry(sof_end, &sof_dai->endpoints, list) { + if (!sof_end->dai_info->direction[stream]) + continue; + + if (cur_link != sof_end->link_mask) { + int link_num = ffs(sof_end->link_mask) - 1; + int pin_num = ctx->sdw_pin_index[link_num]++; + + cur_link = sof_end->link_mask; + + cpus[i].dai_name = devm_kasprintf(dev, GFP_KERNEL, + "SDW%d Pin%d", + link_num, pin_num); + if (!cpus[i].dai_name) + return -ENOMEM; + i++; + } + + codec_maps[j].cpu = i - 1; + codec_maps[j].codec = j; + + codecs[j].name = sof_end->codec_name; + codecs[j].dai_name = sof_end->dai_info->dai_name; + j++; } + WARN_ON(i != num_cpus || j != num_codecs); + playback = (stream == SNDRV_PCM_STREAM_PLAYBACK); capture = (stream == SNDRV_PCM_STREAM_CAPTURE); init_dai_link(dev, *dai_links, be_id, name, playback, capture, - cpus, cpu_dai_num, codecs, codec_num, + cpus, num_cpus, codecs, num_codecs, sof_sdw_rtd_init, &sdw_ops); /* @@ -1699,13 +1543,14 @@ static int create_sdw_dailink(struct snd_soc_card *card, * based on wait_for_completion(), tag them as 'nonatomic'. */ (*dai_links)->nonatomic = true; - (*dai_links)->ch_maps = sdw_codec_ch_maps; + (*dai_links)->ch_maps = codec_maps; - ret = set_codec_init_func(card, adr_link, *dai_links, - playback, group_id, adr_index, dai_index); - if (ret < 0) { - dev_err(dev, "failed to init codec 0x%x\n", codec_info->part_id); - return ret; + list_for_each_entry(sof_end, &sof_dai->endpoints, list) { + if (sof_end->dai_info->init) + sof_end->dai_info->init(card, sof_end->adr_link, + *dai_links, + sof_end->codec_info, + playback); } (*dai_links)++; @@ -1839,18 +1684,15 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) int sdw_be_num = 0, ssp_num = 0, dmic_num = 0, bt_num = 0; struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; - const struct snd_soc_acpi_link_adr *adr_link = mach_params->links; struct snd_soc_codec_conf *codec_conf; - struct sof_sdw_codec_info *codec_info; struct sof_sdw_codec_info *ssp_info; struct sof_sdw_endpoint *sof_ends; struct sof_sdw_dailink *sof_dais; int num_devs = 0; int num_ends = 0; - bool group_generated[SDW_MAX_GROUPS] = { }; struct snd_soc_dai_link *dai_links; int num_links; - int i, j, be_id = 0; + int i, be_id = 0; int hdmi_num; unsigned long ssp_mask; int ret; @@ -1939,44 +1781,18 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) ctx->sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE; /* generate DAI links by each sdw link */ - for (adr_link = mach_params->links ; adr_link->num_adr; adr_link++) { - for (i = 0; i < adr_link->num_adr; i++) { - const struct snd_soc_acpi_endpoint *endpoint; + while (sof_dais->initialised) { + int current_be_id; - endpoint = adr_link->adr_d[i].endpoints; + ret = create_sdw_dailink(card, sof_dais, &dai_links, ¤t_be_id); + if (ret) + goto err_end; - /* this group has been generated */ - if (endpoint->aggregated && - group_generated[endpoint->group_id]) - continue; + /* Update the be_id to match the highest ID used for SDW link */ + if (be_id < current_be_id) + be_id = current_be_id; - /* find codec info to get dai_num */ - codec_info = find_codec_info_part(adr_link->adr_d[i].adr); - if (!codec_info) { - ret = -EINVAL; - goto err_end; - } - - for (j = 0; j < codec_info->dai_num ; j++) { - int current_be_id; - - ret = create_sdw_dailink(card, &dai_links, adr_link, - ¤t_be_id, i, j); - if (ret < 0) { - dev_err(dev, - "failed to create dai link %d on 0x%x\n", - j, codec_info->part_id); - return ret; - } - - /* Update the be_id to match the highest ID used for SDW link */ - if (be_id < current_be_id) - be_id = current_be_id; - } - - if (endpoint->aggregated) - group_generated[endpoint->group_id] = true; - } + sof_dais++; } SSP: From patchwork Tue Mar 26 16:04:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604590 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CF0A13CA91 for ; Tue, 26 Mar 2024 16:05:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469139; cv=none; b=bzpjp1iBgtGyhSW1dubhQQhkO6HWqtAV0CML/xYJQeuaP8nF5PXBr3qvZP+j91RFMCLSlXL8z2L1oBk6W+nXSpcEUafe0yVZCO4AqVRcFG7JbYbKU5fa1paWryZDrCx1hwimXFM5lvs/fTIimqoNQ9VLnaa8kCRLy5ElOuxJSSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469139; c=relaxed/simple; bh=9iA0Nx5xyOd4qdcwtHqLz0ah1YLccJBqhCPLpQnQrT4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o8InASDa8/OSjOsQWndFD1X6NsiOIh13yIyWCEQJb19MFCYvmb63iri4lqXOL63L4Kv5t2nqvpPF0WPtWSRk/p6QsYVLei1oCUjT97Kn3QKouwnXZ6ooPKl+VDyc7eX5n7I+BYl5AyL5/qY67kypRpCtZjPpf5vYROfcZEYByFQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ROADq/yQ; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ROADq/yQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469137; x=1743005137; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9iA0Nx5xyOd4qdcwtHqLz0ah1YLccJBqhCPLpQnQrT4=; b=ROADq/yQC1kp/yeFvE8NbSacRkxY3t9hQfqUXr9WA9Je7m9XiQj+FT7G TlhYrc5pLkCNHIsmzrQDxows+l6dCoalPF3GsfNehHtCE2Jy6ritrZW66 T2b3druguAqmtmOnJyA/KrFYpkv/vNbBntgZvgfo0IkfroxydGb1CXHuv Hn4ud0ccOsRkGjdc3NV2xC98FFA8k10ofAKZDb4fr/UaTtSf5y49hcRHE PQG808dg7e+60EX8pI3Ozvtt2f3r1brzv1z7TmUx1Uy8ca4HKYuzkMqeR ukef75ZUM0xTcD7WYZXEuCuUk3MWo4l/GiHfN/dR+Y0NYRMsjiqusJL74 A==; X-CSE-ConnectionGUID: MftEZKaLRqaCikZ+iOEAdg== X-CSE-MsgGUID: hqaydPFKTHCmuiyDljlfmA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260486" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260486" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482369" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:58 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 23/34] ASoC: intel: sof_sdw: Factor out SoundWire DAI creation Date: Tue, 26 Mar 2024 11:04:18 -0500 Message-Id: <20240326160429.13560-24-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Factor out the creation of the SoundWire DAI links into a helper function. No functional change. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 50 ++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 9f1c49df9cd2..3e6a758c98ab 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1559,6 +1559,34 @@ static int create_sdw_dailink(struct snd_soc_card *card, return 0; } +static int create_sdw_dailinks(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, int *be_id, + struct sof_sdw_dailink *sof_dais) +{ + struct mc_private *ctx = snd_soc_card_get_drvdata(card); + int ret, i; + + for (i = 0; i < SDW_MAX_LINKS; i++) + ctx->sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE; + + /* generate DAI links by each sdw link */ + while (sof_dais->initialised) { + int current_be_id; + + ret = create_sdw_dailink(card, sof_dais, dai_links, ¤t_be_id); + if (ret) + return ret; + + /* Update the be_id to match the highest ID used for SDW link */ + if (*be_id < current_be_id) + *be_id = current_be_id; + + sof_dais++; + } + + return 0; +} + static int create_ssp_dailinks(struct snd_soc_card *card, struct snd_soc_dai_link **dai_links, int *be_id, struct sof_sdw_codec_info *ssp_info, @@ -1692,7 +1720,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) int num_ends = 0; struct snd_soc_dai_link *dai_links; int num_links; - int i, be_id = 0; + int be_id = 0; int hdmi_num; unsigned long ssp_mask; int ret; @@ -1774,28 +1802,12 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) card->num_links = num_links; /* SDW */ - if (!sdw_be_num) - goto SSP; - - for (i = 0; i < SDW_MAX_LINKS; i++) - ctx->sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE; - - /* generate DAI links by each sdw link */ - while (sof_dais->initialised) { - int current_be_id; - - ret = create_sdw_dailink(card, sof_dais, &dai_links, ¤t_be_id); + if (sdw_be_num) { + ret = create_sdw_dailinks(card, &dai_links, &be_id, sof_dais); if (ret) goto err_end; - - /* Update the be_id to match the highest ID used for SDW link */ - if (be_id < current_be_id) - be_id = current_be_id; - - sof_dais++; } -SSP: /* SSP */ if (ssp_num) { ret = create_ssp_dailinks(card, &dai_links, &be_id, From patchwork Tue Mar 26 16:04:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604593 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 139C213CAA8 for ; Tue, 26 Mar 2024 16:05:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469140; cv=none; b=kU3XiEGVjaeSbdAND0TkR9x8RNXmYCvKrdGRuf37CYYNPgKadLqm3iJLn4id4zcwxnFMD9+cXP1YT1aB5CWA5ePfnOCb3nH7KlZ0BCxyV6PV236gcoAecB7USZgA+rDFs2cskxuo35QCviz1ZyiuK9zDVle5i9O77MmCRK+o4ic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469140; c=relaxed/simple; bh=3BGgqt/NQ1cOKzlyAvCQvOk3uiXzl+v1VYM0btX6ABw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=tNoqqBfGy+ACrh/OG/apAvg4bBj9Baxo1KZu4QYREWLIr/7+pvs/13iEX4HIcbMjDCsoS+2Em/P0/Jui66CC5EKKeDzCP7LauI96+Bau18YTAjEEKoOWrk3pWSeXjaDX/nfw+BZvBq6kyWaakIzPdEKI3fx1gqyMv5Rklz4ZFgs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IkRx+4s5; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IkRx+4s5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469138; x=1743005138; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3BGgqt/NQ1cOKzlyAvCQvOk3uiXzl+v1VYM0btX6ABw=; b=IkRx+4s56/qWsdPwKf/mCa3GtppKRTbZGQGV0i0Vt0n13u58cV8/ztcL jBCQa1MPH2/pOVFD/QDKsPlD6bo7PEk3CvzHtB23N+1j4i/61IDCBlUU4 WurOv6m4uIoKgI49QC4W4Hy6EMNwewH6qQDwlzLF5bW3lav/f4pEuExh8 qD31Ney95Xy6HBb4yFabZ+eOL2QHPCtFsHQdBcXrPhWk1StqWYHOZyDUq QZAkaO/1oP2LKEh+57m8yIClGSrF/aSr3xTwir6b/t1CgUo4p1KK7PPKg Qzctrbbw3z8ZoFcsFLkI3U5k6mVTAx2TaTWxGzqk8UGV1hg72ixEqWC2O Q==; X-CSE-ConnectionGUID: zYPgoY0qTdeseXn7lhxqFg== X-CSE-MsgGUID: mUsfFuBbQPa94aHSh093HA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260494" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260494" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482381" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:04:59 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Chao Song , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart Subject: [PATCH 24/34] ASoC: Intel: sof_sdw: use generic rtd_init function for Realtek SDW DMICs Date: Tue, 26 Mar 2024 11:04:19 -0500 Message-Id: <20240326160429.13560-25-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bard Liao The only thing that the rt_xxx_rtd_init() functions do is to set card->components. And we can set card->components with name_prefix as rt712_sdca_dmic_rtd_init() does. And sof_sdw_rtd_init() will always select the first dai with the given dai->name from codec_info_list[]. Unfortunately, we have different codecs with the same dai name. For example, dai name of rt715 and rt715-sdca are both "rt715-aif2". Using a generic rtd_init allow sof_sdw_rtd_init() run the rtd_init() callback from a similar codec dai. Fixes: 8266c73126b7 ("ASoC: Intel: sof_sdw: add common sdw dai link init") Reviewed-by: Chao Song Reviewed-by: Péter Ujfalusi Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/Makefile | 1 + sound/soc/intel/boards/sof_sdw.c | 12 +++--- sound/soc/intel/boards/sof_sdw_common.h | 1 + sound/soc/intel/boards/sof_sdw_rt_dmic.c | 52 ++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 sound/soc/intel/boards/sof_sdw_rt_dmic.c diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile index bbf796a5f7ba..08cfd4baecdd 100644 --- a/sound/soc/intel/boards/Makefile +++ b/sound/soc/intel/boards/Makefile @@ -42,6 +42,7 @@ snd-soc-sof-sdw-objs += sof_sdw.o \ sof_sdw_rt711.o sof_sdw_rt_sdca_jack_common.o \ sof_sdw_rt712_sdca.o sof_sdw_rt715.o \ sof_sdw_rt715_sdca.o sof_sdw_rt722_sdca.o \ + sof_sdw_rt_dmic.o \ sof_sdw_cs42l42.o sof_sdw_cs42l43.o \ sof_sdw_cs_amp.o \ sof_sdw_dmic.o \ diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 3e6a758c98ab..0e376cb0ce0b 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -749,7 +749,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "rt712-sdca-dmic-aif1", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, - .rtd_init = rt712_sdca_dmic_rtd_init, + .rtd_init = rt_dmic_rtd_init, }, }, .dai_num = 1, @@ -779,7 +779,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "rt712-sdca-dmic-aif1", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, - .rtd_init = rt712_sdca_dmic_rtd_init, + .rtd_init = rt_dmic_rtd_init, }, }, .dai_num = 1, @@ -841,7 +841,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "rt715-aif2", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, - .rtd_init = rt715_sdca_rtd_init, + .rtd_init = rt_dmic_rtd_init, }, }, .dai_num = 1, @@ -856,7 +856,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "rt715-aif2", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, - .rtd_init = rt715_sdca_rtd_init, + .rtd_init = rt_dmic_rtd_init, }, }, .dai_num = 1, @@ -871,7 +871,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "rt715-aif2", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, - .rtd_init = rt715_rtd_init, + .rtd_init = rt_dmic_rtd_init, }, }, .dai_num = 1, @@ -886,7 +886,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "rt715-aif2", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, - .rtd_init = rt715_rtd_init, + .rtd_init = rt_dmic_rtd_init, }, }, .dai_num = 1, diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index e21ef79126b2..decaed97fa74 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -197,6 +197,7 @@ int rt712_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt715_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt715_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd); +int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd); diff --git a/sound/soc/intel/boards/sof_sdw_rt_dmic.c b/sound/soc/intel/boards/sof_sdw_rt_dmic.c new file mode 100644 index 000000000000..9091f5b5c648 --- /dev/null +++ b/sound/soc/intel/boards/sof_sdw_rt_dmic.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (c) 2024 Intel Corporation + +/* + * sof_sdw_rt_dmic - Helpers to handle Realtek SDW DMIC from generic machine driver + */ + +#include +#include +#include +#include +#include "sof_board_helpers.h" +#include "sof_sdw_common.h" + +static const char * const dmics[] = { + "rt715", + "rt712-sdca-dmic", +}; + +int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_card *card = rtd->card; + struct snd_soc_component *component; + struct snd_soc_dai *codec_dai; + char *mic_name; + + codec_dai = get_codec_dai_by_name(rtd, dmics, ARRAY_SIZE(dmics)); + if (!codec_dai) + return -EINVAL; + + component = codec_dai->component; + + /* + * rt715-sdca (aka rt714) is a special case that uses different name in card->components + * and component->name_prefix. + */ + if (!strcmp(component->name_prefix, "rt714")) + mic_name = devm_kasprintf(card->dev, GFP_KERNEL, "rt715-sdca"); + else + mic_name = devm_kasprintf(card->dev, GFP_KERNEL, "%s", component->name_prefix); + + card->components = devm_kasprintf(card->dev, GFP_KERNEL, + "%s mic:%s", card->components, + mic_name); + if (!card->components) + return -ENOMEM; + + dev_dbg(card->dev, "card->components: %s\n", card->components); + + return 0; +} +MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); From patchwork Tue Mar 26 16:04:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604592 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31BEF13CA9C for ; Tue, 26 Mar 2024 16:05:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469139; cv=none; b=rPj/EvSRFvNyzK3EgpyHwlPvHFZ/PzUCLX9fAJsd/0DQRd8NfUQtFG90Pz1+FrlvMuGoJcGjJhB6U8/YDEZOUf6McpsTCEp1woDHQM55V69lI0KlT/BR6wTLT5rsVTTPWYcB4ubi56jzuVhhCNnv86N5kZ4cVqH9c3cswHtuPnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469139; c=relaxed/simple; bh=tREAwQrFehuM87JjX9YUMXsTXTVzigFunxTBdz/OtwY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=nHwSGXCrVc4N8XbBLbC9+WhECpPiIdHHWvovVuqmc2kWfbBCSywItx2n9bl/modMrqBEAIIE3R6FVH46rW4qXtDpv5ka6JjviE8T+xijEj2nLOdxlOHTC98EQr++DJ4gc91gLWxO4WoAlf3Ti+7F+RBqb0cvBjqeh3wCDjTWvP4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XBp94pVp; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XBp94pVp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469138; x=1743005138; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tREAwQrFehuM87JjX9YUMXsTXTVzigFunxTBdz/OtwY=; b=XBp94pVpGpYeMvcpG57xvoysztHG1iiek2PjDDmouCsf6OUoaKzPq+1m 5WeGDE5+hcfw0uQC5JGMbYHuHwRTjqakGE5vDrmBD5Kp58qjG+EcN1x2Q 8EpVdtFfK6EFcsFtH3hfVYbTr+wGNny20+gg3hB9t++il7WK2/n90uV2u X60WuTUTJVDyx5iINAVbNvskgb1JNeWFiJ22ranBR0bTJrtv799yg02iI Fmbt3/TA9a5pi7FV0gXxWpTlm887oTYBDp38Z2hLfTLq8zTpo98IbRv9I P6RuRUh9XktcsV4LL9I22BOJq6nqc2jKPDj4wm+/gQSH3o2txfSrG2nVk Q==; X-CSE-ConnectionGUID: TohCtjqaTLiLhT+ntm58EQ== X-CSE-MsgGUID: VLvHAHr7TiGKWDbAz+JacQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260503" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260503" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482392" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:00 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Chao Song , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart Subject: [PATCH 25/34] ASoC: Intel: sof_sdw: remove unused rt dmic rtd_init Date: Tue, 26 Mar 2024 11:04:20 -0500 Message-Id: <20240326160429.13560-26-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bard Liao Some Realtek SDW DMIC codecs use the generic rt_dmic_rtd_init callback now. Remove unused rtd_init callbacks. Reviewed-by: Chao Song Reviewed-by: Péter Ujfalusi Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/Makefile | 3 +-- sound/soc/intel/boards/sof_sdw_common.h | 3 --- sound/soc/intel/boards/sof_sdw_rt712_sdca.c | 24 ------------------- sound/soc/intel/boards/sof_sdw_rt715.c | 26 --------------------- sound/soc/intel/boards/sof_sdw_rt715_sdca.c | 26 --------------------- 5 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 sound/soc/intel/boards/sof_sdw_rt715.c delete mode 100644 sound/soc/intel/boards/sof_sdw_rt715_sdca.c diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile index 08cfd4baecdd..8f711be46c43 100644 --- a/sound/soc/intel/boards/Makefile +++ b/sound/soc/intel/boards/Makefile @@ -40,8 +40,7 @@ snd-soc-sof-sdw-objs += sof_sdw.o \ sof_sdw_maxim.o sof_sdw_rt_amp.o \ sof_sdw_rt5682.o sof_sdw_rt700.o \ sof_sdw_rt711.o sof_sdw_rt_sdca_jack_common.o \ - sof_sdw_rt712_sdca.o sof_sdw_rt715.o \ - sof_sdw_rt715_sdca.o sof_sdw_rt722_sdca.o \ + sof_sdw_rt712_sdca.o sof_sdw_rt722_sdca.o \ sof_sdw_rt_dmic.o \ sof_sdw_cs42l42.o sof_sdw_cs42l43.o \ sof_sdw_cs_amp.o \ diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index decaed97fa74..84715d9ca942 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -193,10 +193,7 @@ int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd); -int rt712_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); -int rt715_rtd_init(struct snd_soc_pcm_runtime *rtd); -int rt715_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd); diff --git a/sound/soc/intel/boards/sof_sdw_rt712_sdca.c b/sound/soc/intel/boards/sof_sdw_rt712_sdca.c index 9c898c7286af..0c4cd4cdbd45 100644 --- a/sound/soc/intel/boards/sof_sdw_rt712_sdca.c +++ b/sound/soc/intel/boards/sof_sdw_rt712_sdca.c @@ -66,27 +66,3 @@ int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) return ret; } -static const char * const dmics[] = { - "rt712-sdca-dmic" -}; - -int rt712_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_card *card = rtd->card; - struct snd_soc_dai *codec_dai; - struct snd_soc_component *component; - - codec_dai = get_codec_dai_by_name(rtd, dmics, ARRAY_SIZE(dmics)); - if (!codec_dai) - return -EINVAL; - - component = codec_dai->component; - card->components = devm_kasprintf(card->dev, GFP_KERNEL, - "%s mic:%s", - card->components, component->name_prefix); - if (!card->components) - return -ENOMEM; - - return 0; -} -MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); diff --git a/sound/soc/intel/boards/sof_sdw_rt715.c b/sound/soc/intel/boards/sof_sdw_rt715.c deleted file mode 100644 index b5a886cd595d..000000000000 --- a/sound/soc/intel/boards/sof_sdw_rt715.c +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2020 Intel Corporation - -/* - * sof_sdw_rt715 - Helpers to handle RT715 from generic machine driver - */ - -#include -#include -#include -#include -#include "sof_sdw_common.h" - -int rt715_rtd_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_card *card = rtd->card; - - card->components = devm_kasprintf(card->dev, GFP_KERNEL, - "%s mic:rt715", - card->components); - if (!card->components) - return -ENOMEM; - - return 0; -} - diff --git a/sound/soc/intel/boards/sof_sdw_rt715_sdca.c b/sound/soc/intel/boards/sof_sdw_rt715_sdca.c deleted file mode 100644 index 4b37a8a6dd2e..000000000000 --- a/sound/soc/intel/boards/sof_sdw_rt715_sdca.c +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2020 Intel Corporation - -/* - * sof_sdw_rt715_sdca - Helpers to handle RT715-SDCA from generic machine driver - */ - -#include -#include -#include -#include -#include "sof_sdw_common.h" - -int rt715_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_card *card = rtd->card; - - card->components = devm_kasprintf(card->dev, GFP_KERNEL, - "%s mic:rt715-sdca", - card->components); - if (!card->components) - return -ENOMEM; - - return 0; -} - From patchwork Tue Mar 26 16:04:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604594 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BC3613CAAB for ; Tue, 26 Mar 2024 16:05:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469140; cv=none; b=lkQ6Jn3ya6+amRJIJJNydfJv4rIJuiyinFJZuvu9XhhgsjDOlGNSp91q82PHNH8DpYmVnwOx6cqrAi5cTtParKYEfW+9+riOIi/WOYwTKC6sVbBUeTTrXqS8sRPMHBD1pxO7fTQr7t4hrJHyxL82l4370T/uoMwq9MGtwPyTQyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469140; c=relaxed/simple; bh=e9MH3/bUSAe+g9D9Eu1D9KvCn3LzTW9RQuszNLP1B1c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=u3lHhg0FGZGHG7QYlAucO6jQI1Re0noav63GLX61U4IxwvXqAf5KKNE9Va6aKeWetgwefaXLYEadpF6qhxUPHTmASvJFacHFcB/Ub05bM8v+V3ztmNkBJR47aQYlxJLE9YOtNXnjNT2KhSIx/uzR52VkCxK+Ex7EiyjRQjR0q0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TpcobZ+P; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TpcobZ+P" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469139; x=1743005139; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e9MH3/bUSAe+g9D9Eu1D9KvCn3LzTW9RQuszNLP1B1c=; b=TpcobZ+PkrMH9a3DukkXNO8YUGMH7hA7kBhDSp4EdMQxFU4JsiPLuJYO x8TsEwmtOSLGFk+jwC3dSHXF3+Mhw1xeqVUR1KrjXr9hyPwVkp+bpGSGr Dx3Bz6xSn5HUPwqk4fZpW4btnzteO7wzE2EtndGfEC76tJxq718cnawd0 /5pygJtcDutkTDNQP401V+J+JkOTMHWYdf8uXTV5NtzGaXgAKgJpAsgrN H2pJa/IYWfWItMppFEVUiqONa06A1m6f7K5Sghu+lOkQm3rvPicsrEOhI 3GAeS/tlYVkCxd1AdeefgWNhlUX11UaZ7WccTYwrN3NJRRvx/YagYivqb A==; X-CSE-ConnectionGUID: equZTM2xQhCFJ8h7eT14eA== X-CSE-MsgGUID: THVuzUeNTcui220HIuqwpA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260509" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260509" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482410" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:01 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Chao Song , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart Subject: [PATCH 26/34] ASoC: Intel: sof_sdw_rt722_sdca: set rtd_init in codec_info_list[] Date: Tue, 26 Mar 2024 11:04:21 -0500 Message-Id: <20240326160429.13560-27-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bard Liao Add rt722 into rt_sdca_jack_rtd_init() supported list, and set rtd_init callback directly in codec_info_list[]. No need to use a init callback to set the rtd_init callback. Besides, sof_sdw_rt_sdca_jack_init() doesn't set .rtd_init anymore. Reviewed-by: Chao Song Reviewed-by: Péter Ujfalusi Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 5 ++-- sound/soc/intel/boards/sof_sdw_common.h | 14 ++-------- sound/soc/intel/boards/sof_sdw_rt722_sdca.c | 26 ++----------------- .../boards/sof_sdw_rt_sdca_jack_common.c | 2 +- 4 files changed, 8 insertions(+), 39 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 0e376cb0ce0b..bb8429a83467 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -902,6 +902,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, .init = sof_sdw_rt_sdca_jack_init, .exit = sof_sdw_rt_sdca_jack_exit, + .rtd_init = rt_sdca_jack_rtd_init, }, { .direction = {true, false}, @@ -909,14 +910,14 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_type = SOF_SDW_DAI_TYPE_AMP, /* No feedback capability is provided by rt722-sdca codec driver*/ .dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID}, - .init = sof_sdw_rt722_spk_init, + .rtd_init = rt722_spk_rtd_init, }, { .direction = {false, true}, .dai_name = "rt722-sdca-aif3", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, - .init = sof_sdw_rt722_sdca_dmic_init, + .rtd_init = rt722_sdca_dmic_rtd_init, }, }, .dai_num = 3, diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 84715d9ca942..315b2a298195 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -157,18 +157,6 @@ int sof_sdw_rt_amp_init(struct snd_soc_card *card, bool playback); int sof_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); -/* RT722-SDCA support */ -int sof_sdw_rt722_spk_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, - struct snd_soc_dai_link *dai_links, - struct sof_sdw_codec_info *info, - bool playback); -int sof_sdw_rt722_sdca_dmic_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, - struct snd_soc_dai_link *dai_links, - struct sof_sdw_codec_info *info, - bool playback); - /* MAXIM codec support */ int sof_sdw_maxim_init(struct snd_soc_card *card, const struct snd_soc_acpi_link_adr *link, @@ -194,6 +182,8 @@ int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); +int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); +int rt722_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd); diff --git a/sound/soc/intel/boards/sof_sdw_rt722_sdca.c b/sound/soc/intel/boards/sof_sdw_rt722_sdca.c index fe3a2bff95bc..4947d16c70db 100644 --- a/sound/soc/intel/boards/sof_sdw_rt722_sdca.c +++ b/sound/soc/intel/boards/sof_sdw_rt722_sdca.c @@ -27,7 +27,7 @@ static const struct snd_kcontrol_new rt722_spk_controls[] = { SOC_DAPM_PIN_SWITCH("Speaker"), }; -static int rt722_spk_init(struct snd_soc_pcm_runtime *rtd) +int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; int ret; @@ -59,18 +59,7 @@ static int rt722_spk_init(struct snd_soc_pcm_runtime *rtd) return ret; } -int sof_sdw_rt722_spk_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, - struct snd_soc_dai_link *dai_links, - struct sof_sdw_codec_info *info, - bool playback) -{ - dai_links->init = rt722_spk_init; - - return 0; -} - -static int rt722_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) +int rt722_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); @@ -84,14 +73,3 @@ static int rt722_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) return 0; } - -int sof_sdw_rt722_sdca_dmic_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, - struct snd_soc_dai_link *dai_links, - struct sof_sdw_codec_info *info, - bool playback) -{ - dai_links->init = rt722_sdca_dmic_rtd_init; - - return 0; -} diff --git a/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c b/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c index fe59a144efef..006771485486 100644 --- a/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c +++ b/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c @@ -85,7 +85,7 @@ static struct snd_soc_jack_pin rt_sdca_jack_pins[] = { }; static const char * const jack_codecs[] = { - "rt711", "rt712", "rt713" + "rt711", "rt712", "rt713", "rt722" }; int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd) From patchwork Tue Mar 26 16:04:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604595 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A862B13C91A for ; Tue, 26 Mar 2024 16:05:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469141; cv=none; b=Ri7wjEzEtWjGkJirVdRt3xgpdzk3doHcvVsS679cGRLKCfyHZxEsik62JgehvzLT6bZqa9csk9/ik1E9GQ4gt7HTqHNnDq2F8NUGZYKrhsiX8WenYF45TRnVJ8I5FvBJ+UeSarmLmEn8BMWi6a3gLK89DksXvuVj0iAkIAmSU5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469141; c=relaxed/simple; bh=7er5XS8XPkq/Yfz89dHj6ZJt2ktjzUrDT8kk64LCDYc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=QMrwIyX72IG5vPA41ehmJeCVc4TqsqVC1/TqOizYQKDfwtOdXlwSqVRCk9fZox5COnbw1gSCj1V8srbGQo4UYeLdnF+sS3EQgUeA0z1X6PSC1YxPy7h/ylAEI3C3753YhKEtqQPGSddHQVY+wXhkUixAod8jZt1tQNV7AzLopuw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=oBsBHuZ7; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="oBsBHuZ7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469140; x=1743005140; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7er5XS8XPkq/Yfz89dHj6ZJt2ktjzUrDT8kk64LCDYc=; b=oBsBHuZ7I1Zi691w3p+pW2epBKdL7JNahgUfoQ4DbOqMyn3EzNJdQoPv 5TmDJ7kESP2z1cNv/fqRwUIHWIQTMmXhxI+Jo8hhhYpq4RmAw/4DA/DtT 2HyesVadQ5k1NnXzR/OVWAobERdYxF5BYjw4Eq2vwjJgHXv+quEkMvBp4 o+jjlzLbaEmlgYL8xnf39t8KXwD2+1Z57c/3+cPnw+WfeH3Ryg9wtLdi0 IC5OhBqUVYXmcZVKMZ0iW7wl+lMIlv5Ia103B8sHmseGHx0mEF1iixFff 1LqK7YyEditnjvBoZPLuDjcrSFeeRr8eBI05EZ8udzHw3rLmFc3Nn4R+W A==; X-CSE-ConnectionGUID: RDTrtmjnTf25FPaqYeK6Nw== X-CSE-MsgGUID: wKp5lE/1RImwiJwahQMbRw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260516" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260516" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482425" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:01 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Chao Song , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart Subject: [PATCH 27/34] ASoC: Intel: sof_sdw_rt722_sdca: use rt_dmic_rtd_init Date: Tue, 26 Mar 2024 11:04:22 -0500 Message-Id: <20240326160429.13560-28-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bard Liao rt_dmic_rtd_init() can be used for rt722 dmic, too. Reviewed-by: Chao Song Reviewed-by: Péter Ujfalusi Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 2 +- sound/soc/intel/boards/sof_sdw_common.h | 1 - sound/soc/intel/boards/sof_sdw_rt722_sdca.c | 14 -------------- sound/soc/intel/boards/sof_sdw_rt_dmic.c | 1 + 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index bb8429a83467..3874da8d7fe4 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -917,7 +917,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "rt722-sdca-aif3", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, - .rtd_init = rt722_sdca_dmic_rtd_init, + .rtd_init = rt_dmic_rtd_init, }, }, .dai_num = 3, diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 315b2a298195..2132d3fc42f8 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -183,7 +183,6 @@ int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); -int rt722_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd); diff --git a/sound/soc/intel/boards/sof_sdw_rt722_sdca.c b/sound/soc/intel/boards/sof_sdw_rt722_sdca.c index 4947d16c70db..e5c2a36e400b 100644 --- a/sound/soc/intel/boards/sof_sdw_rt722_sdca.c +++ b/sound/soc/intel/boards/sof_sdw_rt722_sdca.c @@ -59,17 +59,3 @@ int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) return ret; } -int rt722_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_card *card = rtd->card; - struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); - struct snd_soc_component *component = codec_dai->component; - - card->components = devm_kasprintf(card->dev, GFP_KERNEL, - "%s mic:%s", - card->components, component->name_prefix); - if (!card->components) - return -ENOMEM; - - return 0; -} diff --git a/sound/soc/intel/boards/sof_sdw_rt_dmic.c b/sound/soc/intel/boards/sof_sdw_rt_dmic.c index 9091f5b5c648..5aec8422656c 100644 --- a/sound/soc/intel/boards/sof_sdw_rt_dmic.c +++ b/sound/soc/intel/boards/sof_sdw_rt_dmic.c @@ -15,6 +15,7 @@ static const char * const dmics[] = { "rt715", "rt712-sdca-dmic", + "rt722-sdca", }; int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) From patchwork Tue Mar 26 16:04:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604596 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6918913C9C3 for ; Tue, 26 Mar 2024 16:05:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469141; cv=none; b=UPuS5qHeK5EZI8S02K0RKepPu7WTW4vxLoBH+G1u6J2yDfN7zLqQpHHP2/jJKIoNKv9OYkiSZ2NNUbFVqY6NO7+LkJxa1DkVP6aJzsrWSGVwJ3R1IHx3fkI2REa/wkxkpgo4dhHCA4nNxFjzd44B7+uSuR3c+jMDyFP0wSi6bIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469141; c=relaxed/simple; bh=CGW9WwILyoWL0VUVn+vNHuA24fw6YkjS/KusTPXlIlk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=HwYT3eHa4mD5XggWofbFW+9L2ahGzcpOB9/WXtQ+yT9Wq2I58z7XK6B3ThGMGZyBJzB9Ur6MpYp2YMwo3ByrlSear3a0ealdQD/KxI/hcEVPKV1TFiYya6lfB38hJiaR4iDrbaYsgJqY6EPs2nhB36a7IkMmqxAYGSwjjv/j3ZM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NmCA9hUm; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NmCA9hUm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469140; x=1743005140; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CGW9WwILyoWL0VUVn+vNHuA24fw6YkjS/KusTPXlIlk=; b=NmCA9hUmeGXf/GurYXAcUn62HYlDsYabe1X+1shVgXfEGFrlXHNnIWLr IyjCwTyT+vtGBc1xHALwVLEuIDwUMN0DazPxn5nvJJ0EEvapWeBti7tyq zN+O5nTcZ7uCg9eqdof/PgH1bMw2kqDuKXDVtZfHMBR0zDD2P/L7BPxCK 5maXQbXsVPIpNBFkaFiq5WYJP9rn9RmtF1B5yh1AhNRDPmzlkwZRR0M0C 8eDSA6EzgH1JJrZNNGJW936JkIphwF5C+9KsNI8Ub+2MXHMvl+Fx0npak XOxbRGKxENU5YF9sZ93vjbt14tDO4V9MhcX3f9+gQoMx1LYcR9Pqe6TKo A==; X-CSE-ConnectionGUID: ie5EYOJVT+6l1mTczRMSMw== X-CSE-MsgGUID: Q7oLV8NZTJq/zc/dr4YtOQ== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260528" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260528" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482438" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:02 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Chao Song , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart Subject: [PATCH 28/34] ASoC: rt715-sdca: rename dai name with rt715-sdca prefix Date: Tue, 26 Mar 2024 11:04:23 -0500 Message-Id: <20240326160429.13560-29-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bard Liao The dai name are the same as rt715 codec. Rename them with rt715-sdca prefix allow machine driver to distinguish rt715 and rt715-sdca from dai name. Reviewed-by: Chao Song Reviewed-by: Péter Ujfalusi Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/codecs/rt715-sdca.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt715-sdca.c b/sound/soc/codecs/rt715-sdca.c index 3fb7b9adb61d..3a6dfe1f6c48 100644 --- a/sound/soc/codecs/rt715-sdca.c +++ b/sound/soc/codecs/rt715-sdca.c @@ -933,7 +933,7 @@ static const struct snd_soc_dai_ops rt715_sdca_ops = { static struct snd_soc_dai_driver rt715_sdca_dai[] = { { - .name = "rt715-aif1", + .name = "rt715-sdca-aif1", .id = RT715_AIF1, .capture = { .stream_name = "DP6 Capture", @@ -945,7 +945,7 @@ static struct snd_soc_dai_driver rt715_sdca_dai[] = { .ops = &rt715_sdca_ops, }, { - .name = "rt715-aif2", + .name = "rt715-sdca-aif2", .id = RT715_AIF2, .capture = { .stream_name = "DP4 Capture", From patchwork Tue Mar 26 16:04:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604597 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2C6F13CAB1 for ; Tue, 26 Mar 2024 16:05:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469142; cv=none; b=ZoTmnuUlZamyG33LJIwA6r65j5oYC1OTW2DNAkc5ksOKaMWyCTMHVKi98fD/7jgiW4G53RyWuryOoMtTYLNkj0zihzcN3Gx862PLDxvsTPw1kzk6WMr4xe4vfq94i2mG1areUY0AHa6ELnTGgTOb0N9lgfPj1enjCKH5YZMc7V4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469142; c=relaxed/simple; bh=YMFANXByotTvz7ZAP+9o35CxIDW0uJSAVkZ2qrDO9cg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=VhtpICfYTaAkVTNiZzwjMj+ZFcbhUTrw6PbKYgmnCDejtCOfoORwcVYoNM1Kuq0JzyqfTbhCdZMUI+REbTQkMdYkKhvKSszm305dzqtCdH+sI9qFlPsrrErh4NGWQMyykWFb1RS0mYpv78omDk+H16k3ziwM+oKRKTnOeLI4reg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QoRa6Ci4; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QoRa6Ci4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469141; x=1743005141; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YMFANXByotTvz7ZAP+9o35CxIDW0uJSAVkZ2qrDO9cg=; b=QoRa6Ci4LyPGLtrw6fR0/xthxEyY5jheGqupjriP6R0F4F1Ftroxaya8 CbumXmROz4rgXf5YBK9EJCY8EOA2LUnzFGoeFxyrkPjZkonwhiAVjlevo nj24osk18LhpF/33tnuWxZpD2+7SBnZrgCyXVf001zQ8sNL1a8tJwQuqB E/B1BmhThAXTXwdjtKmYLsLnlvREVI4b6pCcqnnlU7Hlbv/QhWvXViVw8 ZD/NqFjOvDdteVlyKVyOywStbEQFIzYbnUA0uqayIfOx0Wdfszijhc6WZ CrZIplAfyOs1OQpRvLcCUT2Xmz9pabJZcicynbxXEhg6Myswjjn0YkceK A==; X-CSE-ConnectionGUID: taDVkj+mSwq3jlq+GrhLtA== X-CSE-MsgGUID: Y/hvjmITQk24bnY3lZgieA== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260538" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260538" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482452" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:03 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Chao Song , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart Subject: [PATCH 29/34] ASoC: Intel: sof_sdw: change rt715-sdca dai name Date: Tue, 26 Mar 2024 11:04:24 -0500 Message-Id: <20240326160429.13560-30-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bard Liao As rt715-sdca dai name has been changed in codec driver, we should change it in machine driver, too. Changing the dai name in codec_info_list[] also help sof_sdw_rtd_init() to run .rtd_init() from the same codec. Reviewed-by: Chao Song Reviewed-by: Péter Ujfalusi Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 4 ++-- sound/soc/intel/boards/sof_sdw_rt_dmic.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 3874da8d7fe4..1816ec5dd580 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -838,7 +838,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dais = { { .direction = {false, true}, - .dai_name = "rt715-aif2", + .dai_name = "rt715-sdca-aif2", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, .rtd_init = rt_dmic_rtd_init, @@ -853,7 +853,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dais = { { .direction = {false, true}, - .dai_name = "rt715-aif2", + .dai_name = "rt715-sdca-aif2", .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, .rtd_init = rt_dmic_rtd_init, diff --git a/sound/soc/intel/boards/sof_sdw_rt_dmic.c b/sound/soc/intel/boards/sof_sdw_rt_dmic.c index 5aec8422656c..2f7ed9b31e79 100644 --- a/sound/soc/intel/boards/sof_sdw_rt_dmic.c +++ b/sound/soc/intel/boards/sof_sdw_rt_dmic.c @@ -14,6 +14,7 @@ static const char * const dmics[] = { "rt715", + "rt715-sdca", "rt712-sdca-dmic", "rt722-sdca", }; From patchwork Tue Mar 26 16:04:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604598 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0201213CAB0 for ; Tue, 26 Mar 2024 16:05:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469142; cv=none; b=gCZLSg2VI54kxWVCUOjeDgzOy86/QmfCqjctlupPGKOtGYx2OEsNyphnT3H1+shMHvNVORGx5YAbJ80JtMqx7+U1Za0/dqi7E0oTeRbPU6VkeycosO1wxWLlT02OURZNJql4HISEqqiedKgv5c6xsKhtExhCwzhaDQdNSuMWFaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469142; c=relaxed/simple; bh=O+Ky+A2ECkzCjjUcmHynmaUbtkzO/Mm/j1upGJTjpl4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=km3gpZE6k5xhctXXSECinylkhFTmRho++CBwYPsnxFqzCuz0bTsGQmkPoe8BlrUWnPs6rjqobxq/UduzeqtMzcmwRgWGyyhordj2aZ1UGiX9LpewSLvL82pvg7+fejEXjczCTohi5/C+zONJRaXhN5L3028o46YvAGm/nBRAn3k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AxkX7TtX; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AxkX7TtX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469141; x=1743005141; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O+Ky+A2ECkzCjjUcmHynmaUbtkzO/Mm/j1upGJTjpl4=; b=AxkX7TtXbiVHBMTfVtkGE6GfYqrMvLm59DPH6iw1zGSz6xzF7ilmxT4C Wba1KLIKS/7OC3Q4qVTCy3GFIy51CWhU4+HzRICAqP50uFmWl28RY/TOO 9qopMpzjFQAiMj5Zbo14V169Q1M2RJEyH3v88/KaP9OKMqDAHpG8UhU2Y Kwrxyu9RVvpr4ITXY9823HJBey7zfRXEVR/S9emCTXJr0xBt1Zsi3OA9i llvdJntmN1jrmeWrteCG9yMd8l8rQzIdMfE/bG3t9pDFzcfuXjSt/alGt qnwA5Alr4exEy8MChn7Zy9878kjaiR5JC/zvUbdduZt/RP+FLioXAAUpK w==; X-CSE-ConnectionGUID: U51vsnqxTBmeVs1Z4DCUfw== X-CSE-MsgGUID: O0ZSCuFdQD+6qfKBD2kXBw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260547" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260547" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482479" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:04 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Chao Song , Pierre-Louis Bossart Subject: [PATCH 30/34] ASoC: Intel: change cs35l56 name_prefix Date: Tue, 26 Mar 2024 11:04:25 -0500 Message-Id: <20240326160429.13560-31-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bard Liao To use sequential amp numbers. I,e, AMP1, AMP2, AMP3, AMP4 Reviewed-by: Chao Song Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/common/soc-acpi-intel-mtl-match.c | 4 ++-- sound/soc/intel/common/soc-acpi-intel-tgl-match.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c index e06efc5b1457..7e53266d831d 100644 --- a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c @@ -373,13 +373,13 @@ static const struct snd_soc_acpi_adr_device cs35l56_1_adr[] = { .adr = 0x00013701FA355601ull, .num_endpoints = 1, .endpoints = &spk_r_endpoint, - .name_prefix = "AMP8" + .name_prefix = "AMP3" }, { .adr = 0x00013601FA355601ull, .num_endpoints = 1, .endpoints = &spk_3_endpoint, - .name_prefix = "AMP7" + .name_prefix = "AMP4" } }; diff --git a/sound/soc/intel/common/soc-acpi-intel-tgl-match.c b/sound/soc/intel/common/soc-acpi-intel-tgl-match.c index 007f1ac2327a..0cef3d788a5b 100644 --- a/sound/soc/intel/common/soc-acpi-intel-tgl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-tgl-match.c @@ -464,13 +464,13 @@ static const struct snd_soc_acpi_adr_device cs35l56_1_adr[] = { .adr = 0x00013701FA355601ull, .num_endpoints = 1, .endpoints = &spk_l_endpoint, - .name_prefix = "AMP8" + .name_prefix = "AMP3" }, { .adr = 0x00013601FA355601ull, .num_endpoints = 1, .endpoints = &spk_2_endpoint, - .name_prefix = "AMP7" + .name_prefix = "AMP4" } }; From patchwork Tue Mar 26 16:04:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604599 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C7E913C91A for ; Tue, 26 Mar 2024 16:05:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469143; cv=none; b=LuoqnjdBQUVBmUvvmJEfBOeN52hB+pn0aL1+xsCldfGlU3voQzw8Z827aEth8eVpDEg6ie55ozd8x8qzTNPBJQVNPW9gat3jublg+UkLXFuNFQKxiiEB2k+nXB7Rmf8sM20+ajwk5Fw3V+NFGgxXHw/NtLrLmw0jIamVvj4KTUE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469143; c=relaxed/simple; bh=aLofAmgiA4bnXj15hLD9xEl99RidpdrTrPZVO++o2Fk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nCGpalZvuw55yUKMJL518K4O8foOOlZKxfbV5jaY8qXIpimbkGcYXcjPoGViDHWt7RJF6J5MOyE/1JT3SfM/zc8/ZCyDVzy13eA2t/Kf36WLO9fn+SHVLBZRZOG9snOzIf9gxRWhIBeny1J4p45Sbz+PKBKDQSsXX8IDm3acp6A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QChEngV2; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QChEngV2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469141; x=1743005141; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aLofAmgiA4bnXj15hLD9xEl99RidpdrTrPZVO++o2Fk=; b=QChEngV27YstRuiticQHYjEu3fbSxS6AVShoil7BPe2c/IXkmu/gFt/y GRqqgwbP/3Pg/qF5RDwr82TZi+z98/mj9DFWOJk4Es+bH0/DnFRnSZSsh 1r49NCNgoh+GCbaO9467Igu8RWX8CU4rzyRrXBbxveQFk6CIwnPNYN1nf zkJchEZ3CNM914slQj9vImwkJ8F9hcUWMu0gYHG4oktj0qLOSex5sCu7g 2zM1R3qRW0ajtRYU3XQZU4NdFpH+JO1+qaPBDqqlR6ApvLLdeoEbjNNJY ganUAiTiQgVE8se5u/Sb6JmoyAkaOJpGhV8IpaDxpSuurwNp4sCez+Ujx A==; X-CSE-ConnectionGUID: QyYjOOjsRS+kQKgu0UL4ZA== X-CSE-MsgGUID: YCMAn+etRDe17F//8YmQ+A== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260555" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260555" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482485" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:05 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 31/34] ASoC: Intel: sof_sdw: Don't pass acpi_link_adr to init functions Date: Tue, 26 Mar 2024 11:04:26 -0500 Message-Id: <20240326160429.13560-32-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax There is no need to pass the snd_soc_acpi_link_adr structure to the init functions, it conveys no specific information about the codec. Remove this parameter from the callbacks Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 7 ++----- sound/soc/intel/boards/sof_sdw_common.h | 6 ------ sound/soc/intel/boards/sof_sdw_cs_amp.c | 1 - sound/soc/intel/boards/sof_sdw_maxim.c | 1 - sound/soc/intel/boards/sof_sdw_rt711.c | 1 - sound/soc/intel/boards/sof_sdw_rt_amp.c | 1 - sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c | 1 - 7 files changed, 2 insertions(+), 16 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 1816ec5dd580..f3167e3498e0 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1273,7 +1273,6 @@ struct sof_sdw_endpoint { u32 link_mask; const char *codec_name; - const struct snd_soc_acpi_link_adr *adr_link; struct sof_sdw_codec_info *codec_info; const struct sof_sdw_dai_info *dai_info; }; @@ -1425,7 +1424,6 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, sof_end->link_mask = adr_link->mask; sof_end->codec_name = codec_name; - sof_end->adr_link = adr_link; sof_end->codec_info = codec_info; sof_end->dai_info = dai_info; sof_end++; @@ -1548,8 +1546,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, list_for_each_entry(sof_end, &sof_dai->endpoints, list) { if (sof_end->dai_info->init) - sof_end->dai_info->init(card, sof_end->adr_link, - *dai_links, + sof_end->dai_info->init(card, *dai_links, sof_end->codec_info, playback); } @@ -1612,7 +1609,7 @@ static int create_ssp_dailinks(struct snd_soc_card *card, if (ret) return ret; - ret = ssp_info->dais[0].init(card, NULL, *dai_links, ssp_info, 0); + ret = ssp_info->dais[0].init(card, *dai_links, ssp_info, 0); if (ret < 0) return ret; diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 2132d3fc42f8..8d8c2ca68a7f 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -74,7 +74,6 @@ struct sof_sdw_dai_info { const int dai_type; const int dailink[2]; /* dailink id for each direction */ int (*init)(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback); @@ -132,7 +131,6 @@ int sof_sdw_dmic_init(struct snd_soc_pcm_runtime *rtd); /* RT711 support */ int sof_sdw_rt711_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback); @@ -140,7 +138,6 @@ int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_l /* RT711-SDCA support */ int sof_sdw_rt_sdca_jack_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback); @@ -151,7 +148,6 @@ extern struct snd_soc_ops sof_sdw_rt1308_i2s_ops; /* generic amp support */ int sof_sdw_rt_amp_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback); @@ -159,14 +155,12 @@ int sof_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_ /* MAXIM codec support */ int sof_sdw_maxim_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback); /* CS AMP support */ int sof_sdw_cs_amp_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback); diff --git a/sound/soc/intel/boards/sof_sdw_cs_amp.c b/sound/soc/intel/boards/sof_sdw_cs_amp.c index 56cf75bc6cc4..e29a586ce7c0 100644 --- a/sound/soc/intel/boards/sof_sdw_cs_amp.c +++ b/sound/soc/intel/boards/sof_sdw_cs_amp.c @@ -57,7 +57,6 @@ int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) } int sof_sdw_cs_amp_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback) diff --git a/sound/soc/intel/boards/sof_sdw_maxim.c b/sound/soc/intel/boards/sof_sdw_maxim.c index 034730432671..432e5112415a 100644 --- a/sound/soc/intel/boards/sof_sdw_maxim.c +++ b/sound/soc/intel/boards/sof_sdw_maxim.c @@ -139,7 +139,6 @@ static int mx8373_sdw_late_probe(struct snd_soc_card *card) } int sof_sdw_maxim_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback) diff --git a/sound/soc/intel/boards/sof_sdw_rt711.c b/sound/soc/intel/boards/sof_sdw_rt711.c index 9762c48ba7a9..7e54fc5cbe09 100644 --- a/sound/soc/intel/boards/sof_sdw_rt711.c +++ b/sound/soc/intel/boards/sof_sdw_rt711.c @@ -158,7 +158,6 @@ int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_l } int sof_sdw_rt711_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback) diff --git a/sound/soc/intel/boards/sof_sdw_rt_amp.c b/sound/soc/intel/boards/sof_sdw_rt_amp.c index 202edab95000..1b415708500e 100644 --- a/sound/soc/intel/boards/sof_sdw_rt_amp.c +++ b/sound/soc/intel/boards/sof_sdw_rt_amp.c @@ -281,7 +281,6 @@ int sof_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_ } int sof_sdw_rt_amp_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback) diff --git a/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c b/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c index 006771485486..85c09513bc35 100644 --- a/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c +++ b/sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c @@ -191,7 +191,6 @@ int sof_sdw_rt_sdca_jack_exit(struct snd_soc_card *card, struct snd_soc_dai_link } int sof_sdw_rt_sdca_jack_init(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback) From patchwork Tue Mar 26 16:04:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604601 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08C4F13CAB6 for ; Tue, 26 Mar 2024 16:05:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469144; cv=none; b=ZHIERaHR2zqC0OEnlsNitk1tJCqC86MXus3J9raYfKDKKpc8KkilfLSTwoaDiViVWAN4gVKP8Fgm5nWPkq6HJRj4ONjftoiOn0ejMz2BCUJX6ImUJYW0aVZ8xtm1DgKOfin+6K2c61XbT65swlUFZkNtvh9hnV91aHWvCSoDZT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469144; c=relaxed/simple; bh=n0IrftS1xYbcXY1GHXbLYZmk8QtdkWZ1bDvJPlTyUtw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gpikxMfk5CgRr2FdRDPWK6XBSR0PtmAXPrYu1sjQwR/5gxiauTL8rsofgWHRiiyXiYRGDRC18GeoZK4U94QfxrGwJuvBfTAsVFOIpzWMKjp4fnGFkUweKEL90DrzUNZg7Ln8tuYPWuJ82XliI7VbZi3NmN4I4ZbNhCc7fg7tecg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bH5y2uQp; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bH5y2uQp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469142; x=1743005142; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n0IrftS1xYbcXY1GHXbLYZmk8QtdkWZ1bDvJPlTyUtw=; b=bH5y2uQp7CqV4MRCx1zmXsKzrn/hbbAZlk7qK6/gIBZ8Ju3rwsfduIMg J+EZWlQS+C8oReYC9IvZbGFsMZKRcd+ScTYiJoAyB1vN8Dzxs3tfCg/0e 4EJ4qVlvwbhro7of2DSZoUamJhutetE7qpJ7ZlggsH0DEO+F1cZ36VmjX M7RcxdJbqmKtVW2v1QqqHbjY6NAef4hCIghXWp4w+1phSTQlXr5VBZ+lI c7xr1gvqpBU9HS+CquW1tdGzlQBiMAfTNWQjrWQM9i7a9fIOEgfWL05hQ UmrGyLEpsXmkieH0yAofxeY1qVWKqHWjl3Z97W4++SUZn8kCG+z9n1MO9 w==; X-CSE-ConnectionGUID: U3Lw6tUfT1CUp77DLTeyTA== X-CSE-MsgGUID: eHjAHWcRQRCcphO1hh2DMw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260565" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260565" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482498" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:05 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 32/34] ASoC: Intel: sof_sdw: Remove redundant initialisations Date: Tue, 26 Mar 2024 11:04:27 -0500 Message-Id: <20240326160429.13560-33-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Unspecified fields are by default initialised to zero, remove redundant init pointer initialisations. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index f3167e3498e0..5a7014d82d6c 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1026,7 +1026,6 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "sdw-mockup-aif1", .dai_type = SOF_SDW_DAI_TYPE_JACK, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, - .init = NULL, }, }, .dai_num = 1, @@ -1040,7 +1039,6 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "sdw-mockup-aif1", .dai_type = SOF_SDW_DAI_TYPE_JACK, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, - .init = NULL, }, }, .dai_num = 1, @@ -1054,7 +1052,6 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_name = "sdw-mockup-aif1", .dai_type = SOF_SDW_DAI_TYPE_AMP, .dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID}, - .init = NULL, }, }, .dai_num = 1, @@ -1068,7 +1065,6 @@ static struct sof_sdw_codec_info codec_info_list[] = { .direction = {false, true}, .dai_type = SOF_SDW_DAI_TYPE_MIC, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, - .init = NULL, }, }, .dai_num = 1, From patchwork Tue Mar 26 16:04:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604602 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AC5B13C9A2 for ; Tue, 26 Mar 2024 16:05:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469145; cv=none; b=JhXQzO7z2pYBx1a/hUYfF7H85Fne60zxJ0vQEmqbkmqDNzpGqGmsjjQ2qXL36H0OdOxu+ZkjKm5Bxdkt1PwVL+LCE1+4Zb8r9/7CjVvkccXoVkvyF/tSEJ+582sSef4llbQ3S1xl/pxPhxOBhkljB1SauQSnRce9WuncecEHvB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469145; c=relaxed/simple; bh=ZgXWLJa803Tcz4lHMH5IzQhQvBYtscxSaM1zxM0uUrc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vAxuC/3fiVeC59U0yMtKwaii8tPaWJ7LogoHKMGGyFoL819zuVsaKBANQu84hhJYN4f3Rfi/h00WeebfDNgy8XRmTlN92Tfr7mLKnfdLJglgHAR0l95YHqaQSiPnfkojLW/T8BrzXzVVp/pdU8MfEaXsy+vuwfwSJJI1q5dxBTE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Af+zl8RV; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Af+zl8RV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469142; x=1743005142; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZgXWLJa803Tcz4lHMH5IzQhQvBYtscxSaM1zxM0uUrc=; b=Af+zl8RVSzYM1V/06q7ZznC5+puGrZrN2xwHBVwruJg0odSfn4KvFHVm Yu2gcJZelTHFExZbRSP27bhHzZMVFe/VV4IHpk/RQhDuyuZmqej0GBM9k T3nB95zt8Po1UJKfIIGLzHGqkfUtUnv3upzRMAysXXVpSeozrt75tqeP5 yHJ9FojKZuRFN3GpJQLqZyEkjN5lYBV3WNC3MuFGI2E6glkAQhTmSGO/E QFjZkSVUYnC7PU/QuC9lOwuJ2J6n5BHZuaJQmKDIbzZzv2o057Z6cUsAe Nhtx6mFC3liFZGpsRZCVjO7ZgUDce/3EvhvlbGh/BuI1uN2irm+eaDq7B A==; X-CSE-ConnectionGUID: tzfmpBwrS9uxwRkK/FOljQ== X-CSE-MsgGUID: ERy7K+JlSRCKT0al8pIV3A== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260574" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260574" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482510" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:06 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 33/34] ASoC: Intel: sof_sdw: Add quirk for optional codec speakers Date: Tue, 26 Mar 2024 11:04:28 -0500 Message-Id: <20240326160429.13560-34-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Some codecs have speaker drivers that may or may not be used in a given system. Add a quirk (SOF_CODEC_SPKR) that defines if a system uses the codec speaker, this is kept generic such that any codec with such a speaker DAI can reuse the quirk. For implementation of this, add a quirk field into the sof_sdw_dai_info structure. This field is not used to specify if a system uses a particular quirk, that is still done through the sof_sdw_quirk variable, this field is used to flag a DAI as conditional on a certain quirk. This means the DAI will only be included in the card if sof_sdw_quirk and the DAI quirk field have a matching set bit. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 5 +++++ sound/soc/intel/boards/sof_sdw_common.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 5a7014d82d6c..4fc15f597e28 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -37,6 +37,8 @@ static void log_quirks(struct device *dev) SOF_SSP_GET_PORT(sof_sdw_quirk)); if (sof_sdw_quirk & SOF_SDW_NO_AGGREGATION) dev_err(dev, "quirk SOF_SDW_NO_AGGREGATION enabled but no longer supported\n"); + if (sof_sdw_quirk & SOF_CODEC_SPKR) + dev_dbg(dev, "quirk SOF_CODEC_SPKR enabled\n"); } static int sof_sdw_quirk_cb(const struct dmi_system_id *id) @@ -1382,6 +1384,9 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, dai_info = &codec_info->dais[adr_end->num]; sof_dai = find_dailink(sof_dais, adr_end); + if (dai_info->quirk && !(dai_info->quirk & sof_sdw_quirk)) + continue; + dev_dbg(dev, "Add dev: %d, 0x%llx end: %d, %s, %c/%c to %s: %d\n", ffs(adr_link->mask) - 1, adr_dev->adr, diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 8d8c2ca68a7f..81181627b406 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -52,6 +52,8 @@ enum { #define SOF_SSP_GET_PORT(quirk) (((quirk) >> 7) & GENMASK(5, 0)) /* Deprecated and no longer supported by the code */ #define SOF_SDW_NO_AGGREGATION BIT(14) +/* If a CODEC has an optional speaker output, this quirk will enable it */ +#define SOF_CODEC_SPKR BIT(15) /* BT audio offload: reserve 3 bits for future */ #define SOF_BT_OFFLOAD_SSP_SHIFT 15 @@ -80,6 +82,7 @@ struct sof_sdw_dai_info { int (*exit)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); int (*rtd_init)(struct snd_soc_pcm_runtime *rtd); bool rtd_init_done; /* Indicate that the rtd_init callback is done */ + unsigned long quirk; }; struct sof_sdw_codec_info { From patchwork Tue Mar 26 16:04:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13604600 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F28CD13CABC for ; Tue, 26 Mar 2024 16:05:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469144; cv=none; b=U7PKMpvGffWlJwzXBWOVJStaAWK8DVi50kjU4QKXlcJHgg2VETJfrRaacGAPoH2MnSx5VjvID5SqnlokgHz+W6x7vEn3uDtRsxk6dgpsyqciLz5WxePV2SDRms8kQqlbHTiCLNDE+whBr5dsP0RwajYwpZbzjsetXq1pYOMvHwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711469144; c=relaxed/simple; bh=un6JUsVkZ+4aDf8r/KdzFVrt0MBjo+jMm6gVJfWVgjU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CYuLKcJqVcv77+9ji3qjPOrKnI3T0nHgAd1p+/MYt3tHDRCyFtJIJ8msR83arwG32Ur8yVNYcnQVEITe4GG/6iUY11ZS+MqrkcF2Ze0CTfl2Y3+S48hWdgmleuJ+SIJQJMhY6BPItwluGLwsn5c5sEUNcvRoCTjt0+Uzk+gP0y4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NYqAp2Ad; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NYqAp2Ad" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711469143; x=1743005143; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=un6JUsVkZ+4aDf8r/KdzFVrt0MBjo+jMm6gVJfWVgjU=; b=NYqAp2Adma/S1Q+Ki32LOIkOwJqGU5zmNyqp/elolAPxlDf7jHjUL7ap L/k7DWzFUtJmlnJTIiUTjzVtjTIdkqXNp7qryrUAy5Tq8PCIDlCjcwVZO TKJJTqXW/gPfEzJ2cG+ExSvjL+F7nO+Kxo3O0A/0m7kPQM+ZK9NAHbZ4b uqNTvMZ3YqqinTKvhRxk3WlTDD9POlTtT0PRbC+iQvjASraLcNA959YBZ GuHbDEj316S9Kj7cR2gQpxj9AWByUnShJflwqnrthbp4DWAhta1OyBr7a iSGXyGzU3KaKlXMLP1o1hl6Mmvxn+rvxXEkvBEZKpy0ErRhHZVPxONxfU Q==; X-CSE-ConnectionGUID: ZySxeup0Q8+ZoppJSkbQxQ== X-CSE-MsgGUID: /KZLFhX9RZuuAE3MjYRafw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17260584" X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="17260584" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,156,1708416000"; d="scan'208";a="20482520" Received: from bhubbert-mobl.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.65.108]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 09:05:07 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Charles Keepax , Richard Fitzgerald , Shuming Fan , Jack Yu , Oder Chiou , Bard liao , Pierre-Louis Bossart Subject: [PATCH 34/34] ASoC: Intel: sof_sdw: Add support for cs42l43 optional speaker output Date: Tue, 26 Mar 2024 11:04:29 -0500 Message-Id: <20240326160429.13560-35-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> References: <20240326160429.13560-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Charles Keepax Add support for the optional speaker output on the cs42l43, this uses the new SOF_CODEC_SPKR quirk to conditional include the speaker DAI link. It is worth noting that currently no systems are included that utilise this feature, but the feature is added as several systems are on the horizon. As part of this SOF_SDW_MAX_DAI_NUM must be increased, it is currently 3 but cs42l43 will now have 4 DAI links. This value is increased to 8 to give some head room for future devices. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 11 +++- sound/soc/intel/boards/sof_sdw_common.h | 9 +++- sound/soc/intel/boards/sof_sdw_cs42l43.c | 50 +++++++++++++++++++ .../intel/common/soc-acpi-intel-mtl-match.c | 6 +++ .../intel/common/soc-acpi-intel-tgl-match.c | 6 +++ 5 files changed, 80 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 4fc15f597e28..b94835448b1b 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1016,8 +1016,17 @@ static struct sof_sdw_codec_info codec_info_list[] = { .dai_type = SOF_SDW_DAI_TYPE_JACK, .dailink = {SDW_UNUSED_DAI_ID, SDW_JACK_IN_DAI_ID}, }, + { + .direction = {true, false}, + .dai_name = "cs42l43-dp6", + .dai_type = SOF_SDW_DAI_TYPE_AMP, + .dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID}, + .init = sof_sdw_cs42l43_spk_init, + .rtd_init = cs42l43_spk_rtd_init, + .quirk = SOF_CODEC_SPKR, + }, }, - .dai_num = 3, + .dai_num = 4, }, { .part_id = 0xaaaa, /* generic codec mockup */ diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 81181627b406..8468487a6bd6 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -66,7 +66,7 @@ enum { #define SOF_SDW_DAI_TYPE_AMP 1 #define SOF_SDW_DAI_TYPE_MIC 2 -#define SOF_SDW_MAX_DAI_NUM 3 +#define SOF_SDW_MAX_DAI_NUM 8 struct sof_sdw_codec_info; @@ -162,6 +162,12 @@ int sof_sdw_maxim_init(struct snd_soc_card *card, struct sof_sdw_codec_info *info, bool playback); +/* CS42L43 support */ +int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card, + struct snd_soc_dai_link *dai_links, + struct sof_sdw_codec_info *info, + bool playback); + /* CS AMP support */ int sof_sdw_cs_amp_init(struct snd_soc_card *card, struct snd_soc_dai_link *dai_links, @@ -172,6 +178,7 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card, int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd); +int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); diff --git a/sound/soc/intel/boards/sof_sdw_cs42l43.c b/sound/soc/intel/boards/sof_sdw_cs42l43.c index a9b6edac2ecd..5361249f0f53 100644 --- a/sound/soc/intel/boards/sof_sdw_cs42l43.c +++ b/sound/soc/intel/boards/sof_sdw_cs42l43.c @@ -30,6 +30,17 @@ static const struct snd_soc_dapm_route cs42l43_hs_map[] = { { "cs42l43 ADC1_IN1_N", NULL, "Headset Mic" }, }; +static const struct snd_soc_dapm_widget cs42l43_spk_widgets[] = { + SND_SOC_DAPM_SPK("Speaker", NULL), +}; + +static const struct snd_soc_dapm_route cs42l43_spk_map[] = { + { "Speaker", NULL, "cs42l43 AMP1_OUT_P", }, + { "Speaker", NULL, "cs42l43 AMP1_OUT_N", }, + { "Speaker", NULL, "cs42l43 AMP2_OUT_P", }, + { "Speaker", NULL, "cs42l43 AMP2_OUT_N", }, +}; + static const struct snd_soc_dapm_widget cs42l43_dmic_widgets[] = { SND_SOC_DAPM_MIC("DMIC", NULL), }; @@ -108,6 +119,45 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd) return ret; } +int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_card *card = rtd->card; + int ret; + + card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s spk:cs42l43-spk", + card->components); + if (!card->components) + return -ENOMEM; + + ret = snd_soc_dapm_new_controls(&card->dapm, cs42l43_spk_widgets, + ARRAY_SIZE(cs42l43_spk_widgets)); + if (ret) { + dev_err(card->dev, "cs42l43 speaker widgets addition failed: %d\n", ret); + return ret; + } + + ret = snd_soc_dapm_add_routes(&card->dapm, cs42l43_spk_map, + ARRAY_SIZE(cs42l43_spk_map)); + if (ret) + dev_err(card->dev, "cs42l43 speaker map addition failed: %d\n", ret); + + return ret; +} + +int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card, + struct snd_soc_dai_link *dai_links, + struct sof_sdw_codec_info *info, + bool playback) +{ + /* Do init on playback link only. */ + if (!playback) + return 0; + + info->amp_num++; + + return 0; +} + int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; diff --git a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c index 7e53266d831d..27d1313e6686 100644 --- a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c @@ -357,6 +357,12 @@ static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { .group_position = 0, .group_id = 0, }, + { /* Speaker Playback Endpoint */ + .num = 3, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, }; static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { diff --git a/sound/soc/intel/common/soc-acpi-intel-tgl-match.c b/sound/soc/intel/common/soc-acpi-intel-tgl-match.c index 0cef3d788a5b..77226d1eb1cf 100644 --- a/sound/soc/intel/common/soc-acpi-intel-tgl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-tgl-match.c @@ -433,6 +433,12 @@ static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { .group_position = 0, .group_id = 0, }, + { /* Speaker Playback Endpoint */ + .num = 3, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, }; static const struct snd_soc_acpi_adr_device cs42l43_3_adr[] = {