[alsa-devel] Question about sound device release timing

Takashi Iwai tiwai at suse.de
Fri Aug 25 10:52:19 CEST 2017


On Fri, 25 Aug 2017 10:44:00 +0200,
Kuninori Morimoto wrote:
> 
> 
> Hi Mark, Takashi-san
> 
> > --- a/sound/soc/soc-pcm.c
> > +++ b/sound/soc/soc-pcm.c
> > @@ -2632,6 +2632,16 @@ static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream)
> >  	return ret;
> >  }
> >  
> > +static void soc_pcm_private_free(struct snd_pcm *pcm)
> > +{
> > +	struct snd_soc_pcm_runtime *rtd = pcm->private_data;
> > +	struct snd_soc_platform *platform = rtd->platform;
> > +
> > +	flush_delayed_work(&rtd->delayed_work);
> > +	if (platform->driver->pcm_free)
> > +		if (platform->driver->pcm_free(pcm);
> > +}
> > +
> >  /* create a new pcm */
> >  int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
> >  {
> > @@ -2757,7 +2767,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
> >  		}
> >  	}
> >  
> > -	pcm->private_free = platform->driver->pcm_free;
> > +	pcm->private_free = soc_pcm_private_free;
> 
> Thanks !
> I confirmed that this solved my issue from kernel Oops.
>  - Renesas Lager board
>  - Renesas R-Car Salvator-X board
> 
> Reported-by: Hiep Cao Minh <cm-hiep at jinso.co.jp>
> Reported-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> Tested-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

OK, I'll cook up a proper patch and submit soon later.


> > Mark
> 
> If above patch was added, my current posted patch
> # ASoC: add Component level pcm_new/pcm_free v2
> # Date: Tue, 08 Aug 2017 15:12:06 +0900
> will have conflict. Then I can re-post it.
> Please let me know if your review was finished.
> 
> > > 	/*
> > > 	 * custom kernel for avoiding close_delayed_work()
> > > 	 */
> > > 	> aplay xxx.wav &
> > > 	> echo xxxx > /sys/bus/platform/drivers/rcar_sound/unbind
> > > 	/* unbind codec and card drivers here */
> > > 	>
> > > 	/*
> > > 	 * try re-bind
> > > 	 */
> > > 	/* re-bind codec and card drivers here */
> > > 	> echo xxxx > /sys/bus/platform/drivers/rcar_sound/bind 
> > > 	rcar_sound ec500000.sound: probed
> > > 	asoc-simple-card sound: ak4613-hifi <-> ec500000.sound mapping ok
> > > 	>
> > > 	> aplay xxx.wav 
> > > 	Playing WAVE '/home/Calm_16bit_48k.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
> > > 	ALSA lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) Slave PCM not usable
> > > 	aplay: set_params:1204: Broken configuration for this PCM: no configurations available
> > > 
> > > Do you know why or have hint to solve these issue ?
> > 
> > It's hard to say only from that...  But judging from your description,
> > it must be relevant with the stale DAPM setup that was left untouched
> > at the previous driver unbind?  That is, the driver doesn't fully
> > initialize the hardware at probe.
> 
> Thanks.
> I noticed that my one board could re-bind without issue,
> but one board had issue. I want to debug it.
> Do you know which function returns error to user side ?
> # set_params is only used on soc-compress, but my driver doesn't use it.

You can try tracing that was recently added by Sakamoto-san.
The error comes from the unavailable hw_params, that is, some
hw_params setup narrowed too much.

Or, if it's about DPCM, it can be due to some stale setup in BE.
What if you unload/reload the modules, not only rebind?


Takashi


More information about the Alsa-devel mailing list