From patchwork Mon Sep 25 14:06:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13397869 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 47684CE7A81 for ; Mon, 25 Sep 2023 14:17:54 +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 3E4F8DF5; Mon, 25 Sep 2023 16:17:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3E4F8DF5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695651472; bh=dW+0Xsvs1UO+t2lP9H35MKNo/FnHKTW1BoJ+80ysXyg=; 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=rNNZmfevUz+E4CvdBlGW/Xv8ZApmyggJeuRKcWuf+SWpQbE+1ojBFDsfrL0/Pda/r O2Bq4Y8/k0XC7xrZu3OHquZ1eL3ssO3HO+7NZqxCMjOvDauAAuDXOE36MtsaahY35s hwrP8gSMKLR+F2CdqwGeLwGIBecVMI3fMGhRaXS8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 83DE3F80567; Mon, 25 Sep 2023 16:16:31 +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 8A0F2F80563; Mon, 25 Sep 2023 16:16:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1B866F80551; Mon, 25 Sep 2023 16:16:26 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) (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 5B9CCF800AE for ; Mon, 25 Sep 2023 16:16:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5B9CCF800AE 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=b+YxcCpb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695651381; x=1727187381; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dW+0Xsvs1UO+t2lP9H35MKNo/FnHKTW1BoJ+80ysXyg=; b=b+YxcCpbf02WBt16ShV40xuw4x0uDVKSh1k5k9I4LAHudI3cBU8iyiqJ pu8aQ8gbuK3PjI/KkXvVZ6CjGP8kHNCTcpg5NzCiXEPSAXP+c9oPOeBKt iRi/SJWO6OvVuwRBDxLc1yJGCb1T6n2xF5k+MTl38eY7G4p0NUbeAbpU8 ZKtAtrJ2DkLQTQf7QPqtb4/H6FSjMH5tdOq6JIEqeFHXxvtnjDEgXtib7 GgjRY4UfQjrp11Diqb7zLpQmXE2xCII54wsZH063OeJMvrvU4fLeEGO13 3yo5sGhVUmZSThSrTSVLAdDRU3nEWRZwGErc3B6oEOIWgHm2qlWRgECoC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="361514120" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="361514120" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 07:07:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="783508154" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="783508154" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga001.jf.intel.com with ESMTP; 25 Sep 2023 07:07:25 -0700 From: Cezary Rojewski To: broonie@kernel.org, tiwai@suse.com Cc: alsa-devel@alsa-project.org, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH v2 1/4] ALSA: hda: Poll SDxFIFOS after programming SDxFMT Date: Mon, 25 Sep 2023 16:06:13 +0200 Message-Id: <20230925140616.26892-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230925140616.26892-1-cezary.rojewski@intel.com> References: <20230925140616.26892-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Message-ID-Hash: GYSLMAV37HBCPUEAVNGGKR4GMKOVDSLG X-Message-ID-Hash: GYSLMAV37HBCPUEAVNGGKR4GMKOVDSLG 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: Software shall read SDxFIFOS calculated by the hardware and notify if invalid value is programmed before continuing the stream preparation. Signed-off-by: Cezary Rojewski --- include/sound/hda_register.h | 2 ++ include/sound/hdaudio.h | 3 +++ sound/hda/hdac_stream.c | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/include/sound/hda_register.h b/include/sound/hda_register.h index 9c7872c0ca79..55958711d697 100644 --- a/include/sound/hda_register.h +++ b/include/sound/hda_register.h @@ -91,6 +91,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; #define AZX_REG_SD_BDLPL 0x18 #define AZX_REG_SD_BDLPU 0x1c +#define AZX_SD_FIFOSIZE_MASK GENMASK(15, 0) + /* GTS registers */ #define AZX_REG_LLCH 0x14 diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index 32c59053b48e..41d725babf53 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -624,6 +624,9 @@ int snd_hdac_stream_set_lpib(struct hdac_stream *azx_dev, u32 value); #define snd_hdac_stream_readb_poll(dev, reg, val, cond, delay_us, timeout_us) \ read_poll_timeout_atomic(snd_hdac_reg_readb, val, cond, delay_us, timeout_us, \ false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg) +#define snd_hdac_stream_readw_poll(dev, reg, val, cond, delay_us, timeout_us) \ + read_poll_timeout_atomic(snd_hdac_reg_readw, val, cond, delay_us, timeout_us, \ + false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg) #define snd_hdac_stream_readl_poll(dev, reg, val, cond, delay_us, timeout_us) \ read_poll_timeout_atomic(snd_hdac_reg_readl, val, cond, delay_us, timeout_us, \ false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg) diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c index 2633a4bb1d85..5382894bebab 100644 --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c @@ -258,6 +258,8 @@ int snd_hdac_stream_setup(struct hdac_stream *azx_dev) struct hdac_bus *bus = azx_dev->bus; struct snd_pcm_runtime *runtime; unsigned int val; + u16 reg; + int ret; if (azx_dev->substream) runtime = azx_dev->substream->runtime; @@ -300,6 +302,12 @@ int snd_hdac_stream_setup(struct hdac_stream *azx_dev) /* set the interrupt enable bits in the descriptor control register */ snd_hdac_stream_updatel(azx_dev, SD_CTL, 0, SD_INT_MASK); + /* Once SDxFMT is set, the controller programs SDxFIFOS to non-zero value. */ + ret = snd_hdac_stream_readw_poll(azx_dev, SD_FIFOSIZE, reg, reg & AZX_SD_FIFOSIZE_MASK, + 3, 300); + if (ret) + dev_dbg(bus->dev, "polling SD_FIFOSIZE 0x%04x failed: %d\n", + AZX_REG_SD_FIFOSIZE, ret); azx_dev->fifo_size = snd_hdac_stream_readw(azx_dev, SD_FIFOSIZE) + 1; /* when LPIB delay correction gives a small negative value, From patchwork Mon Sep 25 14:06:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13397870 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 147E2CE7A96 for ; Mon, 25 Sep 2023 14:18:14 +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 28CF3E0F; Mon, 25 Sep 2023 16:17:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 28CF3E0F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695651492; bh=XtW1noqdh2AkhKEnR3mNGRm/gZQlpuYljnTPmEXTclQ=; 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=k1rKHFvDPhyTPMfB9aoCm65RSNPyfk64FYsT3gmOIIdm1ve42BZIeSEYa3etHXQsr RtpP23i4SBHAfq+jqVqGcsTxbM9LDZ7jZMln0R1PZE6zkY7u0lUY5qATgur/IxFtAc DGwgjDbna5P+dYgr/tH87+me4tXJ+ktxEHDYMn2M= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 77AA2F8057F; Mon, 25 Sep 2023 16:16:35 +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 E27EAF8057A; Mon, 25 Sep 2023 16:16:34 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1B4AFF80551; Mon, 25 Sep 2023 16:16:30 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) (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 95FB6F8016A for ; Mon, 25 Sep 2023 16:16:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 95FB6F8016A 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=BLmDJpfn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695651381; x=1727187381; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XtW1noqdh2AkhKEnR3mNGRm/gZQlpuYljnTPmEXTclQ=; b=BLmDJpfnYTBFG3tLBvoAfQIXXJrzUQGCNquWy85JqEv9DoZTfyq4JjGX TzQTxdlur2B1TXlJkqB4UiB+Xp3xto2ewyEWFZgv+Z9jdrtXL/8FGup1S LMKREYI7XklXP3ogGBHJJNdhmGhmlMZlIJjWyt69hq3ltv3dVUxzLukoE 62ajPN+lt+qZNBELGitWdu0hV3jXozSBnRTXrjBrYfkOwJGryBRFj8Ah0 d18tilyV4xuN8FVETVCX0XqUfi3/Rfj+cUsUu1Ks/SmKnUdA20r8B6BfP snu5fXsnDykYSWk+vzg1v3HpunX36OqCSkTuTuxF4cXBCIS/rK0HSo9PU A==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="361514128" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="361514128" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 07:07:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="783508167" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="783508167" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga001.jf.intel.com with ESMTP; 25 Sep 2023 07:07:28 -0700 From: Cezary Rojewski To: broonie@kernel.org, tiwai@suse.com Cc: alsa-devel@alsa-project.org, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH v2 2/4] ALSA: hda: Introduce HOST stream setup mechanism Date: Mon, 25 Sep 2023 16:06:14 +0200 Message-Id: <20230925140616.26892-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230925140616.26892-1-cezary.rojewski@intel.com> References: <20230925140616.26892-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Message-ID-Hash: GHH742NHZMQEV66SIZVNBBJGSLFCO77Y X-Message-ID-Hash: GHH742NHZMQEV66SIZVNBBJGSLFCO77Y 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: HDAudio stream setup procedure differs between revisions of the controller device. Currently the differences are handled directly within AudioDSP platform drivers with if-statements. Implement a more generic approach and expose a function that a platform driver may use to ensure the correct procedure is followed each time. Signed-off-by: Cezary Rojewski --- include/sound/hdaudio_ext.h | 3 +++ sound/hda/ext/hdac_ext_stream.c | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h index 511211f4a2b6..d32959cb71d2 100644 --- a/include/sound/hdaudio_ext.h +++ b/include/sound/hdaudio_ext.h @@ -60,6 +60,8 @@ struct hdac_ext_stream { bool link_locked:1; bool link_prepared; + int (*host_setup)(struct hdac_stream *); + struct snd_pcm_substream *link_substream; }; @@ -86,6 +88,7 @@ void snd_hdac_ext_stream_start(struct hdac_ext_stream *hext_stream); void snd_hdac_ext_stream_clear(struct hdac_ext_stream *hext_stream); void snd_hdac_ext_stream_reset(struct hdac_ext_stream *hext_stream); int snd_hdac_ext_stream_setup(struct hdac_ext_stream *hext_stream, int fmt); +int snd_hdac_ext_host_stream_setup(struct hdac_ext_stream *hext_stream); struct hdac_ext_link { struct hdac_bus *bus; diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c index 11b7119cc47e..f12fe348b9fc 100644 --- a/sound/hda/ext/hdac_ext_stream.c +++ b/sound/hda/ext/hdac_ext_stream.c @@ -10,12 +10,45 @@ */ #include +#include +#include #include #include #include #include #include +/** + * snd_hdac_ext_host_stream_setup - Setup a HOST stream. + * @hext_stream - HDAudio stream to set up. + * + * Return: Zero on success or negative error code. + */ +int snd_hdac_ext_host_stream_setup(struct hdac_ext_stream *hext_stream) +{ + return hext_stream->host_setup(hdac_stream(hext_stream)); +} +EXPORT_SYMBOL_GPL(snd_hdac_ext_host_stream_setup); + +/** + * snd_hdac_apl_host_stream_setup - Setup a HOST stream following procedure + * recommended for ApolloLake devices. + * @hstream - HDAudio stream to set up. + * + * Return: Zero on success or negative error code. + */ +static int snd_hdac_apl_host_stream_setup(struct hdac_stream *hstream) +{ + struct hdac_ext_stream *hext_stream = stream_to_hdac_ext_stream(hstream); + int ret; + + snd_hdac_ext_stream_decouple(hstream->bus, hext_stream, false); + ret = snd_hdac_stream_setup(hstream); + snd_hdac_ext_stream_decouple(hstream->bus, hext_stream, true); + + return ret; +} + /** * snd_hdac_ext_stream_init - initialize each stream (aka device) * @bus: HD-audio core bus @@ -55,9 +88,16 @@ static void snd_hdac_ext_stream_init(struct hdac_bus *bus, int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx, int num_stream, int dir) { + struct pci_dev *pci = to_pci_dev(bus->dev); + int (*setup_op)(struct hdac_stream *); int stream_tag = 0; int i, tag, idx = start_idx; + if (pci->device == PCI_DEVICE_ID_INTEL_HDA_APL) + setup_op = snd_hdac_apl_host_stream_setup; + else + setup_op = snd_hdac_stream_setup; + for (i = 0; i < num_stream; i++) { struct hdac_ext_stream *hext_stream = kzalloc(sizeof(*hext_stream), GFP_KERNEL); @@ -66,6 +106,7 @@ int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx, tag = ++stream_tag; snd_hdac_ext_stream_init(bus, hext_stream, idx, dir, tag); idx++; + hext_stream->host_setup = setup_op; } return 0; From patchwork Mon Sep 25 14:06:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13397871 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 AE3D7CE7A94 for ; Mon, 25 Sep 2023 14:18:25 +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 774DAE7E; Mon, 25 Sep 2023 16:17:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 774DAE7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695651503; bh=NTFksEWG/dnCXLPogyuOcCE5XRJLKv/9wrG9/pbpt0A=; 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=a46tMyVZD9wQg3cWIHu1AU6xuVuA0j4nczVuhBWpEzacgHJVvV+xOeog/J/QMAPQ4 ILCszTsAKrz/ymGiJEDhfNNSfCxLwJa0ZZj5f5H/p1kyiKRCTgjILrTpDEbb/iTlYg E5xF7tjNAMvo0b+rb/2IHhC12yvW2T/dJZEjIsBs= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 49219F805A8; Mon, 25 Sep 2023 16:16:56 +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 B631AF80587; Mon, 25 Sep 2023 16:16:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 264D1F8059F; Mon, 25 Sep 2023 16:16:52 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) (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 9FE9CF80290 for ; Mon, 25 Sep 2023 16:16:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9FE9CF80290 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=a2QUqfyT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695651382; x=1727187382; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NTFksEWG/dnCXLPogyuOcCE5XRJLKv/9wrG9/pbpt0A=; b=a2QUqfyTLjxFd///uUh42WLHfql4KbZyJWgSxIp87LJ9mjUaLxsFn8o0 3vEzBHkvJ5zz8ffujdgYKLkShEGsHjxEN8gcjVCGXlMufa/tlhj1YetJ8 2l3vkIKN7tX9ic2e9eXdzezml4oy6HIp87B+hiInkJQvZ0MmJDupRsD0y iYJ+K1lMoY3mj3eTovK1xM0YAu/RAJBS6x9J4Tzj1JPLWXJIY/WhHQVqh fd2iwMcaTQuucMtDiw/boqCtyfLHl1yR7jXQVqEGnZDh8MqCTijE83dH2 amSz0BP2hdUX3v5QIYb3wd7mb+BAC+B19dglHNBw7wADv74DVhYD9IgzV A==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="361514150" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="361514150" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 07:07:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="783508181" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="783508181" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga001.jf.intel.com with ESMTP; 25 Sep 2023 07:07:30 -0700 From: Cezary Rojewski To: broonie@kernel.org, tiwai@suse.com Cc: alsa-devel@alsa-project.org, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH v2 3/4] ASoC: Intel: avs: Use helper to setup HOST stream Date: Mon, 25 Sep 2023 16:06:15 +0200 Message-Id: <20230925140616.26892-4-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230925140616.26892-1-cezary.rojewski@intel.com> References: <20230925140616.26892-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Message-ID-Hash: ZCJDWBYETKXP247GSAFIWUP6IU7IV6S7 X-Message-ID-Hash: ZCJDWBYETKXP247GSAFIWUP6IU7IV6S7 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: snd_hdac_ext_host_stream_setup() abstracts the procedure details away. Simplify the code by using it. Acked-by: Mark Brown Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index 8565a530706d..e628fdfdc018 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -625,7 +625,7 @@ static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_so if (ret < 0) return ret; - ret = snd_hdac_stream_setup(hdac_stream(host_stream)); + ret = snd_hdac_ext_host_stream_setup(host_stream); if (ret < 0) return ret; From patchwork Mon Sep 25 14:06:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13397872 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 62ED7CE7A94 for ; Mon, 25 Sep 2023 14:18:53 +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 54AEEE74; Mon, 25 Sep 2023 16:18:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 54AEEE74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695651531; bh=CulHCpIqq+8SqFZI6n0jd1wWfF3PVrQrXjcgxK1RioY=; 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=Po3Q4cjNJLBlSVxs8VDrJ0Uisfv0feUqvgMxROVL6Wn3qilOBT1+GZuNjDtZRhhdT pTR0XkZQX3luH9CvnS/k7rpFLOEdSAksp/exASQtWjbH5YCD3bZT68Nl53Zo/hV2Q7 1VbMMIzAPmzGsmmmEiLJOrl6VFzK64pYlGU5rIxc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id AA6B2F805AD; Mon, 25 Sep 2023 16:16:57 +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 29A9FF805AE; Mon, 25 Sep 2023 16:16:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BE2C4F80587; Mon, 25 Sep 2023 16:16:53 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) (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 659CDF8047D for ; Mon, 25 Sep 2023 16:16:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 659CDF8047D 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=VlMEGa4S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695651383; x=1727187383; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CulHCpIqq+8SqFZI6n0jd1wWfF3PVrQrXjcgxK1RioY=; b=VlMEGa4Svlne6t5PiF91Y6SEzFQtfcBgKAULTGkUsvHN0RIrn51Thi95 qlM9H3ZAFqW/BVslzlkhV8WuzK5qGAvkeAhFqJo6/lgttKylpDkzzhqak FTAjfex1wNLxkfQNUmqnaatdoK/v7BE0DP7CmA3O6FsBKafcTstML9VYY EYH5m/Gkcoh1X5H3W/3/K6GtGORYZuedadn7Zp2EDQcm7IZvFRyW8rrYQ cZ18B9Ymh8ZYmjiQ11RbBZF1KFR6C3NWaPGUEmgVagLUlI9xvsWG+c3XH NAgKSENv4maEK6qwYyaTyWj9lGDMNHN4UcYtncz5XHL9qVBtb1jZzGs5v A==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="361514156" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="361514156" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 07:07:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="783508185" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="783508185" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga001.jf.intel.com with ESMTP; 25 Sep 2023 07:07:33 -0700 From: Cezary Rojewski To: broonie@kernel.org, tiwai@suse.com Cc: alsa-devel@alsa-project.org, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH v2 4/4] ASoC: Intel: Skylake: Use helper to setup HOST stream Date: Mon, 25 Sep 2023 16:06:16 +0200 Message-Id: <20230925140616.26892-5-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230925140616.26892-1-cezary.rojewski@intel.com> References: <20230925140616.26892-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Message-ID-Hash: F6CBEC7ARZDJVKAFDVVER7XUCWPD6325 X-Message-ID-Hash: F6CBEC7ARZDJVKAFDVVER7XUCWPD6325 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: snd_hdac_ext_host_stream_setup() abstracts the procedure details away. Simplify the code by using it. Acked-by: Mark Brown Signed-off-by: Cezary Rojewski --- sound/soc/intel/skylake/skl-pcm.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index ac3dc8c63c26..7502b2e70e46 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -124,7 +124,6 @@ static void skl_set_suspend_active(struct snd_pcm_substream *substream, int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params) { struct hdac_bus *bus = dev_get_drvdata(dev); - struct skl_dev *skl = bus_to_skl(bus); unsigned int format_val; struct hdac_stream *hstream; struct hdac_ext_stream *stream; @@ -149,18 +148,7 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params) if (err < 0) return err; - /* - * The recommended SDxFMT programming sequence for BXT - * platforms is to couple the stream before writing the format - */ - if (HDA_CONTROLLER_IS_APL(skl->pci)) { - snd_hdac_ext_stream_decouple(bus, stream, false); - err = snd_hdac_stream_setup(hdac_stream(stream)); - snd_hdac_ext_stream_decouple(bus, stream, true); - } else { - err = snd_hdac_stream_setup(hdac_stream(stream)); - } - + err = snd_hdac_ext_host_stream_setup(stream); if (err < 0) return err;