core: snd_card_disconnect/snd_card_free: hang when card unregistered

Dexter Travis dexter.travis at precisionplanting.com
Thu May 14 23:04:09 CEST 2020


In my system during certain power events the power rail for the
TLV320AIC3120 goes away and may come back.

To accommodate this I have added a call to snd_soc_unregister_card as
soon as I notice via GPIO that this power has been removed.  I then
call snd_soc_register_card to re-install the sound card after power is
restored.

If no sound is playing when the asynchronous power removal occurs this
works fine.

If a sound is playing one of two things will occur.  In the first case
the sound driver comes back and sound is restored when power is
restored. In the second case my deferred work function which calls the
snd_soc_unregister_card function gets hung and does not return.

I have traced the difference to the wait_for_completion call in
snd_card_free.  if snd_card_disconnect adds files to shutdown_files
list then wait_for_completion will hang forever.

Any suggestions on how to further debug this?

How to force the immediate unregister of the card even if a sound is playing?

Thank you,

Dexter Travis


More information about the Alsa-devel mailing list