Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	alsa-devel@alsa-project.org,  broonie@kernel.org
Cc: pierre-louis.bossart@linux.intel.com,
	yung-chuan.liao@linux.intel.com, peter.ujfalusi@linux.intel.com,
	ranjani.sridharan@linux.intel.com, lgirdwood@gmail.com,
	daniel.baluta@nxp.com
Subject: Re: [PATCH] ASoC: core: unregister clients and machine drivers in .shutdown
Date: Wed, 16 Feb 2022 09:38:35 +0100	[thread overview]
Message-ID: <82363efa-10c4-192e-d8dc-4abeb0f63543@linux.intel.com> (raw)
In-Reply-To: <20220215180628.3893282-1-kai.vehmanen@linux.intel.com>

On 2/15/2022 7:06 PM, Kai Vehmanen wrote:

Nitpicking, but I guess "SOF:" got lost in title ;)

> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> On a platform shutdown, the expectation for most drivers is that
> userspace tasks will release all resources. When those sequences do
> not complete, it can be the case that PCM devices exposed by ALSA
> cards are used *after* the DSP shutdown completes, leading to a
> platform hang.
> 
> When the clients and machine drivers provide an _unregister callback,
> let's invoke it in the shutdown sequence.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> ---
>   sound/soc/sof/core.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
> index d99ecbb4282d..2a35d8ddf43e 100644
> --- a/sound/soc/sof/core.c
> +++ b/sound/soc/sof/core.c
> @@ -463,10 +463,19 @@ EXPORT_SYMBOL(snd_sof_device_remove);
>   int snd_sof_device_shutdown(struct device *dev)
>   {
>   	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
> +	struct snd_sof_pdata *pdata = sdev->pdata;
>   
>   	if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE))
>   		cancel_work_sync(&sdev->probe_work);
>   
> +	/*
> +	 * make sure clients and machine driver(s) are unregistered to force
> +	 * all userspace devices to be closed prior to the DSP shutdown sequence
> +	 */
> +	sof_unregister_clients(sdev);
> +
> +	snd_sof_machine_unregister(sdev, pdata);
> +
>   	if (sdev->fw_state == SOF_FW_BOOT_COMPLETE)
>   		return snd_sof_shutdown(sdev);
>   
> 
> base-commit: f7d344a2bd5ec81fbd1ce76928fd059e57ec9bea


  reply	other threads:[~2022-02-16  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 18:06 [PATCH] ASoC: core: unregister clients and machine drivers in .shutdown Kai Vehmanen
2022-02-16  8:38 ` Amadeusz Sławiński [this message]
2022-02-16 13:49   ` Kai Vehmanen

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=82363efa-10c4-192e-d8dc-4abeb0f63543@linux.intel.com \
    --to=amadeuszx.slawinski@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=yung-chuan.liao@linux.intel.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