From patchwork Wed Aug 23 08:05:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13361777 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 6C31BEE49AE for ; Wed, 23 Aug 2023 08:12:24 +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 4F0FD84D; Wed, 23 Aug 2023 10:11:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4F0FD84D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692778342; bh=z1C/1ra+Jw69lBFjbEpEPLpWSIEF15eimBoH/bFoe6M=; 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=XmPQzaj3mMafAje16zQJJvYLalGGe80wv3ruI2Y+gsz0IfHW1LvkJXsFIwnqgop62 6DN8qcpG4lc9ghzeBVvR++c4iPsxFmXcyYJgzKiuX9WAXdgnf+81qlwOqQ7zWkLXKv Zjeeq7pwFxSOOjtz795B2oWIpenixqrCnAeuCvp4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id BBC65F80607; Wed, 23 Aug 2023 10:07:54 +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 132BAF80610; Wed, 23 Aug 2023 10:07:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 539E3F8023B; Wed, 23 Aug 2023 10:06:49 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (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 CFDF5F804F3 for ; Wed, 23 Aug 2023 10:06:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CFDF5F804F3 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=kkjfOqei DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692777995; x=1724313995; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z1C/1ra+Jw69lBFjbEpEPLpWSIEF15eimBoH/bFoe6M=; b=kkjfOqeimcmQhjXUH0lWM6TLoddVPA7V1kKmYuN4pNzWdiBYnAayjxf/ KlT9BZIJ9Pw1kgJ4AIBSGgLcdm1Viouc5dxGgojEsti8XI7EYaNcbwgpN KjhJR6Gp2ylpSrrQ8Fd//NXrbR0akHjFrr0LmCWGJaUUjME2MngLRm4un 3K5pNdAMzYROBjh4JKFqgg2BRPgdb7QVUm9uypYddvPhsANVeN6Grl89u lUUDmUERDPSQJCHTeDqLzIa9tk8jgGW8OKUIsufcWTnQWF4WgrOjheQLf cj4eTApzEyvQd533S1FbrdxqLw+S9cZ5rJsLxw53e277RWfm03GkZoKm3 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10810"; a="372988126" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="372988126" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2023 01:06:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10810"; a="766042768" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="766042768" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga008.jf.intel.com with ESMTP; 23 Aug 2023 01:06:31 -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 13/17] ASoC: SOF: Intel: Switch to new stream-format interface Date: Wed, 23 Aug 2023 10:05:42 +0200 Message-Id: <20230823080546.2224713-14-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230823080546.2224713-1-cezary.rojewski@intel.com> References: <20230823080546.2224713-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Message-ID-Hash: EJPEXZFP7TNE2DLOFV7QWYRJQ7SAW564 X-Message-ID-Hash: EJPEXZFP7TNE2DLOFV7QWYRJQ7SAW564 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 provide option for selecting different bit-per-sample than just the maximum one, use the new format calculation mechanism. Signed-off-by: Cezary Rojewski Acked-by: Mark Brown --- sound/soc/sof/intel/hda-dai-ops.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sound/soc/sof/intel/hda-dai-ops.c b/sound/soc/sof/intel/hda-dai-ops.c index 494ced2b746e..18e06712372f 100644 --- a/sound/soc/sof/intel/hda-dai-ops.c +++ b/sound/soc/sof/intel/hda-dai-ops.c @@ -213,9 +213,10 @@ static unsigned int hda_calc_stream_format(struct snd_sof_dev *sdev, link_bps = codec_dai->driver->playback.sig_bits; else link_bps = codec_dai->driver->capture.sig_bits; + link_bps = snd_hdac_stream_format_bps(params_format(params), SNDRV_PCM_SUBFORMAT_STD, + link_bps); - format_val = snd_hdac_calc_stream_format(params_rate(params), params_channels(params), - params_format(params), link_bps, 0); + format_val = snd_hdac_stream_format(params_channels(params), link_bps, params_rate(params)); dev_dbg(sdev->dev, "format_val=%#x, rate=%d, ch=%d, format=%d\n", format_val, params_rate(params), params_channels(params), params_format(params)); @@ -238,11 +239,11 @@ static unsigned int generic_calc_stream_format(struct snd_sof_dev *sdev, struct snd_pcm_hw_params *params) { unsigned int format_val; + unsigned int bps; - format_val = snd_hdac_calc_stream_format(params_rate(params), params_channels(params), - params_format(params), - params_physical_width(params), - 0); + bps = snd_hdac_stream_format_bps(params_format(params), SNDRV_PCM_SUBFORMAT_STD, + params_physical_width(params)); + format_val = snd_hdac_stream_format(params_channels(params), bps, params_rate(params)); dev_dbg(sdev->dev, "format_val=%#x, rate=%d, ch=%d, format=%d\n", format_val, params_rate(params), params_channels(params), params_format(params)); @@ -258,6 +259,7 @@ static unsigned int dmic_calc_stream_format(struct snd_sof_dev *sdev, snd_pcm_format_t format; unsigned int channels; unsigned int width; + unsigned int bps; channels = params_channels(params); format = params_format(params); @@ -269,10 +271,8 @@ static unsigned int dmic_calc_stream_format(struct snd_sof_dev *sdev, width = 32; } - format_val = snd_hdac_calc_stream_format(params_rate(params), channels, - format, - width, - 0); + bps = snd_hdac_stream_format_bps(format, SNDRV_PCM_SUBFORMAT_STD, width); + format_val = snd_hdac_stream_format(channels, bps, params_rate(params)); dev_dbg(sdev->dev, "format_val=%#x, rate=%d, ch=%d, format=%d\n", format_val, params_rate(params), channels, format);