public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>, Simon <horms@verge.net.au>
Subject: Re: [PATCH] ASoC: rsnd: stop all working stream when	.remove
Date: Mon, 04 Sep 2017 20:46:34 +0200	[thread overview]
Message-ID: <s5hziaati7p.wl-tiwai@suse.de> (raw)
In-Reply-To: <s5h1snmuwxk.wl-tiwai@suse.de>

On Mon, 04 Sep 2017 20:43:19 +0200,
Takashi Iwai wrote:
> 
> On Mon, 04 Sep 2017 19:44:36 +0200,
> Kuninori Morimoto wrote:
> > 
> > Hi Takasi-san
> > 
> > > > The lack of stop sync is a known problem in the ALSA PCM 
> > > > infrastructure.  The standard idiom is to do sync at both prepare 
> > > > and hw_free (or close) callbacks.
> > > 
> > > Thanks.
> > > This path main sync is for clk ON/OFF
> > >
> > > Hm, but it's managed as PCM trigger, no?
> > > How can the rsnd_io_is_working() return true after PCM streams are stopped?
> > 
> > It is based on PCM trigger, thus, it returns false if PCM streams are stopped.
> > 
> > This driver calls clk_get() when PCM started, and clk_put() when stopped.
> > And it calles clk_enable() on .probe, and clk_disable() on .remove.
> > 
> > My problem is that user unbinds driver during Sound playing, this
> > means clk_get() is called, but clk_put() is not called.
> >
> >Then, .remove will call clk_disable(), but clk_put() is not yet called. Then, kernel indicates clk user count mismatch. This patch calls missing PCM stop (= clk_put()) position function if needed.
> > Is this clear answer for you ?
> 
> This isn't something you shouldn't fiddle with the codec layer.
> If the driver gets removed during the operation, you have to cancel
> the operation and sync with it in a proper way, then proceed the rest
> of the remove, not only a codec-specific resource management.
> 
> Admittedly, there is no common infrastructure for that.  But it
> doesn't mean that each codec driver should do its own hack.
> 
> I can imagine a way like calling the card disconnect/free at codec
> remove, so that it can sync with the whole stop operation before doing
> the rest.  This should be ignored when the code path is from the card
> removal -- e.g. checking card->shutdown flag.

Here I mentioned the codec driver, but it's applied to each lower-level
component.  It'd need some graceful way to communicate with the
top-level card to assure the removal of the component.


Takashi

  reply	other threads:[~2017-09-04 18:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01  4:34 [PATCH] ASoC: rsnd: stop all working stream when .remove Kuninori Morimoto
2017-09-01  7:29 ` Takashi Iwai
2017-09-01  7:48   ` Kuninori Morimoto
2017-09-01  8:17     ` Takashi Iwai
2017-09-04 17:44       ` Kuninori Morimoto
2017-09-04 18:43         ` Takashi Iwai
2017-09-04 18:46           ` Takashi Iwai [this message]
2017-09-05  7:40             ` Kuninori Morimoto
2017-09-05  8:09               ` Takashi Iwai
2017-09-05  8:58                 ` Kuninori Morimoto
2017-09-05  9:33                   ` Takashi Iwai
2017-09-05 10:07                     ` Kuninori Morimoto
2017-09-05 10:12                     ` Mark Brown
2017-09-05 11:35                     ` Takashi Iwai
2017-09-05 12:58                       ` Takashi Iwai
2017-09-26  8:21                         ` Kuninori Morimoto
2017-09-27  5:14                           ` Kuninori Morimoto
2017-10-06 13:19                             ` Takashi Iwai
2017-10-10  8:00                               ` Kuninori Morimoto
2017-10-11  6:52                                 ` Kuninori Morimoto
2017-09-05 14:04                       ` Mark Brown
2017-09-05 14:08                         ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hziaati7p.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=horms@verge.net.au \
    --cc=kuninori.morimoto.gx@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox