From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] ASoC: rsnd: stop all working stream when .remove Date: Tue, 05 Sep 2017 11:33:42 +0200 Message-ID: References: <874lsnniv3.wl%kuninori.morimoto.gx@renesas.com> <87d17akgqr.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 8F8D4266E25 for ; Tue, 5 Sep 2017 11:33:44 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Kuninori Morimoto Cc: Linux-ALSA , Mark Brown , Simon List-Id: alsa-devel@alsa-project.org On Tue, 05 Sep 2017 10:58:37 +0200, Kuninori Morimoto wrote: > > Hi Takashi-san > > Thank you for your feedback > > > Right, you can't cancel or return an error at that point. > > That is, you'd need to sync (wait) until the all top-level operations are canceled at remove callback. > > > > For example, snd_card_free() processes the disconnection procedure at first, > > then waits for the completion. That's how the hot-unplug works safely. > > It's implemented, at least, in the top-level driver removal. > > > > Now for the lower level driver, you'd need a similar strategy; notify to the toplevel for > > hot-unplug (disconnect in ALSA), and sync with the stop operation, then continue the rest of its own remove procedure. > > OK, it needs ALSA SoC framework side new feature. Not only ASoC but also in all ALSA component generally. The component-level hot unplug isn't implemented yet properly. > But can I confirm current situation ? > > In ALSA SoC, it has Card/CPU/Codec/Platform drivers, and we can unbind these randomly. > Now, if I unbind CPU first, it checks connected Card, and will disconnect it if needed (Then, other drivers are as-is). > Because of this, Card will be disconnected automatically, and we can't use it again if user didn't remove all other > remaining drivers and re-bind all drivers again. This is current ALSA SoC I think. > > If my understanding was correct, your idea is that we want to call remove function for all connected drivers somehow. > And then, Card want to wait all drivers are removed. Correct ? Right. Unless we really want to support the hog-plug/unplug of each component, it'd be more straightforward to do the full hot-unplug upon every component unbind action. > I'm happy to work for it. > But adding new unplug feature is for sync with all "drivers", and this patch is sync for "clk" for my CPU driver. > Can we separate these ? It belongs with the same thing. Basically you're tweaking clk per PCM stream status. By handling the full hot-plug properly, the PCM stream is assured to be stopped, thus you don't have to fiddle with clk in the remove callback at all. Takashi