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 9769FC4332F for ; Fri, 2 Dec 2022 08:52:01 +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 D899A1777; Fri, 2 Dec 2022 09:51:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D899A1777 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669971118; bh=13CBI9dvygyWp69VpCDRxV2NCMU0gRPVBDH1Yi5ohzI=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZDacCCxb2WMNkWhgIssg0XQxO5oTNgqe9mjt2Sqj8l9iDl/ukE1MY9/g5H6m+zEGK H4gQrB+qqwGPaPVRMbtdhCtFWgfHLbuirBcfEMmsXcLwud8Q9KswXRvxvlDuQl4K4U iw49J72HDGDnSSiomMjGk891RYm7ZW279vmqlswU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 834B4F80272; Fri, 2 Dec 2022 09:51:08 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 41DD9F80310; Fri, 2 Dec 2022 09:51:07 +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 90042F80162 for ; Fri, 2 Dec 2022 09:51:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 90042F80162 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="umN8AQHM"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/Cm/MJTG" 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 2D1D91FE11; Fri, 2 Dec 2022 08:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669971061; 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=VoGXpVN7kyCiNaDa/EXBYT8cMKPPbx/8aySOuC+OA6A=; b=umN8AQHMZtnqBycQ0mwuVzyLUQvzZ7S/9ygSmVNkq+KlkwuNcNu5zG/KKiBtsU3jFRrDJ0 3FEkjGtlM8FGNjXSNtEAyAEzuVqxxsuinHPqyRJa7AR4RUX9eJZSQTUzxVjWKAb/vSkOSz Hre6TkqcMntCmRHH4rbOdVSJfrAm0KI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669971061; 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=VoGXpVN7kyCiNaDa/EXBYT8cMKPPbx/8aySOuC+OA6A=; b=/Cm/MJTGyE3hWxxyXHkTHAWSmm4Y2GPA6/yks5lxrnAogaWLpWmgib7hrbStbCHj1+f+oV XYUuZJisDVBnk5DA== 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 E93A9133DE; Fri, 2 Dec 2022 08:51:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id rNlHOHS8iWNlMgAAGKfGzw (envelope-from ); Fri, 02 Dec 2022 08:51:00 +0000 Date: Fri, 02 Dec 2022 09:51:00 +0100 Message-ID: <87k03akx3f.wl-tiwai@suse.de> From: Takashi Iwai To: Cezary Rojewski Subject: Re: [PATCH 01/16] ALSA: hda: Allow for compress stream to hdac_ext_stream assignment In-Reply-To: <20221201175619.504758-2-cezary.rojewski@intel.com> References: <20221201175619.504758-1-cezary.rojewski@intel.com> <20221201175619.504758-2-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:04 +0100, Cezary Rojewski wrote: > > Currently only PCM streams can enlist hdac_stream for their data > transfer. Add cstream field to hdac_ext_stream to expose possibility of > compress stream assignment in place of PCM one. > Limited to HOST-type only as there no other users on the horizon. > > Signed-off-by: Cezary Rojewski Acked-by: Takashi Iwai thanks, Takashi > --- > include/sound/hdaudio_ext.h | 2 ++ > sound/hda/ext/hdac_ext_stream.c | 41 +++++++++++++++++++++++++++++++++ > 2 files changed, 43 insertions(+) > > diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h > index 68ab89211de2..511211f4a2b6 100644 > --- a/include/sound/hdaudio_ext.h > +++ b/include/sound/hdaudio_ext.h > @@ -75,6 +75,8 @@ struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus, > struct snd_pcm_substream *substream, > int type); > void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type); > +struct hdac_ext_stream *snd_hdac_ext_cstream_assign(struct hdac_bus *bus, > + struct snd_compr_stream *cstream); > void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus, > struct hdac_ext_stream *hext_stream, bool decouple); > void snd_hdac_ext_stream_decouple(struct hdac_bus *bus, > diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c > index 2a071a09224d..11b7119cc47e 100644 > --- a/sound/hda/ext/hdac_ext_stream.c > +++ b/sound/hda/ext/hdac_ext_stream.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > > /** > * snd_hdac_ext_stream_init - initialize each stream (aka device) > @@ -367,3 +368,43 @@ void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type) > > } > EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_release); > + > +/** > + * snd_hdac_ext_cstream_assign - assign a host stream for compress > + * @bus: HD-audio core bus > + * @cstream: Compress stream to assign > + * > + * Assign an unused host stream for the given compress stream. > + * If no stream is free, NULL is returned. Stream is decoupled > + * before assignment. > + */ > +struct hdac_ext_stream *snd_hdac_ext_cstream_assign(struct hdac_bus *bus, > + struct snd_compr_stream *cstream) > +{ > + struct hdac_ext_stream *res = NULL; > + struct hdac_stream *hstream; > + > + spin_lock_irq(&bus->reg_lock); > + list_for_each_entry(hstream, &bus->stream_list, list) { > + struct hdac_ext_stream *hext_stream = stream_to_hdac_ext_stream(hstream); > + > + if (hstream->direction != cstream->direction) > + continue; > + > + if (!hstream->opened) { > + res = hext_stream; > + break; > + } > + } > + > + if (res) { > + snd_hdac_ext_stream_decouple_locked(bus, res, true); > + res->hstream.opened = 1; > + res->hstream.running = 0; > + res->hstream.cstream = cstream; > + } > + spin_unlock_irq(&bus->reg_lock); > + > + return res; > +} > +EXPORT_SYMBOL_GPL(snd_hdac_ext_cstream_assign); > -- > 2.25.1 >