Re: [PATCH] ASoC: rsnd: stop all working stream when .remove

Kuninori Morimoto
2017-09-04T17:44:43Z

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 ?