From patchwork Fri Apr 26 15:21: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: 13644945 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 B0E21148FED for ; Fri, 26 Apr 2024 15:21:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144902; cv=none; b=soSMEVeorYGwibujv22QO6pOGfT8knX2+ubHX5ZDZf+52qCA9NdV4SnBFS5TJdJTlRhIDld2gUL3mjisV/pMCMQkzAXVW2OVCU3sBfbKQGkT2GhpmgLcF9zKJsrIyduRr8Q+CLreuQ7BoG6bIlQFHevVFhZ//WPHCNorqK35/30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144902; c=relaxed/simple; bh=HubybkhRbfo/I4Z9f4ZL9Jl07Vz/hlhXaq7GSFqYs28=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cOk3nDHyGf5CnssfzSP3+HeX6s1ypGIukXv+Pm34Ll6ro2o9Lx6Hwh4RMHQ5Rc3qzbLrvEyV36tmpffXzC2ZKbb1DJJMKDGUbTwCyf/eKDjy7lF5hLHbeuqTWTgNKdLzX+aIuZQuvojg+b36NH3Sgj4xwhoR2qMI2NI5TNpGq5Q= 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=g5nCJ/Vk; arc=none smtp.client-ip=192.198.163.10 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="g5nCJ/Vk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144901; x=1745680901; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HubybkhRbfo/I4Z9f4ZL9Jl07Vz/hlhXaq7GSFqYs28=; b=g5nCJ/VkU+0pxiVnPC7JatKU//R5zF587v8nkYAtfzaH8NbUbpxKLyEa 1VrJv9tKJfcGj9tSpkO50Sc4+r75rpl9CeRR9Gw3mNExqIoY1EE6PMagr X4YTQoNHCAOBz5cLARxtMcLA4k6uEdPa5P8R75HTIpttdPNdsmDdVCk4X IOx5gwjgw0dujFeZ+gNccgGf1biSdQU6yQKasEBZH/IFBq+7GIRp84UTu 6Mx4zOqvS9v3AktP8qAnPKv59Kuxohnn58LC/ovWRnTvAkTa1cljaqkcZ bO1FlHJeY2gyO2vATEtN3L3HqU730Wp8LfNZ6Sbx0liaBtQbiZ9j15qAq g==; X-CSE-ConnectionGUID: 4HnHHlYEQMyn1iI1i+ck2Q== X-CSE-MsgGUID: TL59GKGvSGm9UxROHsES8A== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290589" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290589" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:39 -0700 X-CSE-ConnectionGUID: DLM2Grf3Rz68RvkKcQjYCw== X-CSE-MsgGUID: lp2Fd53FSIKI76PkW97tPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259023" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:39 -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 , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Pierre-Louis Bossart Subject: [PATCH 01/12] ASoC: Intel: skl_hda_dsp_generic: Allocate snd_soc_card dynamically Date: Fri, 26 Apr 2024 10:21:12 -0500 Message-Id: <20240426152123.36284-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 static hda_soc_card might be modified during runtime which might cause issues on next time when the card is created. For example if the dmic_num was set with module parameter then removed for the next module loading then the card's components will still going to point to the previous boot's cfg-dmics:X string. There might be other places where devm allocated memory have been freed but the hda_soc_card still pointing to the now unallocated memory (the memory is freed when the platform device is removed). Fix this issue by moving the snd_soc_card into skl_hda_private and use it for the card registration to ensure that it is correctly initialized every time. Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/skl_hda_dsp_common.h | 1 + sound/soc/intel/boards/skl_hda_dsp_generic.c | 42 ++++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/sound/soc/intel/boards/skl_hda_dsp_common.h b/sound/soc/intel/boards/skl_hda_dsp_common.h index 4b0b3959182e..19b814dee4ad 100644 --- a/sound/soc/intel/boards/skl_hda_dsp_common.h +++ b/sound/soc/intel/boards/skl_hda_dsp_common.h @@ -28,6 +28,7 @@ struct skl_hda_hdmi_pcm { }; struct skl_hda_private { + struct snd_soc_card card; struct list_head hdmi_pcm_list; int pcm_count; int dai_index; diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c index 4aa7fd2a05e4..208395872d8b 100644 --- a/sound/soc/intel/boards/skl_hda_dsp_generic.c +++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c @@ -92,17 +92,6 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link) return ret; } -static struct snd_soc_card hda_soc_card = { - .name = "hda-dsp", - .owner = THIS_MODULE, - .dai_link = skl_hda_be_dai_links, - .dapm_widgets = skl_hda_widgets, - .dapm_routes = skl_hda_map, - .add_dai_link = skl_hda_add_dai_link, - .fully_routed = true, - .late_probe = skl_hda_card_late_probe, -}; - static char hda_soc_components[30]; #define IDISP_DAI_COUNT 3 @@ -115,9 +104,9 @@ static char hda_soc_components[30]; #define HDA_CODEC_AUTOSUSPEND_DELAY_MS 1000 -static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params) +static int skl_hda_fill_card_info(struct snd_soc_card *card, + struct snd_soc_acpi_mach_params *mach_params) { - struct snd_soc_card *card = &hda_soc_card; struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); struct snd_soc_dai_link *dai_link; u32 codec_count, codec_mask; @@ -199,6 +188,7 @@ static int skl_hda_audio_probe(struct platform_device *pdev) { struct snd_soc_acpi_mach *mach; struct skl_hda_private *ctx; + struct snd_soc_card *card; int ret; dev_dbg(&pdev->dev, "entry\n"); @@ -213,32 +203,42 @@ static int skl_hda_audio_probe(struct platform_device *pdev) if (!mach) return -EINVAL; - snd_soc_card_set_drvdata(&hda_soc_card, ctx); + card = &ctx->card; + card->name = "hda-dsp", + card->owner = THIS_MODULE, + card->dai_link = skl_hda_be_dai_links, + card->dapm_widgets = skl_hda_widgets, + card->dapm_routes = skl_hda_map, + card->add_dai_link = skl_hda_add_dai_link, + card->fully_routed = true, + card->late_probe = skl_hda_card_late_probe, - ret = skl_hda_fill_card_info(&mach->mach_params); + snd_soc_card_set_drvdata(card, ctx); + + ret = skl_hda_fill_card_info(card, &mach->mach_params); if (ret < 0) { dev_err(&pdev->dev, "Unsupported HDAudio/iDisp configuration found\n"); return ret; } - ctx->pcm_count = hda_soc_card.num_links; + ctx->pcm_count = card->num_links; ctx->dai_index = 1; /* hdmi codec dai name starts from index 1 */ ctx->platform_name = mach->mach_params.platform; ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; - hda_soc_card.dev = &pdev->dev; + card->dev = &pdev->dev; if (!snd_soc_acpi_sof_parent(&pdev->dev)) - hda_soc_card.disable_route_checks = true; + card->disable_route_checks = true; if (mach->mach_params.dmic_num > 0) { snprintf(hda_soc_components, sizeof(hda_soc_components), "cfg-dmics:%d", mach->mach_params.dmic_num); - hda_soc_card.components = hda_soc_components; + card->components = hda_soc_components; } - ret = devm_snd_soc_register_card(&pdev->dev, &hda_soc_card); + ret = devm_snd_soc_register_card(&pdev->dev, card); if (!ret) - skl_set_hda_codec_autosuspend_delay(&hda_soc_card); + skl_set_hda_codec_autosuspend_delay(card); return ret; } From patchwork Fri Apr 26 15:21: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: 13644944 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 BFB6B149C41 for ; Fri, 26 Apr 2024 15:21:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144902; cv=none; b=tjVMltFI+NKPk6+KmlRb1IJn03jo9zd2Q7avjbKUXskQ1sM1G3ySZsmtc/4ZhF2L7Pf74dZe5wunJMZiwVUdNueWrsERds4eKjF3ggmcR0PXUge6pRSDglVry01B3BrPShTWkjjf+r0KdsBB+FIcSy9eOm8svTHEGBa8AhgjcJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144902; c=relaxed/simple; bh=mkPPo4cmXEwCG5YJSWVnWIbjUUOV62VUhBtNpvDcliE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ueqV3pPyhvhhZFuCZFJSkXsB3bhi0uhuAWGECbD0Iz81ryvywr/sDHmsblWb3y6v5ZQBNdVFKhDNxhyjS66LNR8k2uEWurCgQP4pWcWXEuPCAHuLHE65j/qEq7qa/hhsnmD6967Mdo1zkyNFHnqC6jrd8lePG+gs6ts2E+IrVc4= 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=K9xSOaEJ; arc=none smtp.client-ip=192.198.163.10 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="K9xSOaEJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144901; x=1745680901; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mkPPo4cmXEwCG5YJSWVnWIbjUUOV62VUhBtNpvDcliE=; b=K9xSOaEJ4mrgUPLhZW2ZJN1kxXC9U5TIlh6783XA02LLscGw3JbQsH58 qaQEGx+AjsbjdZ88yaShSBKH4sKMSfOt1oMJlUPnMMH382tz2Aehbn6c6 UzEtS7HrQOmKNfeeFhOJEHe/cEtEOz+9ZsyWNrbufetW5v4N0h/7FSuCX 5vp7QcWfQrY4AdlWFbViFFL0pBGrVDHNra/g+qozuLfmbuPvTO6OLip3a tT6v8fAzP7Hu1MqjZeUeaEIT4T0yRT5IV97eSG3P2NPNkoXmHmho7bAkj hMmfDurxq1CjHaC3am/Csgx3H+NvrKIGnBAgmi5DhoxquryBf/kidIA4t Q==; X-CSE-ConnectionGUID: pYE4kqxSQ+SlwI00En9w5Q== X-CSE-MsgGUID: tMHtfxG2RkKVCtYx0cV52g== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290593" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290593" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:40 -0700 X-CSE-ConnectionGUID: mI/xbSpZSAivebQ/hXRUEg== X-CSE-MsgGUID: lM7woBPGTi6TglTya21fBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259024" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:39 -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 , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Pierre-Louis Bossart Subject: [PATCH 02/12] ASoC: Intel: skl_hda_dsp_generic: Use devm_kasprintf for the components string Date: Fri, 26 Apr 2024 10:21:13 -0500 Message-Id: <20240426152123.36284-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 Instead of using a global char array, allocate the string with devm_kasprintf if needed. Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/skl_hda_dsp_generic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c index 208395872d8b..88d91c0280bb 100644 --- a/sound/soc/intel/boards/skl_hda_dsp_generic.c +++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c @@ -92,8 +92,6 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link) return ret; } -static char hda_soc_components[30]; - #define IDISP_DAI_COUNT 3 #define HDAC_DAI_COUNT 2 #define DMIC_DAI_COUNT 2 @@ -231,9 +229,11 @@ static int skl_hda_audio_probe(struct platform_device *pdev) card->disable_route_checks = true; if (mach->mach_params.dmic_num > 0) { - snprintf(hda_soc_components, sizeof(hda_soc_components), - "cfg-dmics:%d", mach->mach_params.dmic_num); - card->components = hda_soc_components; + card->components = devm_kasprintf(card->dev, GFP_KERNEL, + "cfg-dmics:%d", + mach->mach_params.dmic_num); + if (!card->components) + return -ENOMEM; } ret = devm_snd_soc_register_card(&pdev->dev, card); From patchwork Fri Apr 26 15:21: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: 13644946 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 E6C3A149C62 for ; Fri, 26 Apr 2024 15:21:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144903; cv=none; b=XMy6KwU0KRyE9OtdcoaQskJcoT+uGerdRTXFiUTmnpZV0UjzBMdAh71CXU5tFDG2fMcss53UJFx1WXQ6g5DJhx762Bp2ORlLoohGipb1J2ZIs4Nsa2VR0RAUa897OGLjHaAGlXWkkTGzyEdCNASAXsAwpXB01CtzRdwH4L8UL+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144903; c=relaxed/simple; bh=uvsiV2YLLM+olUopeXgfESIJEeQMUUr6tjoE9Ugq0pw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QoK+XCTIquGgd/Q9X/e8ZJ7PRRXCX/MeggM6liHbeJxhY7IWZ/G2HzUBB1fv3rkCk6mPg5gLhpP06XmiSbw7Vn4T4LM637Q/DrNx/yID1FEnqnbZyQdfAUIb8hY+Hts2NFj1EWX+zNo52aOeJp7QboJSd2wiZQXF84PpbLCPaIY= 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=QJup4cFz; arc=none smtp.client-ip=192.198.163.10 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="QJup4cFz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144902; x=1745680902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uvsiV2YLLM+olUopeXgfESIJEeQMUUr6tjoE9Ugq0pw=; b=QJup4cFz7imS9uVJHZocF0me2H/XVZPNpbbDb1u/aaWNhBEiBRyV082n 1aslnHeZ0mHEcXt804FsLprLyRXVP9mW/QX1ecf1NKw4+EhB0xkvnmuEc B4YIjfOu9QBRr42zpOkZEYS+a63Eb3snX3Bte+ybZCT5RWfA20wxlYvE5 6pea57WoKLsYq4QvsVT2HTvK6BBOUdGQnJ3ULse6m0kN5bJk0C9ju41bp oBPBbmlwmhXj1lepkXvwbUm7ziSEDEPWFtZES+nezczerQ7jhHAf/Ml6I DWp/XvL5GmFJrIDP7qdthKkQderhuAPlqxBvlwGveN9ECJAJwBGonnVmj Q==; X-CSE-ConnectionGUID: 8cwbPuuETkCwpenT8BhMnw== X-CSE-MsgGUID: k/Z9zRwWQC2cu6KcMr6s5Q== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290600" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290600" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:40 -0700 X-CSE-ConnectionGUID: TZhS/xgITR+Umrtw3fsWHw== X-CSE-MsgGUID: cv0B5d47RWaFIROsWzdjPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259025" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:40 -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 03/12] ASoC: Intel: soc-acpi: mtl: add Dell SKU 0C64 and 0CC6 Date: Fri, 26 Apr 2024 10:21:14 -0500 Message-Id: <20240426152123.36284-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 SKU 0C64 relies on rt713 (jack codec) on link0, rt1318 (single amplifier) on link1 and rt1713 (dmic) on link3. SKU 0CC6 relies on rt713 (jack codec) on link0, rt1318 (two amplifiers) on link 1-2 and rt1713 (dmic) on link3. Reviewed-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- .../intel/common/soc-acpi-intel-mtl-match.c | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) 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 f95490a16b55..8c1c430f5482 100644 --- a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c @@ -312,6 +312,15 @@ static const struct snd_soc_acpi_adr_device rt1316_3_single_adr[] = { } }; +static const struct snd_soc_acpi_adr_device rt1318_1_single_adr[] = { + { + .adr = 0x000130025D131801, + .num_endpoints = 1, + .endpoints = &single_endpoint, + .name_prefix = "rt1318" + } +}; + static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = { { .adr = 0x000130025D131801ull, @@ -559,6 +568,49 @@ static const struct snd_soc_acpi_link_adr mtl_rt713_l0_rt1316_l12_rt1713_l3[] = {} }; +static const struct snd_soc_acpi_link_adr mtl_rt713_l0_rt1318_l1_rt1713_l3[] = { + { + .mask = BIT(0), + .num_adr = ARRAY_SIZE(rt713_0_single_adr), + .adr_d = rt713_0_single_adr, + }, + { + .mask = BIT(1), + .num_adr = ARRAY_SIZE(rt1318_1_single_adr), + .adr_d = rt1318_1_single_adr, + }, + { + .mask = BIT(3), + .num_adr = ARRAY_SIZE(rt1713_3_single_adr), + .adr_d = rt1713_3_single_adr, + }, + {} +}; + +static const struct snd_soc_acpi_link_adr mtl_rt713_l0_rt1318_l12_rt1713_l3[] = { + { + .mask = BIT(0), + .num_adr = ARRAY_SIZE(rt713_0_single_adr), + .adr_d = rt713_0_single_adr, + }, + { + .mask = BIT(1), + .num_adr = ARRAY_SIZE(rt1318_1_group1_adr), + .adr_d = rt1318_1_group1_adr, + }, + { + .mask = BIT(2), + .num_adr = ARRAY_SIZE(rt1318_2_group1_adr), + .adr_d = rt1318_2_group1_adr, + }, + { + .mask = BIT(3), + .num_adr = ARRAY_SIZE(rt1713_3_single_adr), + .adr_d = rt1713_3_single_adr, + }, + {} +}; + static const struct snd_soc_acpi_link_adr mtl_rt713_l0_rt1316_l12[] = { { .mask = BIT(0), @@ -697,6 +749,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-rt713-l0-rt1316-l12-rt1713-l3.tplg", }, + { + .link_mask = GENMASK(3, 0), + .links = mtl_rt713_l0_rt1318_l12_rt1713_l3, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-mtl-rt713-l0-rt1318-l12-rt1713-l3.tplg", + }, + { + .link_mask = BIT(0) | BIT(1) | BIT(3), + .links = mtl_rt713_l0_rt1318_l1_rt1713_l3, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-mtl-rt713-l0-rt1318-l1-rt1713-l3.tplg", + }, { .link_mask = GENMASK(2, 0), .links = mtl_rt713_l0_rt1316_l12, From patchwork Fri Apr 26 15:21:15 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: 13644947 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 44707149018 for ; Fri, 26 Apr 2024 15:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144903; cv=none; b=PHZIKZTd6ZNaJ02NZzoc14k3v6vcD9/Z+7IE5q+dVQOreCBl8ycm4+67NbhLCUS5xlX05y4Ko52p6YJdZakFHU5La4d1QuUBqhWBcnfAD8oBoLRP4RF0VnyQz3Z76ZHEd3Xu/rYZiFb1PWCsEI6maf9rxAvS/Gr2DygTm+KazVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144903; c=relaxed/simple; bh=WAkH3Y7OhBZNoUz6Z4EeiC+ZSwLVt3vDR6DBrDXdPXU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=ZspCFldrTtViQ8MbTkZaZu2Ohc3IdATftBMH/im31u+gCx92r7HfS8wlYkwJ4tit3WeMrJugZk/d4L2GfjXbzXaFFhgEPESXvO0FuOQtN5xHvsAu+D8mCAEQtaETuKBZTlJP2dyB6g5aJJY4QQZOg9K1TCQZjfuw5rZJLgK+FMI= 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=HnorRxel; arc=none smtp.client-ip=192.198.163.10 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="HnorRxel" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144902; x=1745680902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WAkH3Y7OhBZNoUz6Z4EeiC+ZSwLVt3vDR6DBrDXdPXU=; b=HnorRxelG8c2NZkweumu9j1tnRVAOeZH7i8BSTsUXIRwdjuSu642w/g9 mMmUNLHQbycJYCE3y+Z7N24BZI08r7dOmZtTocNk5aPBII4lGgqD89hjy Q/mN1tksftJMBT5dWwZGhUqDpUi24HgtpushXwX7ZtCQeT7k9Sgi6/UkH Ha3Xr7gwgd7eGhAb2ctUM7ZJGOpBHB6d66cx2nThhhaKcjohZjypPsFkT LlB7k3c4JL6NmZkvEgYoGkPGVdLJ4IIuIQMK7D1GedetpkWnhLWlwDKZJ 1X1AwvnNCc84BezIhgIb210GwE+QXPZDHd7VuqHYSKgTtvUvXrbrvRAuJ A==; X-CSE-ConnectionGUID: NFPHOoB1SMyH9MVEd1PrtQ== X-CSE-MsgGUID: 6bxbiPvdRW6yM9r+6SJbrw== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290605" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290605" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:41 -0700 X-CSE-ConnectionGUID: xWcTo9aQQEKG8IJruxCmow== X-CSE-MsgGUID: lMOG/s+wS8itmVGZTmk2bA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259026" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:41 -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 , =?utf-8?q?P=C3=A9ter_Ujfalusi?= Subject: [PATCH 04/12] ASoC: Intel: soc-acpi: mtl: add support for Acer Swift Go 14 Date: Fri, 26 Apr 2024 10:21:15 -0500 Message-Id: <20240426152123.36284-5-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 This device has an RT712 on link0, but does not rely on RT1712 for the DMIC. PCH-attached DMICs are used instead. Closes: https://github.com/thesofproject/linux/issues/4923 Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- .../intel/common/soc-acpi-intel-mtl-match.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 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 8c1c430f5482..4eeec0bc92dc 100644 --- a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c @@ -357,7 +357,7 @@ static const struct snd_soc_acpi_adr_device rt714_1_adr[] = { } }; -static const struct snd_soc_acpi_link_adr mtl_712_only[] = { +static const struct snd_soc_acpi_link_adr mtl_712_l0_1712_l3[] = { { .mask = BIT(0), .num_adr = ARRAY_SIZE(rt712_0_single_adr), @@ -371,6 +371,15 @@ static const struct snd_soc_acpi_link_adr mtl_712_only[] = { {} }; +static const struct snd_soc_acpi_link_adr mtl_712_l0[] = { + { + .mask = BIT(0), + .num_adr = ARRAY_SIZE(rt712_0_single_adr), + .adr_d = rt712_0_single_adr, + }, + {} +}; + static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { { /* Jack Playback Endpoint */ .num = 0, @@ -769,10 +778,16 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { }, { .link_mask = BIT(3) | BIT(0), - .links = mtl_712_only, + .links = mtl_712_l0_1712_l3, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-rt712-l0-rt1712-l3.tplg", }, + { + .link_mask = BIT(0), + .links = mtl_712_l0, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-mtl-rt712-l0.tplg", + }, { .link_mask = GENMASK(2, 0), .links = mtl_sdw_rt1318_l12_rt714_l0, From patchwork Fri Apr 26 15:21:16 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: 13644948 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 5957214D452 for ; Fri, 26 Apr 2024 15:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144904; cv=none; b=UkNWG5jOtpDBDs3REV2QBpqno0pCM/5GXDtebCIF5ikyc/q9h2yF+tEc2uzeRusAT7tVoFjR151e0GLSHPD2MRcJoAe/GhJmbpftTSNCG5TYUdowJ2ZZAf0yUC+f6C54jife6aR4PcNmHSCZdUBvZryWft136OgVKa4r+Bub2fg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144904; c=relaxed/simple; bh=PuF4w6Ln2EhUy7cEQnbfcGAWOeZqMgiQxCSwhmlUlek=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=UqinkhJbrgqaVCxrlcLs7A8+alpFqULcGzNEr+MN8JmbwgilEvD8VjOoYqCWBJT71AaS+XqGBidtCxzyAz0HyGMLlc3M5zYcEb9YCw/OEd/lDfbNyUaduyhpihIClioppfNeNDc7l2Vpj31hicGechT70zMawkc1kTu6X+Qa7YA= 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=LdKvcALd; arc=none smtp.client-ip=192.198.163.10 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="LdKvcALd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144902; x=1745680902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PuF4w6Ln2EhUy7cEQnbfcGAWOeZqMgiQxCSwhmlUlek=; b=LdKvcALdpcLDTEVA/MQynlnZeRREumJiawpxT7sMXiqn9ZpJdewYAJID jrHOI7wg3FZADDSaff7oJ3cNpdBc4Zn/fNYmO9Egp9yitWObw7r+suhgO OD6+xDGw/szKvZivjqrBzzHIL0eKW09xZtC1ZIXv7Uqj4pGQblKw5xDuy LeubVCkfcnGIcTk0eSm7iltttTKVjbybU0b5/gyAq+dZOownYCDxOr/2P DEVGhP9NRikLL4dvQgIMlhciSNGnohymyYp5zl3ocH2OO4sGIMdjeS+mT f0I/pn5gqaF0fC4m3cZ/wsZ+132iuq5Dstg5KqlbuzL+CdWCyPnd7pMcd A==; X-CSE-ConnectionGUID: mxLHhto6TeuXGb4G6tcs2g== X-CSE-MsgGUID: 9drK0bv9QkWxBTDKp9eAyw== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290611" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290611" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:42 -0700 X-CSE-ConnectionGUID: o3pmswGHQIiEbQYdntSOJw== X-CSE-MsgGUID: 61DS1Hl5R2Ozpi/Y5mDOtg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259030" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:42 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Mac Chiang , Bard Liao , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart Subject: [PATCH 05/12] ASoC: Intel: soc-acpi-intel-lnl-match: adds RT714 and RT1318 support Date: Fri, 26 Apr 2024 10:21:16 -0500 Message-Id: <20240426152123.36284-6-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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: Mac Chiang This patch adds support for corresponding codecs on LNL hardware configuration: SDW0: RT714 DMIC SDW1: RT1318 Left Speaker SDW2: RT1318 Right Speaker Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Signed-off-by: Mac Chiang Signed-off-by: Pierre-Louis Bossart --- .../intel/common/soc-acpi-intel-lnl-match.c | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/sound/soc/intel/common/soc-acpi-intel-lnl-match.c b/sound/soc/intel/common/soc-acpi-intel-lnl-match.c index 74d6dcd7471f..0318c1a46f3c 100644 --- a/sound/soc/intel/common/soc-acpi-intel-lnl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-lnl-match.c @@ -130,6 +130,33 @@ static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = { } }; +static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = { + { + .adr = 0x000130025D131801ull, + .num_endpoints = 1, + .endpoints = &spk_l_endpoint, + .name_prefix = "rt1318-1" + } +}; + +static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = { + { + .adr = 0x000232025D131801ull, + .num_endpoints = 1, + .endpoints = &spk_r_endpoint, + .name_prefix = "rt1318-2" + } +}; + +static const struct snd_soc_acpi_adr_device rt714_0_adr[] = { + { + .adr = 0x000030025D071401ull, + .num_endpoints = 1, + .endpoints = &single_endpoint, + .name_prefix = "rt714" + } +}; + static const struct snd_soc_acpi_adr_device rt714_1_adr[] = { { .adr = 0x000130025D071401ull, @@ -195,6 +222,25 @@ static const struct snd_soc_acpi_link_adr lnl_3_in_1_sdca[] = { {} }; +static const struct snd_soc_acpi_link_adr lnl_sdw_rt1318_l12_rt714_l0[] = { + { + .mask = BIT(1), + .num_adr = ARRAY_SIZE(rt1318_1_group1_adr), + .adr_d = rt1318_1_group1_adr, + }, + { + .mask = BIT(2), + .num_adr = ARRAY_SIZE(rt1318_2_group1_adr), + .adr_d = rt1318_2_group1_adr, + }, + { + .mask = BIT(0), + .num_adr = ARRAY_SIZE(rt714_0_adr), + .adr_d = rt714_0_adr, + }, + {} +}; + /* this table is used when there is no I2S codec present */ struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = { /* mockup tests need to be first */ @@ -240,6 +286,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = { .drv_name = "sof_sdw", .sof_tplg_filename = "sof-lnl-rt722-l0.tplg", }, + { + .link_mask = GENMASK(2, 0), + .links = lnl_sdw_rt1318_l12_rt714_l0, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-lnl-rt1318-l12-rt714-l0.tplg" + }, {}, }; EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_sdw_machines); From patchwork Fri Apr 26 15:21: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: 13644949 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 76D5D14900B for ; Fri, 26 Apr 2024 15:21:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144904; cv=none; b=bpeZ2CDvkg3XTJv3hzMx8TSBSALN4XvPLMwMDzwUjag9r8kwyvzjwnb2pLUGDdSitmwgVHNK4tYuBxuPhHVXyXS6jMiqo6gJBu/enXCX4cIm2ctuLl+xbG/Uxzuc56evuTVbw5m17zza0VyGyfDjn0ISI3Z8sxIv08dFDVBDYfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144904; c=relaxed/simple; bh=PEhn8HQcSVd6mSeWV30RYAJSQWq9dxPGiCp9O1JeE+o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aFWTKObwcFql7/3kORuoxtvRhWzRDCQuqWQ2L/DxKaetg9cOVi2AVXzshv2C7gtBVIlI/Lq974SSzzChwSfhjDvdz31R4aIDO49e7sJrdmi3x8Knt04DR6xk6yIzUjDHqzQIuNkOh4FsxFh8/L2Nn5yvROkJIQWFmAlpI3Y0Kt4= 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=PttWn9uO; arc=none smtp.client-ip=192.198.163.10 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="PttWn9uO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144903; x=1745680903; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PEhn8HQcSVd6mSeWV30RYAJSQWq9dxPGiCp9O1JeE+o=; b=PttWn9uOWe6yvX1eRokD3bmzBibmy+WZdTZ3/c56sAKZyxgt+MvS66G0 YHgcCoxslKvshfSACQdWAI85S3oSFjOSTVFeQP3dKuSCEr0FrmYfP8vby eCt8+YyVu5LpcXLVzq7aa2GECO+qDgpKqAgO8ZpD6sI+WwNAq71abfBS+ Lf6qz0NiSj2PYewITjWHxb+7WHdVkwQq2hbQ4tcvQx2tU8F3sb8YB33Ra LfJbM3n1cP0AuWZVIb+viebMinTAkWad3ue7m2xoZ+WPvE6oBwoUv5EpD RAfhJcvErDKmoZYXkou9wz2TdMnGWycp8+R46CAQH1lHW+T3ZeCS4wzzA w==; X-CSE-ConnectionGUID: K7KAA13QQJC8CcdX18lV7w== X-CSE-MsgGUID: grq6o48YT76WemIw7TOjOw== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290618" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290618" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:43 -0700 X-CSE-ConnectionGUID: 6HKKzj6bTdWsV+vqO8bB8Q== X-CSE-MsgGUID: zEUUyN3TTdKBKXE+HfltGQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259031" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:42 -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 , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Pierre-Louis Bossart Subject: [PATCH 06/12] ASoC: Intel: sof_sdw: Allocate snd_soc_card dynamically Date: Fri, 26 Apr 2024 10:21:17 -0500 Message-Id: <20240426152123.36284-7-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 static card_sof_sdw struct is modified during runtime and in case the module is not removed, but the card is, then the next time the card is created the card_sof_sdw will contain information from the previous card which might lead to hard to debug issues, side effects. Move the snd_soc_card into mc_private and use that to make sure that the card is initialized correctly. Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 20 +++++++++----------- sound/soc/intel/boards/sof_sdw_common.h | 1 + 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index d65c5da49000..384c3d41a9ad 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1882,12 +1882,6 @@ static int sof_sdw_card_late_probe(struct snd_soc_card *card) /* SoC card */ static const char sdw_card_long_name[] = "Intel Soundwire SOF"; -static struct snd_soc_card card_sof_sdw = { - .name = "soundwire", - .owner = THIS_MODULE, - .late_probe = sof_sdw_card_late_probe, -}; - /* helper to get the link that the codec DAI is used */ static struct snd_soc_dai_link *mc_find_codec_dai_used(struct snd_soc_card *card, const char *dai_name) @@ -1939,20 +1933,24 @@ static void mc_dailink_exit_loop(struct snd_soc_card *card) static int mc_probe(struct platform_device *pdev) { - struct snd_soc_card *card = &card_sof_sdw; struct snd_soc_acpi_mach *mach = dev_get_platdata(&pdev->dev); + struct snd_soc_card *card; struct mc_private *ctx; int amp_num = 0, i; int ret; - card->dev = &pdev->dev; + dev_dbg(&pdev->dev, "Entry\n"); - dev_dbg(card->dev, "Entry\n"); - - ctx = devm_kzalloc(card->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; + card = &ctx->card; + card->dev = &pdev->dev; + card->name = "soundwire", + card->owner = THIS_MODULE, + card->late_probe = sof_sdw_card_late_probe, + snd_soc_card_set_drvdata(card, ctx); dmi_check_system(sof_sdw_quirk_table); diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 89253938ebaa..853278c6e525 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -101,6 +101,7 @@ struct sof_sdw_codec_info { }; struct mc_private { + struct snd_soc_card card; struct snd_soc_jack sdw_headset; struct sof_hdmi_private hdmi; struct device *headset_codec_dev; /* only one headset per card */ From patchwork Fri Apr 26 15:21:18 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: 13644950 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 D4717149C62 for ; Fri, 26 Apr 2024 15:21:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144905; cv=none; b=DCgoUUU8OJWyCbYlSmfp9uBMAvEzFfH5MM/tf+Mptecq+R02/eMxknsenUbG1HHxZ2H1+BTo4Fb/drnEB8dwxznQW3dA5X4LhU1JyHRqImA/iix23KURGXmBIuuJqOybNxv7BYOsYGoJDLPYZxEOGBpmgg1zLGgi5VxTWdIv9/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144905; c=relaxed/simple; bh=EN06Qbj+h6vmWB7m/IpZGvOt02dFoebcBQ4VHz/TBPQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Fck02RQ1+tyPtzoCfVp5W/32VZc9mN7ZpHIjoDruRiL9BI+wM7MF9MNaV0KEfZyucsHLkvkrdNagq+wfUqsSuIVo9ELaxPnRSXwmxRN8SS+xA+NISq4/MGTdzpdyxFJJ5DhHKYlTckgb1ntKmJ1ZQuLloAPrsJhtaKqZlfXQktI= 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=ep2v5ZmS; arc=none smtp.client-ip=192.198.163.10 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="ep2v5ZmS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144904; x=1745680904; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EN06Qbj+h6vmWB7m/IpZGvOt02dFoebcBQ4VHz/TBPQ=; b=ep2v5ZmSsLNz4qGWR/5NJ2pyQhMzlx8ZymuRWj2GiqoYFMkbReMf7Fi8 4UoZaws3oe0sEqzhA5GjsAMIqxuMCLBK1Dwo/h80RNJw48NboBn7Hsihy JPmdHukr57h6hQt6TT2ZtmW/So4nyOm+b7Vhln8nLqg0JJmduAFYSy8JL OFu06T65YD+BP6eX/IvkY92Ro3lvXQKBCbWLyWx67mqQYx+IU77nnIStL vTklLSIOYBcgNtnhZz1dT4a75NxIENO/thHyRtdAMcaLXOyFK6/osQSX9 NPF+j63rPK0T73oJtD7CcmeeiZU8p29Cj1aq+PykR+Fw9bTKBeH4zuDkq A==; X-CSE-ConnectionGUID: 0RvL/NPXQLWdPMhFzJTjYg== X-CSE-MsgGUID: TRF+b+39QqCv3Kt0RH1wpg== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290623" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290623" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:43 -0700 X-CSE-ConnectionGUID: vsV7XhHgRo25bOlE0XUwRw== X-CSE-MsgGUID: UB9LVCLCQZGb4I0qHSboiA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259032" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:43 -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 , Ranjani Sridharan , =?utf-8?q?P=C3=A9ter?= =?utf-8?q?_Ujfalusi?= , Bard Liao Subject: [PATCH 07/12] ASoC: Intel: sof-sdw: don't set card long_name Date: Fri, 26 Apr 2024 10:21:18 -0500 Message-Id: <20240426152123.36284-8-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 UCM can load a board-specific file based on the card long_name. Remove the constant "Intel Soundwire SOF" long_name so that the ASoC core can set the long_name based on DMI information. Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi Reviewed-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 384c3d41a9ad..b9a5fcb42847 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1879,9 +1879,6 @@ static int sof_sdw_card_late_probe(struct snd_soc_card *card) return ret; } -/* SoC card */ -static const char sdw_card_long_name[] = "Intel Soundwire SOF"; - /* helper to get the link that the codec DAI is used */ static struct snd_soc_dai_link *mc_find_codec_dai_used(struct snd_soc_card *card, const char *dai_name) @@ -1999,8 +1996,6 @@ static int mc_probe(struct platform_device *pdev) return -ENOMEM; } - card->long_name = sdw_card_long_name; - /* Register the card */ ret = devm_snd_soc_register_card(card->dev, card); if (ret) { From patchwork Fri Apr 26 15:21:19 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: 13644951 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 C7C3414E2EF for ; Fri, 26 Apr 2024 15:21:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144906; cv=none; b=DzJya5rh9DKtXtGnkFLYXL8x5EhWr0ZGedWbOBf9unZBLRiie6EHF/4X0QMJEqC4JhO8nznDKpoEO4k8qmHY4SMbA/LMUcKMJm0fvf4q4GdWuEsUsn2rrg6ZWBJF4xoMrExQyGzWqT7l9vM11aVha+HtUouvTktp/tLKvhlM2FU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144906; c=relaxed/simple; bh=B+qnbfKGxF53UUuVHpaWIUfNY181CpLVuoKVGa7skpQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aHlZc0Nf/AicRXAEMZlMv9iOt0SLVGfur8jw6OBAKX0eIc7gZPfa4tAyanaqr74pkKMyIYlIDfjsrwyrkbvs0Cz90ui9BY2As6sP4gR1Wp4EgwrIsmCyCWIrPgpuDpXx1T0FuoFUSFscb3K5WAl/y7b4g4gEhcMQsFR4c6/5Of0= 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=bsLemxf8; arc=none smtp.client-ip=192.198.163.10 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="bsLemxf8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144905; x=1745680905; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B+qnbfKGxF53UUuVHpaWIUfNY181CpLVuoKVGa7skpQ=; b=bsLemxf88MMtYl+g7eUbfgg3Vct0hroDcs83693fu2rBQrGIVA9/9sug o2LdeVu0+jHGegVJ0R7maYdNT6CgAeIvrt8R9q6FzdRFoCqrbKzuR9DL2 IJzcAHRUhWh4ZkXg9RRS+7cn3keiHMUla43DGNXLsGY4uEzDnSJ3edH+G exDXaIK8N0cHx14fFuL7A9ofMpBbKtCs64likncMd3QKfzKAEPjMl3P6g 6PiV7oXIVevImzcQB0khfF3gmRWU5qKInjDAGdPzygper1Bb84bkJMwfp xwSIb3W2aRt7prxgULXQlEgpHLblGRLwsGS2bgqRWuVKYvUuJocCmZqKC g==; X-CSE-ConnectionGUID: qQJH7nNkREOVzWyT0MJVgQ== X-CSE-MsgGUID: 4OlmpVKlR6Sq4kUit3PFcQ== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290629" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290629" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:44 -0700 X-CSE-ConnectionGUID: Qp10kG6pT8yVpCgnhl65ig== X-CSE-MsgGUID: U/5AsQU4SDu6nu5qMrIOmA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259033" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:44 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Bard Liao , Pierre-Louis Bossart Subject: [PATCH 08/12] ASoC: Intel: sof_sdw: add a space before cfg-amp in components Date: Fri, 26 Apr 2024 10:21:19 -0500 Message-Id: <20240426152123.36284-9-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 UCM parse amp with Regex " cfg-amp:([0-9]+)". The "ASoC: Intel: sof_sdw: remove FOUR_SPEAKER quirks" patch removed "cfg-spk:%d " from components which removed the necessary space as well and cause UCM can't parse the amp number properly. Fixes: 744866d28fe6 ("ASoC: Intel: sof_sdw: remove FOUR_SPEAKER quirks") Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index b9a5fcb42847..f0622aa1b748 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1983,7 +1983,7 @@ static int mc_probe(struct platform_device *pdev) amp_num += codec_info_list[i].amp_num; card->components = devm_kasprintf(card->dev, GFP_KERNEL, - "cfg-amp:%d", amp_num); + " cfg-amp:%d", amp_num); if (!card->components) return -ENOMEM; From patchwork Fri Apr 26 15:21:20 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: 13644952 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 F085014F109 for ; Fri, 26 Apr 2024 15:21:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144906; cv=none; b=WlcXwFGTA2oTy4JdmGgH9niAB2BJFTFwmI2i111toXIVptsPYmRVJ20A77hF9DcV6BF35DPJjSmbua92yQ/Fdo+ahwaPmQJgB8isAeTrTbx+fUkQAhcBSIwoc8DmZyhGAwNMKeSrKM95GjYqeH69qXGqBf0fTw7i6BQNvfYqc0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144906; c=relaxed/simple; bh=UJY7grWSVVzmt71CoQKUJ8Ty1qxgNvohbcE1hvLC7tk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EBohwkw20ZAftaSidpoSUw+3dYwpmngfZSqvKowDYDzj+XgtDMuptqb5WuGXRFk59F7ecjNVA47hLCmZ6zxe6QyiHxoRF8ysfc+IfFFeHfzcKr4j1xe0jKI8OqI1/1f32NBNDGyL2IodH6xG3R8mrJlrVyuNzecOyQEO7m9h+0k= 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=LE6ku8Bd; arc=none smtp.client-ip=192.198.163.10 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="LE6ku8Bd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144905; x=1745680905; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UJY7grWSVVzmt71CoQKUJ8Ty1qxgNvohbcE1hvLC7tk=; b=LE6ku8BdTHrH7XfZW6mQa6t85pS879fK4bAwMQylAoVvunFACmPUUWBi HNIIARKbnTPun8cRsvAcx+tgaGaM1HG0ykNbZyenfwaBfTTmQS5rYwauE B7mqQpHWGz3kP7pe2VyopVtxkwGCT5ACEsM3seYRsLekO+UltjEd48lbg buXPHYsdDYgpeGC7+ffkJrZyqgRf2ii/RsINvHgvdfcpTuYGUKWpBdDmg WIILSnM2Qe+DU7UfaFaV8w9L1nS/YJ4VKKQimt57/A92IsdtLin2VTtuM xoRy49D58LE9lkODFwKPEp+Oss8pqsqPH3p9nJ52+17awk1hOG1b/0EFt A==; X-CSE-ConnectionGUID: mYxR7ChUTpOT82YdOI6rmA== X-CSE-MsgGUID: tWHMnd+6S0u/efewWzeYNQ== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290633" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290633" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:44 -0700 X-CSE-ConnectionGUID: gt9LVAm6QmiwgOr3gOQCRw== X-CSE-MsgGUID: RwChO4oNRTmnwcKIe8RYNw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259034" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:44 -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 09/12] ASoC: Intel: sof-sdw: really remove FOUR_SPEAKER quirk Date: Fri, 26 Apr 2024 10:21:20 -0500 Message-Id: <20240426152123.36284-10-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 Two independent GitHub PRs let to the addition of one quirk after it was removed.. Fixes: b10cb955c6c0 ("ASoC: Intel: sof_sdw: add quirk for Dell SKU 0C0F") Reviewed-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index f0622aa1b748..86bbf1c66ce8 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -421,8 +421,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0C0F") }, .driver_data = (void *)(SOF_SDW_TGL_HDMI | - RT711_JD2 | - SOF_SDW_FOUR_SPK), + RT711_JD2), }, { .callback = sof_sdw_quirk_cb, From patchwork Fri Apr 26 15:21:21 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: 13644955 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 7D0A62E639 for ; Fri, 26 Apr 2024 15:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144910; cv=none; b=rQk+Zft5LDcRKFrdI+jKnS4YzuY9y9wGtz2rwLysDAWw62OBg7+t3a0zccFpmsJleOfJLS6o9rA7m/m9StD01EjnnCvdbYGodgSJYrNGM5wAQuJCkhiDm6UdEedPtyURNNAHUvbgwBZW7nuc07XTM0RT2YNB0Luu0bWfV+MLRh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144910; c=relaxed/simple; bh=/Q5k951MfI29ZAL5D5tRdzssa6I65w19r08aEgCu76Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qXublm0w01z7AMosXUWCWHUOrXFiQRv82ePcFlUFhoEejGqexXxUW32UTntCHohchtx+cyucj2Qr0qzI5WFo3vpY52nlTFK4sFFvh1fhZCkVut6vq9Z3uugUSr+dVM+szHihF2vFrG5fc2acw3z2o47/S12B/QMF2o2elgAk60A= 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=Gs+y0ziJ; arc=none smtp.client-ip=192.198.163.10 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="Gs+y0ziJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144906; x=1745680906; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/Q5k951MfI29ZAL5D5tRdzssa6I65w19r08aEgCu76Y=; b=Gs+y0ziJe9yU9GN9j3jFJc/VWj+eDdsODkkBKGNsffeX8caIg3sYI5P7 /oz16F/awXR/kmmROgiQMDc7YwfjRh/q0Nv8tU1+5aLfC044CtGxWAn8/ 2DTw89oYZpG6VXqBDfm4wf3ONIo0t/ZEDILpboJNY8AESi/NjWc54vOYc dseCOxFLdG28TrCF2k0H1MY3lLN+8k97N/MFehoU1/xs6BaVk5PNGEkE5 MzNdVtiis1QQWHhxH8usrxlRR20Kpo/p3EBzaRnrCCVjjG1Rc5Bcr9rBs pQmv1n+CCVAor5t66SNxPGhkiZudTG154ynM93TdLKMk4EswSdnC/LRXB Q==; X-CSE-ConnectionGUID: hqBYqxljQlW/pVmKAxNSug== X-CSE-MsgGUID: 6X6rL+BzR8iswfBY8SiUeA== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290638" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290638" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:45 -0700 X-CSE-ConnectionGUID: RD49e2H4TWOHLoDjzogJVA== X-CSE-MsgGUID: PRT5lEO8TNSBWTG8n0TS7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259035" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21: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 , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 10/12] ASoC: Intel: sof_sdw: Delay update of the codec_conf array Date: Fri, 26 Apr 2024 10:21:21 -0500 Message-Id: <20240426152123.36284-11-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 population of the codec_conf array from endpoint parsing time to link creation time. This is slightly cleaner as the population is done whilst the DAI links are also being populated, putting all population together. However, primarily this facilitates allowing additional non-SoundWire devices to be easily added into the array in future feature additions. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 48 ++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 86bbf1c66ce8..bf5f46a4c4aa 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1279,6 +1279,7 @@ struct sof_sdw_endpoint { u32 link_mask; const char *codec_name; + const char *name_prefix; struct sof_sdw_codec_info *codec_info; const struct sof_sdw_dai_info *dai_info; @@ -1340,7 +1341,6 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, 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; const struct snd_soc_acpi_link_adr *adr_link; struct sof_sdw_endpoint *sof_end = sof_ends; int num_dais = 0; @@ -1376,13 +1376,11 @@ 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); + sof_end->name_prefix = adr_dev->name_prefix; + 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; @@ -1443,21 +1441,27 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, ctx->append_dai_type |= (num_link_dailinks > 1); } - WARN_ON(codec_conf != card->codec_conf + card->num_configs); - return num_dais; } static int create_sdw_dailink(struct snd_soc_card *card, struct sof_sdw_dailink *sof_dai, struct snd_soc_dai_link **dai_links, - int *be_id) + int *be_id, struct snd_soc_codec_conf **codec_conf) { struct device *dev = card->dev; struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct sof_sdw_endpoint *sof_end; int stream; + list_for_each_entry(sof_end, &sof_dai->endpoints, list) { + if (sof_end->name_prefix) { + (*codec_conf)->dlc.name = sof_end->codec_name; + (*codec_conf)->name_prefix = sof_end->name_prefix; + (*codec_conf)++; + } + } + for_each_pcm_streams(stream) { static const char * const sdw_stream_name[] = { "SDW%d-Playback", @@ -1569,7 +1573,8 @@ static int create_sdw_dailink(struct snd_soc_card *card, 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 sof_sdw_dailink *sof_dais, + struct snd_soc_codec_conf **codec_conf) { struct mc_private *ctx = snd_soc_card_get_drvdata(card); int ret, i; @@ -1581,7 +1586,8 @@ static int create_sdw_dailinks(struct snd_soc_card *card, while (sof_dais->initialised) { int current_be_id; - ret = create_sdw_dailink(card, sof_dais, dai_links, ¤t_be_id); + ret = create_sdw_dailink(card, sof_dais, dai_links, + ¤t_be_id, codec_conf); if (ret) return ret; @@ -1751,16 +1757,6 @@ 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; @@ -1798,6 +1794,12 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) sdw_be_num, ssp_num, dmic_num, ctx->hdmi.idisp_codec ? hdmi_num : 0, bt_num); + codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL); + if (!codec_conf) { + ret = -ENOMEM; + goto err_end; + } + /* 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); @@ -1806,12 +1808,15 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto err_end; } + card->codec_conf = codec_conf; + card->num_configs = num_devs; card->dai_link = dai_links; card->num_links = num_links; /* SDW */ if (sdw_be_num) { - ret = create_sdw_dailinks(card, &dai_links, &be_id, sof_dais); + ret = create_sdw_dailinks(card, &dai_links, &be_id, + sof_dais, &codec_conf); if (ret) goto err_end; } @@ -1847,6 +1852,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto err_end; } + WARN_ON(codec_conf != card->codec_conf + card->num_configs); WARN_ON(dai_links != card->dai_link + card->num_links); err_end: From patchwork Fri Apr 26 15:21:22 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: 13644953 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 4B6A615217A for ; Fri, 26 Apr 2024 15:21:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144907; cv=none; b=HLlbU13dRRlgwiZudHSyxBu0kzmNsdPUdIMOYxebp9y5pAi8SHx15DHhBX+KIb+/Zy0G7+DyN+g1aY5FwCdd3si+qLrQ5S/w342Ca3RwDd50cyTT7gIZuIQ01FHPORZJF2VBtTv5KuejzgZkjrIGmnOHsAOC+0TLhCNlYsf8SPk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144907; c=relaxed/simple; bh=RZNfJj9F38dpuilu8NRrmzX3jZ+dUkuFYYD7MAVqxbc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tQVKLtrDfWqoot5W5bAoHbgQyzUkHt4YjEbDSF6jCNinqnHOU1UsGS4BAJowgQQAexc0p41+2deu5WPeSWHIcTEZoSMgzlsJXByZiQP9Id32RasveZ5KKsQ6nfE3w3K1pBWO/Eh3Fl7qt+na81ToB20Jm6aYEOX92RX4gLdhWiQ= 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=XyfKSDSt; arc=none smtp.client-ip=192.198.163.10 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="XyfKSDSt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144906; x=1745680906; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RZNfJj9F38dpuilu8NRrmzX3jZ+dUkuFYYD7MAVqxbc=; b=XyfKSDStp+YKDzJAvIeLuuVTtjvje2YJVcIXPAgpUoT+/Y8A2yTMrbyY Dw8zrsfYlfNo7Jbj9zrdAAzLyqcv2MIdgZjtKvuMLWslToua631udoIBF 649RkaXPI2azE71PKkTEdHy2V66Ua8RX8VNI0n7bdchqV473Z28F5QSvs 3G4hsNRu4DHwqWfL6Cg7UJUosz1YNpXkykvfhF1o4/R3K6Ax4fD0SFuTd rITyGc0DjeWBhj/sFiMa5GS1Vslc9jJEgbnymns7L9n0PpDR4I+YTqzRE GKOY59uYNpynlYK0LzTressPbUzpH961QKB4yZaGuDt7xU8wnmUeT1Dsi Q==; X-CSE-ConnectionGUID: EnbsNjh8SzSCI1py7FoONg== X-CSE-MsgGUID: Xeg9Ho1ZQdKLFQ1/tCucfw== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290643" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290643" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:46 -0700 X-CSE-ConnectionGUID: 06E7xQTIQ5iaw7c1jIzf3A== X-CSE-MsgGUID: ObVN4uEdSZmAcHeOR4472w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259037" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21: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 , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 11/12] ASoC: Intel: sof_sdw: Add callbacks to register sidecar devices Date: Fri, 26 Apr 2024 10:21:22 -0500 Message-Id: <20240426152123.36284-12-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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 systems that have additional non-SoundWire devices (sidecars) connected to one of the SoundWire devices in the system. This is done through the addition of two callbacks, one used at endpoint parsing time that will return the number of devices and DAI links to be added, and another called later as the DAI links are created that will populate those devices into the appropriate arrays. Reviewed-by: Bard Liao Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 22 ++++++++++++++++++++-- sound/soc/intel/boards/sof_sdw_common.h | 6 ++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index bf5f46a4c4aa..eaa79e29f5c2 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1280,6 +1280,7 @@ struct sof_sdw_endpoint { u32 link_mask; const char *codec_name; const char *name_prefix; + bool include_sidecar; struct sof_sdw_codec_info *codec_info; const struct sof_sdw_dai_info *dai_info; @@ -1335,7 +1336,8 @@ static struct sof_sdw_dailink *find_dailink(struct sof_sdw_dailink *dailinks, static int parse_sdw_endpoints(struct snd_soc_card *card, struct sof_sdw_dailink *sof_dais, - struct sof_sdw_endpoint *sof_ends) + struct sof_sdw_endpoint *sof_ends, + int *num_devs) { struct device *dev = card->dev; struct mc_private *ctx = snd_soc_card_get_drvdata(card); @@ -1345,6 +1347,7 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, struct sof_sdw_endpoint *sof_end = sof_ends; int num_dais = 0; int i, j; + int ret; for (adr_link = mach_params->links; adr_link->num_adr; adr_link++) { int num_link_dailinks = 0; @@ -1381,6 +1384,14 @@ static int parse_sdw_endpoints(struct snd_soc_card *card, sof_end->name_prefix = adr_dev->name_prefix; + if (codec_info->count_sidecar && codec_info->add_sidecar) { + ret = codec_info->count_sidecar(card, &num_dais, num_devs); + if (ret) + return ret; + + sof_end->include_sidecar = true; + } + 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; @@ -1453,6 +1464,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct sof_sdw_endpoint *sof_end; int stream; + int ret; list_for_each_entry(sof_end, &sof_dai->endpoints, list) { if (sof_end->name_prefix) { @@ -1460,6 +1472,12 @@ static int create_sdw_dailink(struct snd_soc_card *card, (*codec_conf)->name_prefix = sof_end->name_prefix; (*codec_conf)++; } + + if (sof_end->include_sidecar) { + ret = sof_end->codec_info->add_sidecar(card, dai_links, codec_conf); + if (ret) + return ret; + } } for_each_pcm_streams(stream) { @@ -1757,7 +1775,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto err_dai; } - ret = parse_sdw_endpoints(card, sof_dais, sof_ends); + ret = parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs); if (ret < 0) goto err_end; diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 853278c6e525..9dd42a8da8d7 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -98,6 +98,12 @@ struct sof_sdw_codec_info { const int dai_num; int (*codec_card_late_probe)(struct snd_soc_card *card); + + int (*count_sidecar)(struct snd_soc_card *card, + int *num_dais, int *num_devs); + int (*add_sidecar)(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, + struct snd_soc_codec_conf **codec_conf); }; struct mc_private { From patchwork Fri Apr 26 15:21:23 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: 13644954 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 EA5D414F109 for ; Fri, 26 Apr 2024 15:21:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144908; cv=none; b=XzySbJBIUOPLK2EFugkimUZCR9CCVq/QgxK+9190XVhaSna3/DmlxdkVvivXgriwSBvaFgZGCRkyHnfPSr4PK23CHqboJbZgYf1I4Av6JBjQJYR21BtPPiHe8Ws5MJj7w/C0zwjpIZ6Vp6CVRQFhRHPJ8LhpJNPwhaijXr+k3Ic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144908; c=relaxed/simple; bh=JiO2nqs/sWgSFc5uIdbhgYj17fRvGxX59e1sBqxBGAs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jBoBFjHu2HDMtaepcGb0n/W8cAWY696FUuu/U4HICv+VdwGh2QiZM6qdWXYc9J++0neJcBCv56Cyre6DmVemPEXfkQM2qfahyxpMzxYScc+UlQAfMEDgL2Pw9/m29hAdu4vVeFVvUAXrL3bUUrQeMiwpNeDUTrF/4v4Nn4H9bZ8= 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=lmfiVfOq; arc=none smtp.client-ip=192.198.163.10 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="lmfiVfOq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714144907; x=1745680907; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JiO2nqs/sWgSFc5uIdbhgYj17fRvGxX59e1sBqxBGAs=; b=lmfiVfOqlXRRbba8cSysEdfbaEO/BTQ9MNu6w4EbaPcpt9LUVYUsiy30 hO7poJmJ0WxSaqXuGWqnbuXhhu6MRb8+KZ/SmPMnb37j6ydwCWrSt3uGd ktYBUPdMS53vUn3ihP3HMlQdVFCxgCNOPjzCjBxFdfX+hz4dUbS8xz3JX S28matW47Tfc0p5ITTlfsCMBBR0SGfxapIQXz2PU9bxTfhW3POR9IBMo5 T2aSfwSE2wIBgcQC17xNErn3xS1rgEFXnaZY0SNwudQtNNGzRGFWT2fR5 wYQHyeCca28cLUyWNwXCgBiyZKoOeU0RG68jyJSRRwGJV7PQdaZPb/2d/ g==; X-CSE-ConnectionGUID: aSBcz+a4T4izB44Iky9uCA== X-CSE-MsgGUID: gj+6Oz50T2m5eSe+7bGqtQ== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="21290648" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21290648" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:47 -0700 X-CSE-ConnectionGUID: RWEu+Ar7RF+2fJQTjo1PVQ== X-CSE-MsgGUID: Fg7PsVoWQV6lZyS1q1ZwCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="30259038" Received: from atarkhan-mobl2.amr.corp.intel.com (HELO pbossart-mobl6.intel.com) ([10.212.33.33]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 08:21:46 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Maciej Strozek , Bard Liao , Charles Keepax , Pierre-Louis Bossart Subject: [PATCH 12/12] ASoC: intel: sof_sdw: Add support for cs42l43-cs35l56 sidecar amps Date: Fri, 26 Apr 2024 10:21:23 -0500 Message-Id: <20240426152123.36284-13-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240426152123.36284-1-pierre-louis.bossart@linux.intel.com> References: <20240426152123.36284-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: Maciej Strozek The cs42l43 has both a SPI master and an I2S interface, these can be used to populate 2 cs35l56 amplifiers as sidecar devices along side the cs42l43. Giving a system that looks like: +-----+ +---------+ <- SPI -> +---------+ | CPU | <- SDW -> | CS42L43 | | CS35L56 | +-----+ +---------+ <- I2S -> +---------+ Add a quirk to specify this feature is present and use it to add codec to codec DAI link to connect the amplifiers into the sound card, add appropriate widgets, and setup clocking on the amplifiers. Reviewed-by: Bard Liao Signed-off-by: Maciej Strozek Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/Kconfig | 1 + sound/soc/intel/boards/Makefile | 1 + sound/soc/intel/boards/bridge_cs35l56.c | 137 +++++++++++++++++++++++ sound/soc/intel/boards/sof_sdw.c | 6 +- sound/soc/intel/boards/sof_sdw_common.h | 20 ++++ sound/soc/intel/boards/sof_sdw_cs42l43.c | 14 ++- 6 files changed, 173 insertions(+), 6 deletions(-) create mode 100644 sound/soc/intel/boards/bridge_cs35l56.c diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig index 0ad7b0a1e237..b122b8aedd9a 100644 --- a/sound/soc/intel/boards/Kconfig +++ b/sound/soc/intel/boards/Kconfig @@ -690,6 +690,7 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH select SND_SOC_CS42L43_SDW select MFD_CS42L43 select MFD_CS42L43_SDW + select SND_SOC_CS35L56_SPI select SND_SOC_CS35L56_SDW select SND_SOC_DMIC select SND_SOC_INTEL_HDA_DSP_COMMON diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile index 119413c262de..1c099e717eca 100644 --- a/sound/soc/intel/boards/Makefile +++ b/sound/soc/intel/boards/Makefile @@ -37,6 +37,7 @@ snd-soc-ehl-rt5660-objs := ehl_rt5660.o snd-soc-sof-ssp-amp-objs := sof_ssp_amp.o snd-soc-sof-sdw-objs += sof_sdw.o \ sof_sdw_maxim.o sof_sdw_rt_amp.o \ + bridge_cs35l56.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_rt722_sdca.o \ diff --git a/sound/soc/intel/boards/bridge_cs35l56.c b/sound/soc/intel/boards/bridge_cs35l56.c new file mode 100644 index 000000000000..c3995e724aed --- /dev/null +++ b/sound/soc/intel/boards/bridge_cs35l56.c @@ -0,0 +1,137 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// Intel SOF Machine Driver with Cirrus Logic CS35L56 Smart Amp + +#include +#include +#include +#include +#include +#include +#include +#include "sof_sdw_common.h" + +static const struct snd_soc_dapm_widget bridge_widgets[] = { + SND_SOC_DAPM_SPK("Bridge Speaker", NULL), +}; + +static const struct snd_soc_dapm_route bridge_map[] = { + {"Bridge Speaker", NULL, "AMPL SPK"}, + {"Bridge Speaker", NULL, "AMPR SPK"}, +}; + +static const char * const bridge_cs35l56_name_prefixes[] = { + "AMPL", + "AMPR", +}; + +static int bridge_cs35l56_asp_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_card *card = rtd->card; + int i, ret; + unsigned int rx_mask = 3; // ASP RX1, RX2 + unsigned int tx_mask = 3; // ASP TX1, TX2 + struct snd_soc_dai *codec_dai; + struct snd_soc_dai *cpu_dai; + + card->components = devm_kasprintf(card->dev, GFP_KERNEL, + "%s spk:cs35l56-bridge", + card->components); + if (!card->components) + return -ENOMEM; + + ret = snd_soc_dapm_new_controls(&card->dapm, bridge_widgets, + ARRAY_SIZE(bridge_widgets)); + if (ret) { + dev_err(card->dev, "widgets addition failed: %d\n", ret); + return ret; + } + + ret = snd_soc_dapm_add_routes(&card->dapm, bridge_map, ARRAY_SIZE(bridge_map)); + if (ret) { + dev_err(card->dev, "map addition failed: %d\n", ret); + return ret; + } + + /* 4 x 16-bit sample slots and FSYNC=48000, BCLK=3.072 MHz */ + for_each_rtd_codec_dais(rtd, i, codec_dai) { + ret = snd_soc_dai_set_tdm_slot(codec_dai, tx_mask, rx_mask, 4, 16); + if (ret < 0) + return ret; + + ret = snd_soc_dai_set_sysclk(codec_dai, 0, 3072000, SND_SOC_CLOCK_IN); + if (ret < 0) + return ret; + } + + for_each_rtd_cpu_dais(rtd, i, cpu_dai) { + ret = snd_soc_dai_set_tdm_slot(cpu_dai, tx_mask, rx_mask, 4, 16); + if (ret < 0) + return ret; + } + + return 0; +} + +static const struct snd_soc_pcm_stream bridge_params = { + .formats = SNDRV_PCM_FMTBIT_S16_LE, + .rate_min = 48000, + .rate_max = 48000, + .channels_min = 2, + .channels_max = 2, +}; + +SND_SOC_DAILINK_DEFS(bridge_dai, + DAILINK_COMP_ARRAY(COMP_CODEC("cs42l43-codec", "cs42l43-asp")), + DAILINK_COMP_ARRAY(COMP_CODEC("spi-cs35l56-left", "cs35l56-asp1"), + COMP_CODEC("spi-cs35l56-right", "cs35l56-asp1")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("cs42l43-codec"))); + +static const struct snd_soc_dai_link bridge_dai_template = { + .name = "cs42l43-cs35l56", + .init = bridge_cs35l56_asp_init, + .c2c_params = &bridge_params, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBC_CFC, + SND_SOC_DAILINK_REG(bridge_dai), +}; + +int bridge_cs35l56_count_sidecar(struct snd_soc_card *card, + int *num_dais, int *num_devs) +{ + if (sof_sdw_quirk & SOF_SIDECAR_AMPS) { + (*num_dais)++; + (*num_devs) += ARRAY_SIZE(bridge_cs35l56_name_prefixes); + } + + return 0; +} + +int bridge_cs35l56_add_sidecar(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, + struct snd_soc_codec_conf **codec_conf) +{ + if (sof_sdw_quirk & SOF_SIDECAR_AMPS) { + **dai_links = bridge_dai_template; + + for (int i = 0; i < ARRAY_SIZE(bridge_cs35l56_name_prefixes); i++) { + (*codec_conf)->dlc.name = (*dai_links)->codecs[i].name; + (*codec_conf)->name_prefix = bridge_cs35l56_name_prefixes[i]; + (*codec_conf)++; + } + + (*dai_links)++; + } + + return 0; +} + +int bridge_cs35l56_spk_init(struct snd_soc_card *card, + struct snd_soc_dai_link *dai_links, + struct sof_sdw_codec_info *info, + bool playback) +{ + if (sof_sdw_quirk & SOF_SIDECAR_AMPS) + info->amp_num += ARRAY_SIZE(bridge_cs35l56_name_prefixes); + + return 0; +} diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index eaa79e29f5c2..b1595fdb500d 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -39,6 +39,8 @@ static void log_quirks(struct device *dev) 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"); + if (sof_sdw_quirk & SOF_SIDECAR_AMPS) + dev_dbg(dev, "quirk SOF_SIDECAR_AMPS enabled\n"); } static int sof_sdw_quirk_cb(const struct dmi_system_id *id) @@ -995,6 +997,8 @@ static struct sof_sdw_codec_info codec_info_list[] = { { .part_id = 0x4243, .codec_name = "cs42l43-codec", + .count_sidecar = bridge_cs35l56_count_sidecar, + .add_sidecar = bridge_cs35l56_add_sidecar, .dais = { { .direction = {true, false}, @@ -1023,7 +1027,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { .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, + .quirk = SOF_CODEC_SPKR | SOF_SIDECAR_AMPS, }, }, .dai_num = 4, diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 9dd42a8da8d7..94657dd210f5 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -55,6 +55,16 @@ enum { #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) +/* + * If the CODEC has additional devices attached directly to it. + * + * For the cs42l43: + * - 0 - No speaker output + * - SOF_CODEC_SPKR - CODEC internal speaker + * - SOF_SIDECAR_AMPS - 2x Sidecar amplifiers + CODEC internal speaker + * - SOF_CODEC_SPKR | SOF_SIDECAR_AMPS - Not currently supported + */ +#define SOF_SIDECAR_AMPS BIT(16) /* BT audio offload: reserve 3 bits for future */ #define SOF_BT_OFFLOAD_SSP_SHIFT 15 @@ -177,6 +187,16 @@ int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card, bool playback); /* CS AMP support */ +int bridge_cs35l56_count_sidecar(struct snd_soc_card *card, + int *num_dais, int *num_devs); +int bridge_cs35l56_add_sidecar(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, + struct snd_soc_codec_conf **codec_conf); +int bridge_cs35l56_spk_init(struct snd_soc_card *card, + struct snd_soc_dai_link *dai_links, + struct sof_sdw_codec_info *info, + bool playback); + int sof_sdw_cs_amp_init(struct snd_soc_card *card, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, diff --git a/sound/soc/intel/boards/sof_sdw_cs42l43.c b/sound/soc/intel/boards/sof_sdw_cs42l43.c index 5361249f0f53..0fd5e099bb1a 100644 --- a/sound/soc/intel/boards/sof_sdw_cs42l43.c +++ b/sound/soc/intel/boards/sof_sdw_cs42l43.c @@ -124,10 +124,14 @@ 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; + if (!(sof_sdw_quirk & SOF_SIDECAR_AMPS)) { + /* Will be set by the bridge code in this case */ + 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)); @@ -155,7 +159,7 @@ int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card, info->amp_num++; - return 0; + return bridge_cs35l56_spk_init(card, dai_links, info, playback); } int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd)