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 3289CC4332F for ; Fri, 2 Dec 2022 08:54:20 +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 2551817D1; Fri, 2 Dec 2022 09:53:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2551817D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669971258; bh=lyR2F+1Nn8xn8AeOHfonLCQdEWRv26ddHVk7L6m19II=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AtmjybnLDdt3HiAxYwPEQnrOcL/4wqu22KTGM+yRsq1L124pUigasfWen1ySKPwUi TxzqHT1czfy8SKTddM+e6hVYsBU+61enQssLzfIz3q0gpYR0O+GHL4nMTEBz9Vo/6c 3tVenw6w2ZM1X+zbfn0tysVem/TD9qVewhjO4s+M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D7F0CF80272; Fri, 2 Dec 2022 09:53:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0C0B9F80310; Fri, 2 Dec 2022 09:53:26 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (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 34BA6F80162 for ; Fri, 2 Dec 2022 09:53:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 34BA6F80162 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="uloiqxNv"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="iEQDSzdB" 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-out1.suse.de (Postfix) with ESMTPS id AF19721C11; Fri, 2 Dec 2022 08:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669971199; 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=YiqiZx+Dvbizvxc032tZShyuOs6N3DdL38h1SWsqTag=; b=uloiqxNvF2zPQrYTgBfnzbyI3zGQ7P2dlDpfTNSonLobZYKTjKS1FzeunCa3jRODi7ZFGW whBfMMX6t3Bo6L86I6cGfBFVrWVQ1C+vqMS8YCX0KSfWMPdnySQlkHTsq3yrBZYvRgA9lZ EUloY8DOKvZ4b9SMuLcnWZv5UdxVDV4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669971199; 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=YiqiZx+Dvbizvxc032tZShyuOs6N3DdL38h1SWsqTag=; b=iEQDSzdBuEWF7RoXdqaG6QTMGK7z1K0lq+Xj0QCgFGz+ChA6OruKhnQtuKzgcJd2b21YFx kEraxM8gNpA9xYBw== 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 7C410133DE; Fri, 2 Dec 2022 08:53:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id 8op9Hf+8iWOQMwAAGKfGzw (envelope-from ); Fri, 02 Dec 2022 08:53:19 +0000 Date: Fri, 02 Dec 2022 09:53:19 +0100 Message-ID: <87h6yekwzk.wl-tiwai@suse.de> From: Takashi Iwai To: Cezary Rojewski Subject: Re: [PATCH 03/16] ALSA: hda: Interrupt servicing and BDL setup for compress streams In-Reply-To: <20221201175619.504758-4-cezary.rojewski@intel.com> References: <20221201175619.504758-1-cezary.rojewski@intel.com> <20221201175619.504758-4-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, Divya Prakash , 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:06 +0100, Cezary Rojewski wrote: > > Account for compress streams when receiving and servicing buffer > completed interrupts. In case of compress stream enlisting hdac_stream > for data transfer, setup BDL entries much like it is the case for PCM > streams. > > Signed-off-by: Cezary Rojewski > Signed-off-by: Divya Prakash Usually the person who submitted the patch signs off at the last. For the content: Acked-by: Takashi Iwai thanks, Takashi > --- > sound/hda/hdac_controller.c | 4 ++-- > sound/hda/hdac_stream.c | 26 ++++++++++++++++++++------ > 2 files changed, 22 insertions(+), 8 deletions(-) > > diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c > index 9a60bfdb39ba..3c7af6558249 100644 > --- a/sound/hda/hdac_controller.c > +++ b/sound/hda/hdac_controller.c > @@ -578,8 +578,8 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status, > sd_status = snd_hdac_stream_readb(azx_dev, SD_STS); > snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK); > handled |= 1 << azx_dev->index; > - if (!azx_dev->substream || !azx_dev->running || > - !(sd_status & SD_INT_COMPLETE)) > + if ((!azx_dev->substream && !azx_dev->cstream) || > + !azx_dev->running || !(sd_status & SD_INT_COMPLETE)) > continue; > if (ack) > ack(bus, azx_dev); > diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c > index 8a12c6347914..4e236719bdd1 100644 > --- a/sound/hda/hdac_stream.c > +++ b/sound/hda/hdac_stream.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -487,14 +488,20 @@ 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_compr_stream *cstream = azx_dev->cstream; > 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); > + if (substream) { > + runtime = substream->runtime; > + dmab = snd_pcm_get_dma_buf(substream); > + } else if (cstream) { > + runtime = NULL; > + dmab = snd_pcm_get_dma_buf(cstream); > + } > > /* reset BDL address */ > snd_hdac_stream_writel(azx_dev, SD_BDLPL, 0); > @@ -562,15 +569,22 @@ int snd_hdac_stream_set_params(struct hdac_stream *azx_dev, > unsigned int format_val) > { > struct snd_pcm_substream *substream = azx_dev->substream; > + struct snd_compr_stream *cstream = azx_dev->cstream; > unsigned int bufsize, period_bytes; > unsigned int no_period_wakeup; > int err; > > - if (!substream) > + if (substream) { > + bufsize = snd_pcm_lib_buffer_bytes(substream); > + period_bytes = snd_pcm_lib_period_bytes(substream); > + no_period_wakeup = substream->runtime->no_period_wakeup; > + } else if (cstream) { > + bufsize = cstream->runtime->buffer_size; > + period_bytes = cstream->runtime->fragment_size; > + no_period_wakeup = 0; > + } else { > return -EINVAL; > - 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 || > -- > 2.25.1 >