From patchwork Fri Apr 26 15:38: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: 13645018 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 11DDB18C1F for ; Fri, 26 Apr 2024 15:39:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145955; cv=none; b=XGMtsghlbPJrp5z5ndsGP63lxYdwWqWurTa94AeatdUEWLj6yz6bkQReBpYmZ1WPSU+mJCBPBguS7mV6CXm2nMG335tWK7lx5JylyCai5fNmQk39Y97ljtezxW1Mt6jPI01fhthyvNfZ+WLb+3I8XIC1RUJAkoHllh83iMQqlA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145955; c=relaxed/simple; bh=8MLGSPpRbokfwbPdOKbZ3oBufJnpAtGiJAq0XBz63do=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KN7a8Ge7kW9OQvoLhV5dBm3w0f8ODaXqws09XADpYRZOJb+f+AdcPbevP6m7KOglqOvBWSihLmFbzvwoGhRM1Tb66fzjULNF9PphBB5dEV+55SR+1HfeilBhjyDLy/66zN7QSu9sDU+GmZo6RAZ3WUl6UFRCDvzUWqtE+NW8J9c= 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=YoJGisxc; arc=none smtp.client-ip=198.175.65.20 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="YoJGisxc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714145954; x=1745681954; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8MLGSPpRbokfwbPdOKbZ3oBufJnpAtGiJAq0XBz63do=; b=YoJGisxccYKmqYkMTojvs8FepUM6fJNVBqYXNLNYUXCMkrXsp/c2bSnd tB6YpwETZFNf085v5XbB9WvHlD595Uv6qgTNig8n99QSrHiYPK6HWnwsv dB5un6l67z787kyOk6L/5aHaix5l5qEosyD9+JlMybSrCcw+Xxs/FFdDW IRJzEwFuWh11HzcMx14ECWJnVcujM7VxydFO+NhO9nfV+2EBV4W8dgF3P 3ZtgVyJmUdzXJK9Ml0OIwv7gZS+rCU1lwUzFdeiVoaUlwCXebxWbMuOZ7 MTNXct4IQ6osorO1gOZgCz+cNsHWWtgTVlpdgzKmIrZoZVU/vW2f822EJ w==; X-CSE-ConnectionGUID: X55RC5VITJ+I2zeG7vc6uQ== X-CSE-MsgGUID: 4F6X3Zq4SzaVrI8UazQb8A== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="9718430" X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="9718430" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:10 -0700 X-CSE-ConnectionGUID: nEyCFAHgTFuh+0Cisk8NNw== X-CSE-MsgGUID: Z1bahMjnTdua3tUON08/bQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="56623536" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:10 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Marc Herbert , Pierre-Louis Bossart Subject: [PATCH 1/5] ASoC: SOF: debug: Handle cases when fw_lib_prefix is not set, NULL Date: Fri, 26 Apr 2024 10:38:58 -0500 Message-Id: <20240426153902.39560-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426153902.39560-1-pierre-louis.bossart@linux.intel.com> References: <20240426153902.39560-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: Peter Ujfalusi The firmware libraries are not supported by IPC3, the fw_lib_path is not a valid parameter and it is always NULL. Do not create the debugfs file for IPC3 at all as it is not applicable. With IPC4 some vendors/platforms might not support loadable libraries and the fw_lib_prefix is left to NULL to indicate this. Handle such case with allocating "Not supported" string. Reviewed-by: Marc Herbert Fixes: 17f4041244e6 ("ASoC: SOF: debug: show firmware/topology prefix/names") Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/debug.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c index cf282c8b18af..bf635cc96ede 100644 --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -326,8 +326,27 @@ int snd_sof_dbg_init(struct snd_sof_dev *sdev) debugfs_create_str("fw_path", 0444, fw_profile, (char **)&plat_data->fw_filename_prefix); - debugfs_create_str("fw_lib_path", 0444, fw_profile, - (char **)&plat_data->fw_lib_prefix); + /* library path is not valid for IPC3 */ + if (plat_data->ipc_type != SOF_IPC_TYPE_3) { + /* + * fw_lib_prefix can be NULL if the vendor/platform does not + * support loadable libraries + */ + if (plat_data->fw_lib_prefix) { + debugfs_create_str("fw_lib_path", 0444, fw_profile, + (char **)&plat_data->fw_lib_prefix); + } else { + static char *fw_lib_path; + + fw_lib_path = devm_kasprintf(sdev->dev, GFP_KERNEL, + "Not supported"); + if (!fw_lib_path) + return -ENOMEM; + + debugfs_create_str("fw_lib_path", 0444, fw_profile, + (char **)&fw_lib_path); + } + } debugfs_create_str("tplg_path", 0444, fw_profile, (char **)&plat_data->tplg_filename_prefix); debugfs_create_str("fw_name", 0444, fw_profile, From patchwork Fri Apr 26 15:38: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: 13645017 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 C412C148FF0 for ; Fri, 26 Apr 2024 15:39:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145955; cv=none; b=tHxNrnlOxRUDaLWB7+evP38UqNnbw99a4YkoQI0VllS0VQKZEnE6xawuSQ9GkhY0u5LdgiLJM/81OZ26ToCkjQWQX8gfDrNuBhBFwjHeMT+/aQ0NZ9uIG901SS/pneXZ8w4rCULkVKG2htXhjfPULlEXU19D1/A+yihcIMagcBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145955; c=relaxed/simple; bh=flcFCyFG2/t8hSowAIB01UznDgaflhSitPfuUrp0c60=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gtjPomVG6ijLCznAin7afiwHwyfV6UOHBcjP139W3m6QXXU5ry1yGuS/5OJxGWEha2Myi0079ztt3eXXG3hD5hBjC1n14cEEeOzk2bE841EhPUh97sCFS9L1zz0uVZlHLG31po7F2TmI/Lcge1kBUINo3fQFalFEO4osRm+ORwQ= 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=M/MkhWr1; arc=none smtp.client-ip=198.175.65.20 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="M/MkhWr1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714145954; x=1745681954; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=flcFCyFG2/t8hSowAIB01UznDgaflhSitPfuUrp0c60=; b=M/MkhWr1w95CMeUS2P3BQw4DC6EqnuF/1jMv390CWkN9Br3v58/RPfCk mIxRtCAwdcWvYoxUqjdflpYpVbgacopPvXpivnubzIAzoWlpGBtOazO5U guVzWoiDjlSZQY/P94VLwVplLOInYnHiyE/dYdwpW+rcIFRXQiAD6E8+e IaRyQ+sAjI3Pt0zxwKaUdyhcy9kNVzEU22T/M0YMXKTPZg2lBa+pEh/24 cuY81K7Uryx4Dd9fgsKJBgNyKobY7tj/B4gL4D5/YoENu2/xexrrDCns/ 6nbHhsf5I6gfbo2d76rnefc4j9eSCgLjbxQNtQnGvFuH2qYtT1OHVT1br w==; X-CSE-ConnectionGUID: ORM25AwcSeOuAimZRC1L+Q== X-CSE-MsgGUID: 4IqchcbzSmuq5DbktIhGLw== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="9718437" X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="9718437" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:11 -0700 X-CSE-ConnectionGUID: WL7/LIeJRTSSuULWaJyWbA== X-CSE-MsgGUID: cILyGG/0QEKLlCU1ZdfHEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="56623540" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:10 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Yong Zhi , Ranjani Sridharan , Pierre-Louis Bossart Subject: [PATCH 2/5] ASoC: SOF: topology: remove incorrect widget id in error message Date: Fri, 26 Apr 2024 10:38:59 -0500 Message-Id: <20240426153902.39560-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426153902.39560-1-pierre-louis.bossart@linux.intel.com> References: <20240426153902.39560-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: Yong Zhi In sof_widget_ready() function, the shift field of struct snd_soc_tplg_dapm_widget is incorrectly used to print widget id in dev_err(scomp->dev, "error: failed to add widget id %d ..", this patch removes the useless tw->shift from the error output. Reviewed-by: Ranjani Sridharan Signed-off-by: Yong Zhi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index bcdb499c96a0..ec931a26b54f 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1531,10 +1531,9 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index, /* check token parsing reply */ if (ret < 0) { dev_err(scomp->dev, - "error: failed to add widget id %d type %d name : %s stream %s\n", - tw->shift, swidget->id, tw->name, - strnlen(tw->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) > 0 - ? tw->sname : "none"); + "failed to add widget type %d name : %s stream %s\n", + swidget->id, tw->name, strnlen(tw->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) > 0 + ? tw->sname : "none"); goto widget_free; } From patchwork Fri Apr 26 15:39: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: 13645019 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 533A914901F for ; Fri, 26 Apr 2024 15:39:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145956; cv=none; b=dO6fZUZLj6Ue4tq+Lq4Oqa5wqkJdkFTSGf21u0RiJjBCUWFhAIWr9Tjfcb5gRfI6fARH4qIO0oLVkhDRwE6KPrZushEBx1Wa6Bo6lrpEbzm4kWJ/7F1DInajG0jjjUPjlw3F+P8lbEn+Q34xYlKZOya3zQWRRfrImeqOEb7/ikc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145956; c=relaxed/simple; bh=v4RrR4ZevIdejO++X3NJ7yMsgRZ5oysDLZ7RLMPgM4U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L4fL3TaVmxoLUnf4JVF7pRJkhHr6V1/V3/I5gI9tyCKm4mMZb7LQERKC08maLz2WxDCL7TH2xbIFPgOzEO1u6tKjPlQ95pUxfswclSKVv7FA37HfwfeNFwoe6CvERuMCdTaDBq11SKehK83l6gVcKZ/k+xBivUUGQQe5WB3GD18= 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=gYytR8/l; arc=none smtp.client-ip=198.175.65.20 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="gYytR8/l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714145955; x=1745681955; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v4RrR4ZevIdejO++X3NJ7yMsgRZ5oysDLZ7RLMPgM4U=; b=gYytR8/lxT83WIugkuuT31osTsUi2sxadKoOOuuDskLq4j3YdqR+SbZy qD3bVEq+2uzr36hQH00PuD4XQCxxH4mq3TLHpiWiF58vUkjac8gtRSl2V BzbKoIaqy9Qlev4fjy8mLf2Q144czXG5rRt4C4lgXAw/9ZXF5dVlp16zD gR1gAlmiWtntPDS+uxE7zjSCv358e2x0cHtTFLLVJ2Ibft1IkMIcMk9Kg A0CzgpJ5ouW+r5hBGUN3eDQ1BnSLZdsJPfYMYbVLs+c1gnH8Aw7G1v95y 3Z1z0QFyf+uj6tQgShoSrCkl7gM7xV8b7Z/kdEuvtceRopMYw/6VvDoYv w==; X-CSE-ConnectionGUID: coFvGpaOShWYW4RF9/Ir7g== X-CSE-MsgGUID: CZoc5cvqQKGc0fmWQzVAaw== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="9718441" X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="9718441" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:11 -0700 X-CSE-ConnectionGUID: dArphcUpTHu0MWM01xvL6g== X-CSE-MsgGUID: rKXOU+QqQPGxrrRIVFB3kw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="56623541" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:11 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Pierre-Louis Bossart , Bard Liao Subject: [PATCH 3/5] ASoC: SOF: Intel: hda: simplify and reduce indentation for hda_sdw_machine_select() Date: Fri, 26 Apr 2024 10:39:00 -0500 Message-Id: <20240426153902.39560-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426153902.39560-1-pierre-louis.bossart@linux.intel.com> References: <20240426153902.39560-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 Simplify code to return when no links are enabled. No functional change, just code cleanup before updates. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Bard Liao --- sound/soc/sof/intel/hda.c | 139 +++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 68 deletions(-) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 4d0fe706ebc1..8ddc1b0ca3c9 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1653,92 +1653,95 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev hdev = pdata->hw_pdata; link_mask = hdev->info.link_mask; + if (!link_mask) { + dev_info(sdev->dev, "SoundWire links not enabled\n"); + return NULL; + } + /* * Select SoundWire machine driver if needed using the * alternate tables. This case deals with SoundWire-only * machines, for mixed cases with I2C/I2S the detection relies * on the HID list. */ - if (link_mask) { - for (mach = pdata->desc->alt_machines; - mach && mach->link_mask; mach++) { - /* - * On some platforms such as Up Extreme all links - * are enabled but only one link can be used by - * external codec. Instead of exact match of two masks, - * first check whether link_mask of mach is subset of - * link_mask supported by hw and then go on searching - * link_adr - */ - if (~link_mask & mach->link_mask) - continue; + for (mach = pdata->desc->alt_machines; + mach && mach->link_mask; mach++) { + /* + * On some platforms such as Up Extreme all links + * are enabled but only one link can be used by + * external codec. Instead of exact match of two masks, + * first check whether link_mask of mach is subset of + * link_mask supported by hw and then go on searching + * link_adr + */ + if (~link_mask & mach->link_mask) + continue; - /* No need to match adr if there is no links defined */ - if (!mach->links) - break; + /* No need to match adr if there is no links defined */ + if (!mach->links) + break; - link = mach->links; - for (i = 0; i < hdev->info.count && link->num_adr; - i++, link++) { - /* - * Try next machine if any expected Slaves - * are not found on this link. - */ - if (!snd_soc_acpi_sdw_link_slaves_found(sdev->dev, link, - hdev->sdw->ids, - hdev->sdw->num_slaves)) - break; - } - /* Found if all Slaves are checked */ - if (i == hdev->info.count || !link->num_adr) + link = mach->links; + for (i = 0; i < hdev->info.count && link->num_adr; + i++, link++) { + /* + * Try next machine if any expected Slaves + * are not found on this link. + */ + if (!snd_soc_acpi_sdw_link_slaves_found(sdev->dev, link, + hdev->sdw->ids, + hdev->sdw->num_slaves)) break; } - if (mach && mach->link_mask) { - int dmic_num = 0; - bool tplg_fixup; - const char *tplg_filename; - - mach->mach_params.links = mach->links; - mach->mach_params.link_mask = mach->link_mask; - mach->mach_params.platform = dev_name(sdev->dev); - - if (pdata->tplg_filename) { - tplg_fixup = false; - } else { - tplg_fixup = true; - tplg_filename = mach->sof_tplg_filename; - } + /* Found if all Slaves are checked */ + if (i == hdev->info.count || !link->num_adr) + break; + } + if (mach && mach->link_mask) { + int dmic_num = 0; + bool tplg_fixup; + const char *tplg_filename; - /* - * DMICs use up to 4 pins and are typically pin-muxed with SoundWire - * link 2 and 3, or link 1 and 2, thus we only try to enable dmics - * if all conditions are true: - * a) 2 or fewer links are used by SoundWire - * b) the NHLT table reports the presence of microphones - */ - if (hweight_long(mach->link_mask) <= 2) { - int ret; + mach->mach_params.links = mach->links; + mach->mach_params.link_mask = mach->link_mask; + mach->mach_params.platform = dev_name(sdev->dev); - ret = dmic_detect_topology_fixup(sdev, &tplg_filename, "", - &dmic_num, tplg_fixup); - if (ret < 0) - return NULL; - } - if (tplg_fixup) - pdata->tplg_filename = tplg_filename; - mach->mach_params.dmic_num = dmic_num; + if (pdata->tplg_filename) { + tplg_fixup = false; + } else { + tplg_fixup = true; + tplg_filename = mach->sof_tplg_filename; + } - dev_dbg(sdev->dev, - "SoundWire machine driver %s topology %s\n", - mach->drv_name, - pdata->tplg_filename); + /* + * DMICs use up to 4 pins and are typically pin-muxed with SoundWire + * link 2 and 3, or link 1 and 2, thus we only try to enable dmics + * if all conditions are true: + * a) 2 or fewer links are used by SoundWire + * b) the NHLT table reports the presence of microphones + */ + if (hweight_long(mach->link_mask) <= 2) { + int ret; - return mach; + ret = dmic_detect_topology_fixup(sdev, &tplg_filename, "", + &dmic_num, tplg_fixup); + if (ret < 0) + return NULL; } + if (tplg_fixup) + pdata->tplg_filename = tplg_filename; + mach->mach_params.dmic_num = dmic_num; + + dev_dbg(sdev->dev, + "SoundWire machine driver %s topology %s\n", + mach->drv_name, + pdata->tplg_filename); - dev_info(sdev->dev, "No SoundWire machine driver found\n"); + return mach; } + dev_info(sdev->dev, "No SoundWire machine driver found\n"); + return NULL; } #else From patchwork Fri Apr 26 15:39: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: 13645021 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 BBDDC18C1F for ; Fri, 26 Apr 2024 15:39:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145957; cv=none; b=LrScE8SQxOEte2dVqiP/93SbkQ1KoHCLzOXz9Mntdz4hajUbEzWF04sdqasJOBczCI+Cu0zYjpmuoSZog0TDUeF4YTuHIrsLbRiPOGpcYWNhN2Ydrhp+quPaP9yo/mk3uR3ThqrRJrmihXGTsV4Yf2b0ZfjNznQ5T29EFcqcZyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145957; c=relaxed/simple; bh=UQPrNln96b4xHk91nmowdoB7FfPTrZkZDGSoZjVsfKg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ayqywviLT1AIT9Eifref6uQzMQ6tg4E5QpkVf23lLhbeA+HphhW1SlF7/r57R/5Q3F/0P4+8W0nikRDnWgH2kLHsQxV1rsL/fbQ2e+xADkv5dq32R8iInO46HsTT8U3xOeo3w4h1F1L66ryLcEwlxn/NQL997ru5p6bwPnGiDw4= 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=e/1St6qG; arc=none smtp.client-ip=198.175.65.20 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="e/1St6qG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714145956; x=1745681956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UQPrNln96b4xHk91nmowdoB7FfPTrZkZDGSoZjVsfKg=; b=e/1St6qGjNINot5s/bNbteJ8xEdJyZFzCqoyQ6KJtyJJagP5ncoZy61C 4xvM88pLVdGugZhdIHaTfvnL8Z2cMR+26SRia/EOm9xuzdp1q5emYj4hn nOc9HcgnzblUye6L7VJAImpZUNWXHwiUfBQ1MBCgkDogQDW15VuP+JbcY EPF4UlpVUE3aDyooHkwEh13HT1GuP+pr41TTQFdVkoV7adaLyFDrBMK9Z v0Ei2cpw/OYKcgB7Rk/CV8UN1gDSMGwqKQSrKsrJmM7P27460NyVPmNBX tY8xSN49vSbBnHTY6sMKLk0Pq6T17B2VEkVfi2Tgh1B6NQb7URTvI0Bme g==; X-CSE-ConnectionGUID: taxGYrtqQbCuiP+gc/M+PQ== X-CSE-MsgGUID: FXuZPImrToeRTI4xbmFzGQ== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="9718445" X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="9718445" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:11 -0700 X-CSE-ConnectionGUID: 9njKNL6uTtKogg1KL4lPsQ== X-CSE-MsgGUID: 6PJtELB4S26GsJ9+ow8Qsw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="56623542" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:11 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Pierre-Louis Bossart , Bard Liao Subject: [PATCH 4/5] ASoC: SOF: Intel: hda: list SoundWire peripherals on mismatch Date: Fri, 26 Apr 2024 10:39:01 -0500 Message-Id: <20240426153902.39560-5-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426153902.39560-1-pierre-louis.bossart@linux.intel.com> References: <20240426153902.39560-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 Most of the SoundWire support issues come from bad ACPI information, or configuration reported by ACPI that are not supported by the SOF driver/topology. The users see a "No SoundWire machine driver found" message without any details, and the fallback to HDaudio w/ HDMI is used. We can reduce our support load with a clear dev_info() log that will give us a clear hint on the mismatch and why a machine driver/topology were not found. Example log on a MTL device: [ 13.158599] sof-audio-pci-intel-mtl 0000:00:1f.3: No SoundWire machine driver found for the ACPI-reported configuration: [ 13.158603] sof-audio-pci-intel-mtl 0000:00:1f.3: link 0 mfg_id 0x025d part_id 0x0713 version 0x3 [ 13.158606] sof-audio-pci-intel-mtl 0000:00:1f.3: link 1 mfg_id 0x025d part_id 0x1316 version 0x3 [ 13.158608] sof-audio-pci-intel-mtl 0000:00:1f.3: link 2 mfg_id 0x025d part_id 0x1316 version 0x3 In parallel, we will also provide an update to `alsa-info` to log all SoundWire peripherals found in ACPI tables. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Bard Liao --- sound/soc/sof/intel/hda.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 8ddc1b0ca3c9..8ac8c10b83bd 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1645,6 +1645,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev { struct snd_sof_pdata *pdata = sdev->pdata; const struct snd_soc_acpi_link_adr *link; + struct sdw_extended_slave_id *ids; struct snd_soc_acpi_mach *mach; struct sof_intel_hda_dev *hdev; u32 link_mask; @@ -1658,6 +1659,16 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev return NULL; } + if (!hdev->sdw) { + dev_dbg(sdev->dev, "SoundWire context not allocated\n"); + return NULL; + } + + if (!hdev->sdw->num_slaves) { + dev_warn(sdev->dev, "No SoundWire peripheral detected in ACPI tables\n"); + return NULL; + } + /* * Select SoundWire machine driver if needed using the * alternate tables. This case deals with SoundWire-only @@ -1740,7 +1751,11 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev return mach; } - dev_info(sdev->dev, "No SoundWire machine driver found\n"); + dev_info(sdev->dev, "No SoundWire machine driver found for the ACPI-reported configuration:\n"); + ids = hdev->sdw->ids; + for (i = 0; i < hdev->sdw->num_slaves; i++) + dev_info(sdev->dev, "link %d mfg_id 0x%04x part_id 0x%04x version %#x\n", + ids[i].link_id, ids[i].id.mfg_id, ids[i].id.part_id, ids[i].id.sdw_version); return NULL; } From patchwork Fri Apr 26 15:39: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: 13645020 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 7FDFC149C4B for ; Fri, 26 Apr 2024 15:39:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145956; cv=none; b=ljkjPVALdn72IR7b4voKx+GeCaM7gtnQnvAKi7eyu2q1oFgVaBVa/TXyvtBaChBW7pSNSiu3WOBXQvlL1iWROsJ1WtEK5Uk5JeKVFyakDiQzo87GAK3JJXC++Sb0bj9SqAujEobg3NI6iOFirbrYP8aJ1NShhTJTb9pOnFt8IgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145956; c=relaxed/simple; bh=wI9fs7bgOEAA0afP8UWfMGEmXEEIps2sXvmF8aVgK6g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZPrPiutCKZKdOX99nYTAinHii3Yrnfm4AaqPqNFw9vPQCJTAqSU/Vtd4G9BAtla+hPTS6Zik7oBVT2eBYCiWBwxIQ6GEW+Fq1Jw711GMsc6OqRPqlfqKQpYE9jhCFY8xvz4SFWOAtMTZH3UOwfmkAQS16Yet6uqjP3gmifUiZf8= 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=Tjv8GJ/4; arc=none smtp.client-ip=198.175.65.20 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="Tjv8GJ/4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714145955; x=1745681955; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wI9fs7bgOEAA0afP8UWfMGEmXEEIps2sXvmF8aVgK6g=; b=Tjv8GJ/4IRcvYkYSa9aDPe/lVDsYr2/XLWvNY9p1UdYq6LIRnsZil9sY wgi7gkW5/xqxN3XCPXBq4jnjwB2lf8je/cagJ13byvNuV7ABtdPNOoKEt 1QM8ldlX54fvU0/8Uie5NWTd+pglrxDBwGA42O/vGgZtOjkIVJnTi64Z6 +Letz8qr7cDYYlYmPiZEvFPdiF8tPn3ulDBaQEmR8k/gN7nIpEoDWO7iQ cJePsqLtOb/3J+f9p6qJWl1yyhdf/lwIzVcKQfheqtDp1MbuUzl5dg1/E 6MT+JrFjde1PA3knilLC8xE0g6zC6QgYq89L4DMsUlqys+wHf2nhbMqQh Q==; X-CSE-ConnectionGUID: TBURry68SQeFGdbWT50Zbg== X-CSE-MsgGUID: YFvy0MhjRZigfd/PUvkqxg== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="9718450" X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="9718450" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:12 -0700 X-CSE-ConnectionGUID: fX3s3AjXS8KoheNEiPO6EQ== X-CSE-MsgGUID: hdG1BTC5TUCJVMdKkP2OEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,233,1708416000"; d="scan'208";a="56623543" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:39:12 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Ranjani Sridharan , Pierre-Louis Bossart Subject: [PATCH 5/5] ASoC: SOF: ipc4-topology: Advertise passthrough capable PCMs (using ChainDMA) Date: Fri, 26 Apr 2024 10:39:02 -0500 Message-Id: <20240426153902.39560-6-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426153902.39560-1-pierre-louis.bossart@linux.intel.com> References: <20240426153902.39560-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: Peter Ujfalusi If a PCM is set to use ChainDMA then add it to the card->components string after a marker of iec61937-pcm:, for example on current HDA platforms where HDMI is set to use ChainDMA: iec61937-pcm:5,4,3 (the order of the PCM ids can differ) UCM is expected to parse and use this property to allow applications to use bytestream passthrough in a standard way. Reviewed-by: Ranjani Sridharan Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/ipc4-topology.c | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index c29c1de4e925..a972b2b5122a 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -407,6 +407,52 @@ static void sof_ipc4_widget_update_kcontrol_module_id(struct snd_sof_widget *swi } } +static int +sof_ipc4_update_card_components_string(struct snd_sof_widget *swidget, + struct snd_sof_pcm *spcm, int dir) +{ + struct snd_sof_widget *pipe_widget = swidget->spipe->pipe_widget; + struct sof_ipc4_pipeline *pipeline = pipe_widget->private; + struct snd_soc_component *scomp = spcm->scomp; + struct snd_soc_card *card = scomp->card; + const char *pt_marker = "iec61937-pcm"; + + /* + * Update the card's components list with iec61937-pcm and a list of PCM + * ids where ChainDMA is enabled. + * These PCMs can be used for bytestream passthrough. + */ + if (!pipeline->use_chain_dma) + return 0; + + if (card->components) { + const char *tmp = card->components; + + if (strstr(card->components, pt_marker)) + card->components = devm_kasprintf(card->dev, GFP_KERNEL, + "%s,%d", + card->components, + spcm->pcm.pcm_id); + else + card->components = devm_kasprintf(card->dev, GFP_KERNEL, + "%s %s:%d", + card->components, + pt_marker, + spcm->pcm.pcm_id); + + devm_kfree(card->dev, tmp); + } else { + card->components = devm_kasprintf(card->dev, GFP_KERNEL, + "%s:%d", pt_marker, + spcm->pcm.pcm_id); + } + + if (!card->components) + return -ENOMEM; + + return 0; +} + static int sof_ipc4_widget_setup_pcm(struct snd_sof_widget *swidget) { struct sof_ipc4_available_audio_format *available_fmt; @@ -452,6 +498,10 @@ static int sof_ipc4_widget_setup_pcm(struct snd_sof_widget *swidget) if (!spcm) goto skip_gtw_cfg; + ret = sof_ipc4_update_card_components_string(swidget, spcm, dir); + if (ret) + goto free_available_fmt; + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { struct snd_sof_pcm_stream *sps = &spcm->stream[dir];