From patchwork Mon Sep 18 13:39:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 724177 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 293BFCD37B0 for ; Mon, 18 Sep 2023 13:46:18 +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 72C3BDF8; Mon, 18 Sep 2023 15:45:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 72C3BDF8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695044776; bh=pTxxkeKYHG7wfzJMN3wUaWoQd0+lgZagshy0m/f8fmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XZhbLHQ+xSgmk1RBJxEC7B955Paj7zmE760ylcElwTZO1sjFPvXoZXFAGmti2ue/E Vx2aG9ETj9h/3zVOPhLq9kfFpQW1iMqEsO8gTSkFtGaMyCkN+NV3GgW79AS1cNZTsz syIRFrw7fJ9PACxxOYSxqwAfMzlhhFUsu7AmAw0k= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 68C4FF80655; Mon, 18 Sep 2023 15:41:13 +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 EC69AF80641; Mon, 18 Sep 2023 15:41:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 27D35F805EE; Mon, 18 Sep 2023 15:40:50 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) (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 0EF9AF805D2 for ; Mon, 18 Sep 2023 15:40:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0EF9AF805D2 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=Mk5FZwc9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695044443; x=1726580443; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pTxxkeKYHG7wfzJMN3wUaWoQd0+lgZagshy0m/f8fmg=; b=Mk5FZwc9MernYKqWBEhf0egs9ZASu9j7GEsr8QONmEoMhgaUh+CoH6FD Z07LYLDu/f4VZanXkMUZOgw/XzUpTOJu8j5b8lj5/gmGp7BqqpsHJDSlB reALa9zaGql19Sh9CxrdxMzBdeSBjquZXF0nUxEimM4yd3Wp8qDlW+ESp p231WJKgaN0iXrQ5Uk+0DZtYm97p7mJ5kEtTRalzZdQiKY5yXg7nFBKZY Ap5IVbD8diZ8yC7MbFrmOLOZoOGEd0LbPNUMx0pynUrvuPqSE03DCEbXY /bbYOEW6SPkWxnUhVngOOx0KkBFGGHQitjsMCGf6mm//EZ7f/5O7khVDY Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="466003895" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="466003895" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 06:40:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="745826113" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="745826113" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga002.jf.intel.com with ESMTP; 18 Sep 2023 06:40:39 -0700 From: Cezary Rojewski To: broonie@kernel.org, tiwai@suse.com, perex@perex.cz Cc: alsa-devel@alsa-project.org, amadeuszx.slawinski@linux.intel.com, pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH v2 17/17] ASoC: Intel: avs: Unhardcode HDAudio BE DAI drivers description Date: Mon, 18 Sep 2023 15:39:40 +0200 Message-Id: <20230918133940.3676091-18-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230918133940.3676091-1-cezary.rojewski@intel.com> References: <20230918133940.3676091-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Message-ID-Hash: TNBLI5ZSUHJMZYSXVBUR2K5RAHQGFADO X-Message-ID-Hash: TNBLI5ZSUHJMZYSXVBUR2K5RAHQGFADO X-MailFrom: cezary.rojewski@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: To not expose more than in fact is supported by the codec, update CPU DAI initialization procedure to rely on codec capabilities instead of hardcoding them. This includes subformat which is currently ignored. As capabilities for HDMI streams are initialized on PCM open, leave it as is for now. Acked-by: Mark Brown Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/pcm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index 08855d4e0a37..cca1a5b7764a 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -17,6 +17,7 @@ #include "avs.h" #include "path.h" #include "topology.h" +#include "../../codecs/hda.h" struct avs_dma_data { struct avs_tplg_path_template *template; @@ -1404,6 +1405,15 @@ static int avs_component_hda_probe(struct snd_soc_component *component) ret = -ENOMEM; goto exit; } + + if (!hda_codec_is_display(codec)) { + dais[i].playback.formats = pcm->stream[0].formats; + dais[i].playback.subformats = pcm->stream[0].subformats; + dais[i].playback.rates = pcm->stream[0].rates; + dais[i].playback.channels_min = pcm->stream[0].channels_min; + dais[i].playback.channels_max = pcm->stream[0].channels_max; + dais[i].playback.sig_bits = pcm->stream[0].maxbps; + } } if (pcm->stream[1].substreams) { @@ -1414,6 +1424,15 @@ static int avs_component_hda_probe(struct snd_soc_component *component) ret = -ENOMEM; goto exit; } + + if (!hda_codec_is_display(codec)) { + dais[i].capture.formats = pcm->stream[1].formats; + dais[i].capture.subformats = pcm->stream[1].subformats; + dais[i].capture.rates = pcm->stream[1].rates; + dais[i].capture.channels_min = pcm->stream[1].channels_min; + dais[i].capture.channels_max = pcm->stream[1].channels_max; + dais[i].capture.sig_bits = pcm->stream[1].maxbps; + } } dai = snd_soc_register_dai(component, &dais[i], false);