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 3A6F0C433F5 for ; Tue, 8 Feb 2022 17:15:13 +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 4E3731742; Tue, 8 Feb 2022 18:14:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4E3731742 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1644340511; bh=tPbDMVfHC54Ab5eSne7x5BuceFVPv2T1HkuFK178AO0=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZiJcVlG0d8U1duBdQnhvdmDiNCx1OqjZIM+vhn4naLCuVKNIM2xClNw1NZVZD/FKx UVYemRUOzYObb4R0UB1XpdSbQo/A3reac25fE7mCqNaz+tVF83eVilOmGAbQeKw3q+ POHn+WDpRYAfcOS7fcv5csqq2F0gTyLQaI8v1fwI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DD7E1F8012B; Tue, 8 Feb 2022 18:14:20 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 98030F8013C; Tue, 8 Feb 2022 18:14:19 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 27E84F800EB for ; Tue, 8 Feb 2022 18:14:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 27E84F800EB Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="bLkDA7i6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="E4eOkoMf" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 68C52210F9; Tue, 8 Feb 2022 17:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1644340456; 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=GzevaS/R8OZa1aoRx1qFZBkVWeQ6fF9vyVjNEYWgSlI=; b=bLkDA7i60xwhnG79ForSf9B6V/6AkXMLHbkSsqR5vHe4OMcpxj6B02nNiSqxk9FBWu1HtF st3ApBOpKFDcslPzmz2/5+Wldy9aSC2rYiqgBpjhP9mZbw3r+NzJGL36F4qdk0xmLlCqsw 6bAeXr5bivwx6pHg33OExISE7geiEpA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1644340456; 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=GzevaS/R8OZa1aoRx1qFZBkVWeQ6fF9vyVjNEYWgSlI=; b=E4eOkoMfyJn+8q8DlXBJCwuAV/faVBGPgdtwtV3R3fvMv3Q7Niig67SOcY3yR2CTXkq+XO FC7B/MmJJrAvfZAw== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 4E5DBA3B88; Tue, 8 Feb 2022 17:14:16 +0000 (UTC) Date: Tue, 08 Feb 2022 18:14:16 +0100 Message-ID: From: Takashi Iwai To: Cezary Rojewski Subject: Re: [PATCH 3/4] ALSA: hda: Update and expose codec register procedures In-Reply-To: References: <20220207114906.3759800-1-cezary.rojewski@intel.com> <20220207114906.3759800-4-cezary.rojewski@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, upstream@semihalf.com, Kai Vehmanen , harshapriya.n@intel.com, rad@semihalf.com, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, broonie@kernel.org, cujomalainey@chromium.org, lma@semihalf.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 Tue, 08 Feb 2022 17:34:47 +0100, Cezary Rojewski wrote: > > On 2022-02-08 4:54 PM, Kai Vehmanen wrote: > > Hi, > > > > On Mon, 7 Feb 2022, Cezary Rojewski wrote: > > > >> With few changes, snd_hda_codec_register() and its > >> unregister-counterpart can be re-used by ASoC drivers. While at it, > >> provide kernel doc for the exposed functions. > > > > thanks, there is no doubt room to improve the HDA<->asoc interaction > > still and increase reuse. Some questions: > > Thanks for taking time in reviewing the patches, Kai! > > >> Due to ALSA-device vs ASoC-component organization differences, new > >> 'snddev_managed' argument is specified allowing for better control over > >> codec registration process. > > > > Can you maybe clarify this? The existing code to handle the different > > paths is already quite hairy (e.g. code in > > hda_codec.c:snd_hda_codec_dev_free() that does different actions > > depending on whether "codec->core.type == HDA_DEV_LEGACY) is true or > > false), so we'd need to have very clear semantics for the > > "snddev_managed". > > It's rather straightforward - ASoC does not provide you with pointer > to struct snd_card until all components are accounted > for. snd_hda_codec_device_new() in its current form needs such > information upfront though. As we want to create only as many DAIs > (and other ASoC components like links and routes) as needed, codec's > ->pcm_list_head needs to be built before codec's probing can be > completed. But in order to have hda codec to fill ->pcm_list_head for, > you need to create it. And in order to create it you need snd_card > pointer which ASoC won't give you before you complete component > probing. > > Typical chicken and egg problem. And that's why additional option is > provided - it solves that problem. Hmm, but snd_hda_codec_device_new() also does the actual hardware initialization including the power-up sequence, and there is a call snd_component_add() with the card instance. How the function would work properly before the card instantiation? You seem to have handled only snd_device_new() and not touching other code where the card (or the hardware access) is involved. If the purpose is to get the fields of snd_hda_codec to be initialized, those init code can be factored out to another function, so that it works certainly without card. Takashi