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 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 4C205C4332F for ; Fri, 2 Dec 2022 08:52:50 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 79B5F17B6; Fri, 2 Dec 2022 09:51:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 79B5F17B6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669971168; bh=sDTLMv9WgCRqmr8XRSEA+D4H4FQnD+mNw6QfSvbXIrI=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NPE5wyNZa4XqjiTu0Z7NDnszdPRQtEwBNH1XpnWXoNpmKXm3SclWIxA/TR88nH9l8 8nPuPfMAk5oxChrkh3dLrgwf40lFmdm36VqTLz6N+IfFCdmM6/Jss8zRGyzzQ1al9n I+cgb7dywW2X21u7lSovMrS68gYGT+Fw2DMx4MzU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2D43FF804D6; Fri, 2 Dec 2022 09:51:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 16A85F804E2; Fri, 2 Dec 2022 09:51:57 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 15432F804B3 for ; Fri, 2 Dec 2022 09:51:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 15432F804B3 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="MChUkUo+"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="JdeWDCZ7" Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C61451FE17; Fri, 2 Dec 2022 08:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669971110; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7CcGnjptI6yxXD/83uG/R6QCAVCr9hhrKfxghVeMD4o=; b=MChUkUo+/9ffvxEviw5hqBeis3zd/KcEqTbgqN7ePnOrq0l0FsTuOMxLkCTHVHqwpCBsDd o6sIn5dz8f2PXg8HHtLJh4yfJGbxvduLw5r8PC5REDp3SUpbHvPRloyJQRo34WX9GuNMzz eHPFqfZOPp9rdfDWv21+IJ25p1tPSGc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669971110; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7CcGnjptI6yxXD/83uG/R6QCAVCr9hhrKfxghVeMD4o=; b=JdeWDCZ7DAymILQUSpOna/eNFELifRo+dLDYN/PjAt9n8txf8d1hsBWQdVF9JFIIF3KJVL ZKGBFpahUDvkxfBg== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 98104133DE; Fri, 2 Dec 2022 08:51:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id X4hcJKa8iWPAMgAAGKfGzw (envelope-from ); Fri, 02 Dec 2022 08:51:50 +0000 Date: Fri, 02 Dec 2022 09:51:50 +0100 Message-ID: <87iliukx21.wl-tiwai@suse.de> From: Takashi Iwai To: Cezary Rojewski Subject: Re: [PATCH 02/16] ALSA: hda: Prepare for compress stream support In-Reply-To: <20221201175619.504758-3-cezary.rojewski@intel.com> References: <20221201175619.504758-1-cezary.rojewski@intel.com> <20221201175619.504758-3-cezary.rojewski@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, broonie@kernel.org, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Thu, 01 Dec 2022 18:56:05 +0100, Cezary Rojewski wrote: > > Before introducing compress specific changes, adjust BDL and parameters > setup functions so these are not tightly coupled with PCM streams. > > Signed-off-by: Cezary Rojewski Acked-by: Takashi Iwai thanks, Takashi > --- > sound/hda/hdac_stream.c | 32 ++++++++++++++++---------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c > index 3b250ee7f6a7..8a12c6347914 100644 > --- a/sound/hda/hdac_stream.c > +++ b/sound/hda/hdac_stream.c > @@ -487,11 +487,15 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev) > { > struct hdac_bus *bus = azx_dev->bus; > struct snd_pcm_substream *substream = azx_dev->substream; > - struct snd_pcm_runtime *runtime = substream->runtime; > + struct snd_pcm_runtime *runtime; > + struct snd_dma_buffer *dmab; > __le32 *bdl; > int i, ofs, periods, period_bytes; > int pos_adj, pos_align; > > + runtime = substream->runtime; > + dmab = snd_pcm_get_dma_buf(substream); > + > /* reset BDL address */ > snd_hdac_stream_writel(azx_dev, SD_BDLPL, 0); > snd_hdac_stream_writel(azx_dev, SD_BDLPU, 0); > @@ -505,7 +509,7 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev) > azx_dev->frags = 0; > > pos_adj = bus->bdl_pos_adj; > - if (!azx_dev->no_period_wakeup && pos_adj > 0) { > + if (runtime && !azx_dev->no_period_wakeup && pos_adj > 0) { > pos_align = pos_adj; > pos_adj = DIV_ROUND_UP(pos_adj * runtime->rate, 48000); > if (!pos_adj) > @@ -518,8 +522,7 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev) > pos_adj); > pos_adj = 0; > } else { > - ofs = setup_bdle(bus, snd_pcm_get_dma_buf(substream), > - azx_dev, > + ofs = setup_bdle(bus, dmab, azx_dev, > &bdl, ofs, pos_adj, true); > if (ofs < 0) > goto error; > @@ -529,13 +532,11 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev) > > for (i = 0; i < periods; i++) { > if (i == periods - 1 && pos_adj) > - ofs = setup_bdle(bus, snd_pcm_get_dma_buf(substream), > - azx_dev, &bdl, ofs, > - period_bytes - pos_adj, 0); > + ofs = setup_bdle(bus, dmab, azx_dev, > + &bdl, ofs, period_bytes - pos_adj, 0); > else > - ofs = setup_bdle(bus, snd_pcm_get_dma_buf(substream), > - azx_dev, &bdl, ofs, > - period_bytes, > + ofs = setup_bdle(bus, dmab, azx_dev, > + &bdl, ofs, period_bytes, > !azx_dev->no_period_wakeup); > if (ofs < 0) > goto error; > @@ -560,26 +561,25 @@ EXPORT_SYMBOL_GPL(snd_hdac_stream_setup_periods); > int snd_hdac_stream_set_params(struct hdac_stream *azx_dev, > unsigned int format_val) > { > - > - unsigned int bufsize, period_bytes; > struct snd_pcm_substream *substream = azx_dev->substream; > - struct snd_pcm_runtime *runtime; > + unsigned int bufsize, period_bytes; > + unsigned int no_period_wakeup; > int err; > > if (!substream) > return -EINVAL; > - runtime = substream->runtime; > bufsize = snd_pcm_lib_buffer_bytes(substream); > period_bytes = snd_pcm_lib_period_bytes(substream); > + no_period_wakeup = substream->runtime->no_period_wakeup; > > if (bufsize != azx_dev->bufsize || > period_bytes != azx_dev->period_bytes || > format_val != azx_dev->format_val || > - runtime->no_period_wakeup != azx_dev->no_period_wakeup) { > + no_period_wakeup != azx_dev->no_period_wakeup) { > azx_dev->bufsize = bufsize; > azx_dev->period_bytes = period_bytes; > azx_dev->format_val = format_val; > - azx_dev->no_period_wakeup = runtime->no_period_wakeup; > + azx_dev->no_period_wakeup = no_period_wakeup; > err = snd_hdac_stream_setup_periods(azx_dev); > if (err < 0) > return err; > -- > 2.25.1 >