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 CA686C27C76 for ; Wed, 25 Jan 2023 14:13:47 +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 36078200; Wed, 25 Jan 2023 15:12:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 36078200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674656025; bh=I2bmj9RQtk4j7XTXY4tF5RnFzK70rASd/GtJZmZn4kg=; h=Date:Subject:From:To:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=HDfnmyZGf43kgfBRAQC/5FZMUpxZwSvD+bQCjZuBE6Hzlx6R+RwFzacXHDFHRmV5D CeLSfejQUM9dFM63G/BZA19DxfXeoKnVdHdoAbA6RNiLTf33Nj7FgWQhUaICVfpiXn O9YIZEIxw8DexiQyRRBYJGlhS8m85IoY89LdImqA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DD17BF802E8; Wed, 25 Jan 2023 15:12:54 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6693DF80424; Wed, 25 Jan 2023 15:12:53 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2726DF800FB for ; Wed, 25 Jan 2023 15:12:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2726DF800FB 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=cPz3UcEH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674655971; x=1706191971; h=message-id:date:mime-version:subject:from:to:cc: references:in-reply-to:content-transfer-encoding; bh=I2bmj9RQtk4j7XTXY4tF5RnFzK70rASd/GtJZmZn4kg=; b=cPz3UcEHNY3WKsUi8qtYWyrX5aaof7mTFybci0fqW0/A2oNqXq5nH3d5 ozm97hLvUDfjAI0w/1r7WxeK7ZRZ8eXnM/ptmzwwH4WWtW2sXZjclcjtb 77tAe3pBjvl9PtJvfcbzWgNT1I5bnGC2Sb4fhGLNhdsw2fejcrpNOBQce augl06q7IDNSZu/LRgYSZ4Jy+qWorujvVIKfJMdaMBEru1W3U7AssjL1V R6FchwpboqCVjUDHrn8A1FjSuwxxAFcXz1mTbsVwrR8+HE6uGO32m4/OL bpBYthEwRd5HPFqBbN4yrpYCYLbmB3DsYZoYsKVo9qcNGEJkH4ONynEC1 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10601"; a="314464684" X-IronPort-AV: E=Sophos;i="5.97,245,1669104000"; d="scan'208";a="314464684" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2023 06:12:40 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10601"; a="664465013" X-IronPort-AV: E=Sophos;i="5.97,245,1669104000"; d="scan'208";a="664465013" Received: from kpotent-mobl.ger.corp.intel.com (HELO [10.252.30.21]) ([10.252.30.21]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2023 06:12:38 -0800 Message-ID: <498a8fb8-89a8-6e36-ed54-2cdcf866d1c1@linux.intel.com> Date: Wed, 25 Jan 2023 16:12:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.6.1 Subject: Re: [PATCH] ASoC: ipc4-topology: use different channel mask for each sdw amp feedback Content-Language: en-US From: =?UTF-8?Q?P=c3=a9ter_Ujfalusi?= To: lgirdwood@gmail.com, broonie@kernel.org References: <20230125141016.29487-1-peter.ujfalusi@linux.intel.com> In-Reply-To: <20230125141016.29487-1-peter.ujfalusi@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.intel.com, kai.vehmanen@linux.intel.com, ranjani.sridharan@linux.intel.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On 25/01/2023 16:10, Peter Ujfalusi wrote: > From: Bard Liao The subject line is missing "SOF", sending v2 right away, sorry. > Currently, we use the same channel mask for aggregated speakers. > It works fine for playback because we duplicate the audio data for all > aggregated speakers. But we need to get audio data from each aggregated > speaker and combine them to the captured audio. So we need to set > non-overlapping channel mask for aggregated ALH DAIs. > > Signed-off-by: Bard Liao > Reviewed-by: Ranjani Sridharan > Reviewed-by: Pierre-Louis Bossart > Reviewed-by: Péter Ujfalusi > Signed-off-by: Peter Ujfalusi > --- > sound/soc/sof/ipc4-topology.c | 26 ++++++++++++++++++++++++-- > 1 file changed, 24 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c > index 59f4d42f9011..34586cbb461f 100644 > --- a/sound/soc/sof/ipc4-topology.c > +++ b/sound/soc/sof/ipc4-topology.c > @@ -1203,8 +1203,11 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget, > struct sof_ipc4_copier_data *alh_data; > struct sof_ipc4_copier *alh_copier; > struct snd_sof_widget *w; > + u32 ch_count = 0; > u32 ch_mask = 0; > u32 ch_map; > + u32 step; > + u32 mask; > int i; > > blob = (struct sof_ipc4_alh_configuration_blob *)ipc4_copier->copier_config; > @@ -1214,11 +1217,15 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget, > /* Get channel_mask from ch_map */ > ch_map = copier_data->base_config.audio_fmt.ch_map; > for (i = 0; ch_map; i++) { > - if ((ch_map & 0xf) != 0xf) > + if ((ch_map & 0xf) != 0xf) { > ch_mask |= BIT(i); > + ch_count++; > + } > ch_map >>= 4; > } > > + step = ch_count / blob->alh_cfg.count; > + mask = GENMASK(step - 1, 0); > /* > * Set each gtw_cfg.node_id to blob->alh_cfg.mapping[] > * for all widgets with the same stream name > @@ -1233,7 +1240,22 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget, > alh_copier = (struct sof_ipc4_copier *)dai->private; > alh_data = &alh_copier->data; > blob->alh_cfg.mapping[i].alh_id = alh_data->gtw_cfg.node_id; > - blob->alh_cfg.mapping[i].channel_mask = ch_mask; > + /* > + * Set the same channel mask for playback as the audio data is > + * duplicated for all speakers. For capture, split the channels > + * among the aggregated DAIs. For example, with 4 channels on 2 > + * aggregated DAIs, the channel_mask should be 0x3 and 0xc for the > + * two DAI's. > + * The channel masks used depend on the cpu_dais used in the > + * dailink at the machine driver level, which actually comes from > + * the tables in soc_acpi files depending on the _ADR and devID > + * registers for each codec. > + */ > + if (w->id == snd_soc_dapm_dai_in) > + blob->alh_cfg.mapping[i].channel_mask = ch_mask; > + else > + blob->alh_cfg.mapping[i].channel_mask = mask << (step * i); > + > i++; > } > if (blob->alh_cfg.count > 1) { -- Péter