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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B67DDC197A0 for ; Thu, 16 Nov 2023 11:22:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbjKPLWU (ORCPT ); Thu, 16 Nov 2023 06:22:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235691AbjKPLWB (ORCPT ); Thu, 16 Nov 2023 06:22:01 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CA51B2 for ; Thu, 16 Nov 2023 03:21:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700133717; x=1731669717; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rkNK1lKSl8mrVguYpTBfwATzZJymRowUkjzleoBO+hM=; b=ewJKlCr/6p1IwK6NGYM9DmhnPUA1SN+u+dxiJ2Uvj+QQCzsushke82gw oVmcysk4ZJVbajtfsUmnR32fTv+H/pFCPyatfzBC7MJdAvPD8dvL57+Ry 8Xgz9MFqIbM6mpG1SEWtGNP3SAPMw+8RyQ7AbE6DevPAZ5EH3kF9Cgs/l L19lfmDYuJcwKRNig2q3xelHNEqifbiMpuwf367jLPfS5LE/7iv57s2HI +1FgufoPOtzy5iTKI0ldKL0WiZ9+nhpZIrIpa6FeVbMwEzkMIPllMSTCg jZSV0T1zMujhLBtZQev4wSV1WSCBeSxWbfRBKqrLpE7azmNb/mVFuPGJk w==; X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="457562016" X-IronPort-AV: E=Sophos;i="6.03,308,1694761200"; d="scan'208";a="457562016" 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:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,308,1694761200"; d="scan'208";a="6698237" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmviesa002.fm.intel.com with ESMTP; 16 Nov 2023 03:21:55 -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 08/16] ASoC: codecs: hda: Switch to new stream-format interface Date: Thu, 16 Nov 2023 12:22:47 +0100 Message-Id: <20231116112255.1584795-9-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 Content-Transfer-Encoding: 8bit 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. While at it, complete PCM stream initialization with subformat options. Acked-by: Mark Brown Signed-off-by: Cezary Rojewski --- sound/soc/codecs/hda-dai.c | 6 ++++-- sound/soc/codecs/hda.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/hda-dai.c b/sound/soc/codecs/hda-dai.c index 5371ff086261..20b070c66c6f 100644 --- a/sound/soc/codecs/hda-dai.c +++ b/sound/soc/codecs/hda-dai.c @@ -76,13 +76,15 @@ static int hda_codec_dai_prepare(struct snd_pcm_substream *substream, struct snd struct hdac_stream *stream; struct hda_codec *codec; unsigned int format; + unsigned int bps; int ret; codec = dev_to_hda_codec(dai->dev); stream = substream->runtime->private_data; stream_info = snd_soc_dai_get_dma_data(dai, substream); - format = snd_hdac_calc_stream_format(runtime->rate, runtime->channels, runtime->format, - runtime->sample_bits, 0); + + bps = snd_hdac_stream_format_bps(runtime->format, runtime->subformat, stream_info->maxbps); + format = snd_hdac_stream_format(runtime->channels, bps, runtime->rate); ret = snd_hda_codec_prepare(codec, stream_info, stream->stream_tag, format, substream); if (ret < 0) { diff --git a/sound/soc/codecs/hda.c b/sound/soc/codecs/hda.c index d57b043d6bfe..d2117e36ddd1 100644 --- a/sound/soc/codecs/hda.c +++ b/sound/soc/codecs/hda.c @@ -52,6 +52,7 @@ static int hda_codec_create_dais(struct hda_codec *codec, int pcm_count, stream->channels_max = pcm->stream[dir].channels_max; stream->rates = pcm->stream[dir].rates; stream->formats = pcm->stream[dir].formats; + stream->subformats = pcm->stream[dir].subformats; stream->sig_bits = pcm->stream[dir].maxbps; capture_dais: @@ -71,6 +72,7 @@ static int hda_codec_create_dais(struct hda_codec *codec, int pcm_count, stream->channels_max = pcm->stream[dir].channels_max; stream->rates = pcm->stream[dir].rates; stream->formats = pcm->stream[dir].formats; + stream->subformats = pcm->stream[dir].subformats; stream->sig_bits = pcm->stream[dir].maxbps; } -- 2.25.1