From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B56B1CDB482 for ; Tue, 17 Oct 2023 14:47:36 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3AB10857; Tue, 17 Oct 2023 16:46:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3AB10857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697554054; bh=lFUwUxTqgUoKPf+e6xix+hIX2T1tys85l9kPE+lIogk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=sFWxy3QhfwCbeG6qfsEo1SAdkpF5l4HICH3jI/5nxbR/sdZTwNB83YSTC4ulntMjP J5p6rwRofdGN8bOPPr8smy5xA3+5ZZnzXUgW43XwGIXcCgEE89U1D5Z3X0DwBRa7J4 RH1fsckYuA0lEvmS2PvplyH7+1+dv5kjTl0BX3ow= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2CFFBF80552; Tue, 17 Oct 2023 16:46:22 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 60252F80552; Tue, 17 Oct 2023 16:46:21 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B01FBF8025F; Tue, 17 Oct 2023 16:46:17 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 618EAF80236 for ; Tue, 17 Oct 2023 16:46:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 618EAF80236 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=dcSwSJz0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697553974; x=1729089974; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=lFUwUxTqgUoKPf+e6xix+hIX2T1tys85l9kPE+lIogk=; b=dcSwSJz0EhSay8wPBhrTYrLMVGRLPaVEQmT6CzOKPsfN9YoNMVUqK4BR 27rGZPF/5lgf/kA1zXPUAe285LHL2IHDbQGrNzhJ2S2SghO7fIxIxdl/p ibVW3yR2i5CHYsnBY6S4c7agn90fXr7Ms773MEnkoNhq3DFooMzS5ai53 iiUraRroYZzgcv219BpeJDRe6Ot0TQbG6Z5XgPpMCv5CffYiFFMT68ElV tgAMK2unpEyo2wKz+vxgk58JaMp2m7FD9dLoqC3Z8gGn10UoWo9D4RRVL ejbHPFDU5S30s6gDUwIEVD3J7iG3mSc/o3ipWeD9Yk9se76J7jN36nmz3 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="366060399" X-IronPort-AV: E=Sophos;i="6.03,232,1694761200"; d="scan'208";a="366060399" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 07:46:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="826474115" X-IronPort-AV: E=Sophos;i="6.03,232,1694761200"; d="scan'208";a="826474115" Received: from asprado-mobl2.amr.corp.intel.com (HELO [10.212.55.179]) ([10.212.55.179]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 07:46:08 -0700 Message-ID: Date: Tue, 17 Oct 2023 09:45:55 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/4] ASoC: makes CPU/Codec channel connection map more generic Content-Language: en-US To: Kuninori Morimoto , Mark Brown , Bard Liao , bard.liao@intel.com, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Jerome Brunet Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org References: <87zg0jwdnz.wl-kuninori.morimoto.gx@renesas.com> <87y1g3wdng.wl-kuninori.morimoto.gx@renesas.com> From: Pierre-Louis Bossart In-Reply-To: <87y1g3wdng.wl-kuninori.morimoto.gx@renesas.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Message-ID-Hash: KHDB37MMHH7BMCTWTCJTLQIO6JDKDJ7T X-Message-ID-Hash: KHDB37MMHH7BMCTWTCJTLQIO6JDKDJ7T X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi Morimoto-san, we're facing an across-the-board regression with this patch, even in regular 'nocodec' configurations with dummy dais and no codec. > @@ -1055,22 +1054,28 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd, > /* copy params for each cpu */ > tmp_params = *params; > > - if (!rtd->dai_link->codec_ch_maps) > - goto hw_params; By removing this test, we now proceed and deal with both FE and BE... > /* > * construct cpu channel mask by combining ch_mask of each > * codec which maps to the cpu. > + * see > + * soc.h :: [dai_link->ch_maps Image sample] > */ > - for_each_rtd_codec_dais(rtd, j, codec_dai) { > - if (rtd->dai_link->codec_ch_maps[j].connected_cpu_id == i) > - ch_mask |= rtd->dai_link->codec_ch_maps[j].ch_mask; > + if (rtd->dai_link->num_cpus >= rtd->dai_link->num_codecs) { > + /* .ch_map is from CPU */ > + ch_mask = rtd->dai_link->ch_maps[i].ch_mask; ... and for a FE dailink there's no ch_maps so this results in a kernel oops. > + } else { > + int j; > + > + /* .ch_map is from Codec */ > + for_each_rtd_codec_dais(rtd, j, codec_dai) > + if (rtd->dai_link->ch_maps[j].connected_node == i) > + ch_mask |= rtd->dai_link->ch_maps[j].ch_mask; > } > > /* fixup cpu channel number */ > if (ch_mask) > soc_pcm_codec_params_fixup(&tmp_params, ch_mask); > > -hw_params: > ret = snd_soc_dai_hw_params(cpu_dai, substream, &tmp_params); > if (ret < 0) > goto out; Bard suggested the following diff (being tested now), comments welcome. diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 0bfff2ea111d..ce84d9c1d8be 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1054,6 +1054,9 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd, /* copy params for each cpu */ tmp_params = *params; + /* ch_map is only set in BE dai link */ + if (rtd->dai_link->dynamic) + goto run; /* * construct cpu channel mask by combining ch_mask of each * codec which maps to the cpu. @@ -1075,7 +1078,7 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd, /* fixup cpu channel number */ if (ch_mask) soc_pcm_codec_params_fixup(&tmp_params, ch_mask); - +run: ret = snd_soc_dai_hw_params(cpu_dai, substream, &tmp_params); if (ret < 0) goto out;