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 C86CCC433EF for ; Wed, 1 Jun 2022 19:14:54 +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 C95A9171F; Wed, 1 Jun 2022 21:14:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C95A9171F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654110891; bh=zyzF3F7JC1BIMwfU3iCzCwHcM32zHxqiEVe/c/Rh2Gw=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bSIPu24P0A0wi1d0k4pdIogX18YJ5wnCOVORoE4gd9aUcn20m/WRImsrY88HT8m6b MVyXxgeZQ0qKXp5Xold6om3YZ4BCjZjCOVv1/iwmG1voCtMR4iwL2xMvWG3jJcXuKW Azc4xHA5BzzYWFGNi8F6iucQlfNoCI1oA/xjRb2U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 489CDF8019B; Wed, 1 Jun 2022 21:14:01 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 598C1F80238; Wed, 1 Jun 2022 21:13:59 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 007EEF800BD for ; Wed, 1 Jun 2022 21:13:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 007EEF800BD Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="eJWfOQDF"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="vlxyTuTt" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 19D251F93D; Wed, 1 Jun 2022 19:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1654110836; 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=a9u5hPonEj/nYbaH7KqEil1yX8WxZg/sHH0JzVEX0BA=; b=eJWfOQDFbje58Pvln7Hd8ShUzOVhrTKrqwXaSOxBSiC0DO+NSkUpdFOHooDD7pCwI3mB5A /XeFPtQNE1COwDVA9WjuZuFOsjCqr9247l9RkcwE23TEhe7at1wvck2+p4ak44jzv5woGM hYmBbN7ngTTPfiOau0OUGGeYDNH+SxU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1654110836; 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=a9u5hPonEj/nYbaH7KqEil1yX8WxZg/sHH0JzVEX0BA=; b=vlxyTuTtVr+kbwBfCwGIfyk6VP7yVYURsb4cSA52VWdDlhJCfKg5DTmBIYcZlq2n6mguVd pNmYzqXgm6SIVaAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CCA9613A8F; Wed, 1 Jun 2022 19:13:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GhPeMHO6l2IGDgAAMHmgww (envelope-from ); Wed, 01 Jun 2022 19:13:55 +0000 Date: Wed, 01 Jun 2022 21:13:55 +0200 Message-ID: <87mtewyz64.wl-tiwai@suse.de> From: Takashi Iwai To: Richard Fitzgerald Subject: Re: [PATCH v4 00/17] ALSA: hda: cirrus: Add initial DSP support and firmware loading In-Reply-To: <008e3188-f35d-4323-08ea-de5f3a88333a@opensource.cirrus.com> References: <20220525131638.5512-1-vitalyr@opensource.cirrus.com> <871qwf0x8t.wl-tiwai@suse.de> <20220530090846.GS38351@ediswmail.ad.cirrus.com> <87czfvxtsc.wl-tiwai@suse.de> <20220530093639.GT38351@ediswmail.ad.cirrus.com> <87a6azxr7h.wl-tiwai@suse.de> <20220530103415.GU38351@ediswmail.ad.cirrus.com> <871qwbxpsb.wl-tiwai@suse.de> <008e3188-f35d-4323-08ea-de5f3a88333a@opensource.cirrus.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, Charles Keepax , Vitaly Rodionov , patches@opensource.cirrus.com, Takashi Iwai , Mark Brown , linux-kernel@vger.kernel.org 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 Wed, 01 Jun 2022 18:43:31 +0200, Richard Fitzgerald wrote: > > On 30/05/2022 11:45, Takashi Iwai wrote: > > On Mon, 30 May 2022 12:34:15 +0200, > > Charles Keepax wrote: > >> > >> On Mon, May 30, 2022 at 12:14:26PM +0200, Takashi Iwai wrote: > >>> On Mon, 30 May 2022 11:36:39 +0200, > >>> Charles Keepax wrote: > >>>> On Mon, May 30, 2022 at 11:18:43AM +0200, Takashi Iwai wrote: > >>>>> On Mon, 30 May 2022 11:08:46 +0200, > >>>>> Charles Keepax wrote: > >>>>>> On Fri, May 27, 2022 at 06:13:38PM +0200, Takashi Iwai wrote: > >>>>>>> On Wed, 25 May 2022 15:16:21 +0200, > >>>>>>> Vitaly Rodionov wrote: > >>>> Yeah that should be what is happening here. Although it looks > >>>> like this code might be removing all the controls if the firmware > >>>> is unloaded. I will discuss that with the guys, we normal just > >>>> disable the controls on the wm_adsp stuff. > >>> > >>> OK, that sounds good. Basically my concern came up from the code > >>> snippet doing asynchronous addition/removal via work. This showed > >>> some yellow signal, as such a pattern doesn't appear in the normal > >>> implementation. If this is (still) really necessary, it has to be > >>> clarified as an exception. > >>> > >> > >> Hm... ok we will think about that. I think that part will > >> probably still be necessary. Because there is an ALSA control > >> that selects the firmware, then it is necesarry to defer creating > >> the controls to some work, since you are already holding the > >> lock. > > > > Well, if an ALSA control can trigger the firmware loading, that's > > already fragile. A firmware loading is a heavy task, which should > > happen only at probing and/or resuming in general. Do we have other > > drivers doing the f/w loading triggered by a kctl...? > > > > On Wolfson/Cirrus codecs the firmware isn't to "make the chip work". > The DSP is programmable to allow for additional audio processing > algorithms. Which algorithm you need depends on the audio use case(s) > you are running, and can change as you change use-case. Many of the > codecs don't have enough DSP memory to hold all possible algorithms. > Which is why the firmware load has always been triggered from ALSA > controls in the ASoC code. It's not something that can be loaded > once in probe(). But it's still a question whether such an easily triggerable interface should be used for a heavy procedure like the DSP firmware load. e.g. calling the standard request_firmware() API directly from a control callback doesn't sound like a good idea at all. The similar argument is applied to the dynamic addition/removal of other controls followed by a kctl callback. thanks, Takashi 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 117C6C43334 for ; Wed, 1 Jun 2022 20:46:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbiFAUqF (ORCPT ); Wed, 1 Jun 2022 16:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbiFAUpY (ORCPT ); Wed, 1 Jun 2022 16:45:24 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A75E1E2278 for ; Wed, 1 Jun 2022 13:32:44 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 19D251F93D; Wed, 1 Jun 2022 19:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1654110836; 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=a9u5hPonEj/nYbaH7KqEil1yX8WxZg/sHH0JzVEX0BA=; b=eJWfOQDFbje58Pvln7Hd8ShUzOVhrTKrqwXaSOxBSiC0DO+NSkUpdFOHooDD7pCwI3mB5A /XeFPtQNE1COwDVA9WjuZuFOsjCqr9247l9RkcwE23TEhe7at1wvck2+p4ak44jzv5woGM hYmBbN7ngTTPfiOau0OUGGeYDNH+SxU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1654110836; 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=a9u5hPonEj/nYbaH7KqEil1yX8WxZg/sHH0JzVEX0BA=; b=vlxyTuTtVr+kbwBfCwGIfyk6VP7yVYURsb4cSA52VWdDlhJCfKg5DTmBIYcZlq2n6mguVd pNmYzqXgm6SIVaAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CCA9613A8F; Wed, 1 Jun 2022 19:13:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GhPeMHO6l2IGDgAAMHmgww (envelope-from ); Wed, 01 Jun 2022 19:13:55 +0000 Date: Wed, 01 Jun 2022 21:13:55 +0200 Message-ID: <87mtewyz64.wl-tiwai@suse.de> From: Takashi Iwai To: Richard Fitzgerald Cc: Charles Keepax , Vitaly Rodionov , Jaroslav Kysela , Takashi Iwai , Mark Brown , , , Subject: Re: [PATCH v4 00/17] ALSA: hda: cirrus: Add initial DSP support and firmware loading In-Reply-To: <008e3188-f35d-4323-08ea-de5f3a88333a@opensource.cirrus.com> References: <20220525131638.5512-1-vitalyr@opensource.cirrus.com> <871qwf0x8t.wl-tiwai@suse.de> <20220530090846.GS38351@ediswmail.ad.cirrus.com> <87czfvxtsc.wl-tiwai@suse.de> <20220530093639.GT38351@ediswmail.ad.cirrus.com> <87a6azxr7h.wl-tiwai@suse.de> <20220530103415.GU38351@ediswmail.ad.cirrus.com> <871qwbxpsb.wl-tiwai@suse.de> <008e3188-f35d-4323-08ea-de5f3a88333a@opensource.cirrus.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 01 Jun 2022 18:43:31 +0200, Richard Fitzgerald wrote: > > On 30/05/2022 11:45, Takashi Iwai wrote: > > On Mon, 30 May 2022 12:34:15 +0200, > > Charles Keepax wrote: > >> > >> On Mon, May 30, 2022 at 12:14:26PM +0200, Takashi Iwai wrote: > >>> On Mon, 30 May 2022 11:36:39 +0200, > >>> Charles Keepax wrote: > >>>> On Mon, May 30, 2022 at 11:18:43AM +0200, Takashi Iwai wrote: > >>>>> On Mon, 30 May 2022 11:08:46 +0200, > >>>>> Charles Keepax wrote: > >>>>>> On Fri, May 27, 2022 at 06:13:38PM +0200, Takashi Iwai wrote: > >>>>>>> On Wed, 25 May 2022 15:16:21 +0200, > >>>>>>> Vitaly Rodionov wrote: > >>>> Yeah that should be what is happening here. Although it looks > >>>> like this code might be removing all the controls if the firmware > >>>> is unloaded. I will discuss that with the guys, we normal just > >>>> disable the controls on the wm_adsp stuff. > >>> > >>> OK, that sounds good. Basically my concern came up from the code > >>> snippet doing asynchronous addition/removal via work. This showed > >>> some yellow signal, as such a pattern doesn't appear in the normal > >>> implementation. If this is (still) really necessary, it has to be > >>> clarified as an exception. > >>> > >> > >> Hm... ok we will think about that. I think that part will > >> probably still be necessary. Because there is an ALSA control > >> that selects the firmware, then it is necesarry to defer creating > >> the controls to some work, since you are already holding the > >> lock. > > > > Well, if an ALSA control can trigger the firmware loading, that's > > already fragile. A firmware loading is a heavy task, which should > > happen only at probing and/or resuming in general. Do we have other > > drivers doing the f/w loading triggered by a kctl...? > > > > On Wolfson/Cirrus codecs the firmware isn't to "make the chip work". > The DSP is programmable to allow for additional audio processing > algorithms. Which algorithm you need depends on the audio use case(s) > you are running, and can change as you change use-case. Many of the > codecs don't have enough DSP memory to hold all possible algorithms. > Which is why the firmware load has always been triggered from ALSA > controls in the ASoC code. It's not something that can be loaded > once in probe(). But it's still a question whether such an easily triggerable interface should be used for a heavy procedure like the DSP firmware load. e.g. calling the standard request_firmware() API directly from a control callback doesn't sound like a good idea at all. The similar argument is applied to the dynamic addition/removal of other controls followed by a kctl callback. thanks, Takashi