From patchwork Fri Aug 11 16:48:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13351180 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 0964FEB64DD for ; Fri, 11 Aug 2023 16:53:02 +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 26C49DED; Fri, 11 Aug 2023 18:52:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 26C49DED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1691772780; bh=jTcAlSlSf24hI3JZzwjXI0jOXBcgvF4d6ohqGikpHhg=; 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=bX/Cu6Tkujc3uHwsiEav7Qa3mEyn1KuAO/0u0rNR6Ws653yqOXVbpQsnogxVfKhtv 1HNBYJwWKzKhvulm3gOsjr187TBoKhHHkBDoGH1mWZ78Iuk8WnkoQvDRrgSR1WON3y S84XanPQ8QGqiULdT7knkr7xD/hPBblBHz4rkqM8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7CFF3F805EA; Fri, 11 Aug 2023 18:50:06 +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 E3F3EF805E8; Fri, 11 Aug 2023 18:50:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 31D55F805BE; Fri, 11 Aug 2023 18:49:51 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) (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 96097F80588 for ; Fri, 11 Aug 2023 18:49:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 96097F80588 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=MhIKuvwv DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691772588; x=1723308588; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jTcAlSlSf24hI3JZzwjXI0jOXBcgvF4d6ohqGikpHhg=; b=MhIKuvwvS5z7AZBUhqIOvI56VK44OYMJBMNwh2MklY6O1fZB5j5pzcq1 Ak1mH/yp8PPRQlLItz/H7CdRhkpw5I2HkB+Cl82+Ls/qbPe3RB3Feam6J P2hmDxHTd/VH2wJ7SsegLL4AWGaHCz3ciQEKWqy21+RJLnuEfUe531/3Q vQiQ8ypnanpi+eNknCeOXJvWND9TUwosVblUGX7Yg8YsR7cUZn4G/uou5 M2kqyMxiOfI0L9gyMVIInAQ0jCDg+LKN9baNjAEVL/bOonTaAFrtRmftj j18WzVDYLPzxN7eXsa0SFnfcOYvx4PMbJFnQv1R2POHLnR9+0eU9M9Yxs A==; X-IronPort-AV: E=McAfee;i="6600,9927,10799"; a="371725137" X-IronPort-AV: E=Sophos;i="6.01,166,1684825200"; d="scan'208";a="371725137" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2023 09:49:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10799"; a="846842833" X-IronPort-AV: E=Sophos;i="6.01,166,1684825200"; d="scan'208";a="846842833" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga002.fm.intel.com with ESMTP; 11 Aug 2023 09:49:35 -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: [RFC PATCH 12/17] ASoC: Intel Skylake: Switch to new stream-format interface Date: Fri, 11 Aug 2023 18:48:48 +0200 Message-Id: <20230811164853.1797547-13-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230811164853.1797547-1-cezary.rojewski@intel.com> References: <20230811164853.1797547-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Message-ID-Hash: PIZWYTPSRSNDO7PAXOBSHF47PREWRSEW X-Message-ID-Hash: PIZWYTPSRSNDO7PAXOBSHF47PREWRSEW 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 --- sound/soc/intel/skylake/skl-pcm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index a4209d88b0c6..b87f046f1cad 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -127,6 +127,7 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params) unsigned int format_val; struct hdac_stream *hstream; struct hdac_ext_stream *stream; + unsigned int bps; int err; hstream = snd_hdac_get_stream(bus, params->stream, @@ -137,8 +138,8 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params) stream = stream_to_hdac_ext_stream(hstream); snd_hdac_ext_stream_decouple(bus, stream, true); - format_val = snd_hdac_calc_stream_format(params->s_freq, - params->ch, params->format, params->host_bps, 0); + bps = snd_hdac_stream_format_bps(params->format, SNDRV_PCM_SUBFORMAT_STD, params->host_bps); + format_val = snd_hdac_stream_format(params->ch, bps, params->s_freq); dev_dbg(dev, "format_val=%d, rate=%d, ch=%d, format=%d\n", format_val, params->s_freq, params->ch, params->format); @@ -176,6 +177,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params) struct hdac_ext_stream *stream; struct hdac_ext_link *link; unsigned char stream_tag; + unsigned int bps; hstream = snd_hdac_get_stream(bus, params->stream, params->link_dma_id + 1); @@ -184,8 +186,9 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params) stream = stream_to_hdac_ext_stream(hstream); snd_hdac_ext_stream_decouple(bus, stream, true); - format_val = snd_hdac_calc_stream_format(params->s_freq, params->ch, - params->format, params->link_bps, 0); + + bps = snd_hdac_stream_format_bps(params->format, SNDRV_PCM_SUBFORMAT_STD, params->link_bps); + format_val = snd_hdac_stream_format(params->ch, bps, params->s_freq); dev_dbg(dev, "format_val=%d, rate=%d, ch=%d, format=%d\n", format_val, params->s_freq, params->ch, params->format);