From patchwork Thu Nov 16 11:22:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13457791 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF819C54FB9 for ; Thu, 16 Nov 2023 11:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235701AbjKPLWK (ORCPT ); Thu, 16 Nov 2023 06:22:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235702AbjKPLVy (ORCPT ); Thu, 16 Nov 2023 06:21:54 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7773ED53 for ; Thu, 16 Nov 2023 03:21:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700133710; x=1731669710; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RJ14kVkEiFbIkVjmIZfdktRWp32SxJx0oq9Vu+Yei0E=; b=NO2NZXwJzGZE6bVKscWjNUbjxorbur6mgvt1WOuA8YzdhWcW2nViFeH9 JTb6YZ118X+M3EwT/nQmbFSsFZZvm/7pD/mt4TMQkPGa/3VGzyS7Gw+Tn p7EFYrh9OOzkMC50ANir9+/XzigtQ1gfG3zLoLYrLHueM7PA10FuuADUB 95zFLZqZxMacY2U9119m4KlgpFluu8buC94uKeljYYlWoXLjU/Q0HZJJ8 aXN8ywRI8Y+xVDsnGTJnHSkX9JCgj81DW3wxFm1v2F2t8OULlGsitceH5 Za6VWQ0k9i3McCn/xHhKswRelbuLZjxnNO4YUMuVRWL1DzeYTMAGtRHlN Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="457561994" X-IronPort-AV: E=Sophos;i="6.03,308,1694761200"; d="scan'208";a="457561994" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2023 03:21:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,308,1694761200"; d="scan'208";a="6698227" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmviesa002.fm.intel.com with ESMTP; 16 Nov 2023 03:21:48 -0800 From: Cezary Rojewski To: broonie@kernel.org, tiwai@suse.com, perex@perex.cz Cc: alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, amadeuszx.slawinski@linux.intel.com, pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH v4 05/16] ALSA: hda: Switch to new stream-format interface Date: Thu, 16 Nov 2023 12:22:44 +0100 Message-Id: <20231116112255.1584795-6-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231116112255.1584795-1-cezary.rojewski@intel.com> References: <20231116112255.1584795-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sound@vger.kernel.org To provide option for selecting different bit-per-sample than just the maximum one, use the new format calculation mechanism. Acked-by: Mark Brown Signed-off-by: Cezary Rojewski --- sound/pci/hda/hda_controller.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index c42e9ffff9db..0ec3559cc834 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -151,7 +151,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) struct azx_dev *azx_dev = get_azx_dev(substream); struct hda_pcm_stream *hinfo = to_hda_pcm_stream(substream); struct snd_pcm_runtime *runtime = substream->runtime; - unsigned int format_val, stream_tag; + unsigned int format_val, stream_tag, bps; int err; struct hda_spdif_out *spdif = snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid); @@ -165,11 +165,9 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) } snd_hdac_stream_reset(azx_stream(azx_dev)); - format_val = snd_hdac_calc_stream_format(runtime->rate, - runtime->channels, - runtime->format, - hinfo->maxbps, - ctls); + bps = snd_hdac_stream_format_bps(runtime->format, SNDRV_PCM_SUBFORMAT_STD, hinfo->maxbps); + + format_val = snd_hdac_spdif_stream_format(runtime->channels, bps, runtime->rate, ctls); if (!format_val) { dev_err(chip->card->dev, "invalid format_val, rate=%d, ch=%d, format=%d\n",