alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops
@ 2021-01-13 15:26 Kai Vehmanen
  2021-01-13 15:26 ` [PATCH 2/4] ASoC: SOF: add snd_sof_device_shutdown() helper for shutdown Kai Vehmanen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kai Vehmanen @ 2021-01-13 15:26 UTC (permalink / raw)
  To: alsa-devel, broonie
  Cc: kai.vehmanen, Keyon Jie, lgirdwood, pierre-louis.bossart,
	ranjani.sridharan, daniel.baluta, Bard Liao

From: Keyon Jie <yang.jie@linux.intel.com>

Add .shutdown() callback to the struct snd_sof_dsp_ops, for
doing platform specific actions at shutdown.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/soc/sof/ops.h      | 8 ++++++++
 sound/soc/sof/sof-priv.h | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h
index 4c1f9daaa6e8..f0c9ca8820d2 100644
--- a/sound/soc/sof/ops.h
+++ b/sound/soc/sof/ops.h
@@ -37,6 +37,14 @@ static inline int snd_sof_remove(struct snd_sof_dev *sdev)
 	return 0;
 }
 
+static inline int snd_sof_shutdown(struct snd_sof_dev *sdev)
+{
+	if (sof_ops(sdev)->shutdown)
+		return sof_ops(sdev)->shutdown(sdev);
+
+	return 0;
+}
+
 /* control */
 
 /*
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 28d19fa30614..682c4b6d01ef 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -98,9 +98,10 @@ struct snd_sof_pdata;
  */
 struct snd_sof_dsp_ops {
 
-	/* probe and remove */
+	/* probe/remove/shutdown */
 	int (*probe)(struct snd_sof_dev *sof_dev); /* mandatory */
 	int (*remove)(struct snd_sof_dev *sof_dev); /* optional */
+	int (*shutdown)(struct snd_sof_dev *sof_dev); /* optional */
 
 	/* DSP core boot / reset */
 	int (*run)(struct snd_sof_dev *sof_dev); /* mandatory */
@@ -462,6 +463,7 @@ struct snd_sof_dev {
 
 int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data);
 int snd_sof_device_remove(struct device *dev);
+int snd_sof_device_shutdown(struct device *dev);
 
 int snd_sof_runtime_suspend(struct device *dev);
 int snd_sof_runtime_resume(struct device *dev);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] ASoC: SOF: add snd_sof_device_shutdown() helper for shutdown
  2021-01-13 15:26 [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops Kai Vehmanen
@ 2021-01-13 15:26 ` Kai Vehmanen
  2021-01-13 15:26 ` [PATCH 3/4] ASoC: SOF: sof-pci-dev: add .shutdown() callback Kai Vehmanen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kai Vehmanen @ 2021-01-13 15:26 UTC (permalink / raw)
  To: alsa-devel, broonie
  Cc: kai.vehmanen, Keyon Jie, lgirdwood, pierre-louis.bossart,
	ranjani.sridharan, daniel.baluta, Bard Liao

From: Keyon Jie <yang.jie@linux.intel.com>

Add helper snd_sof_device_shutdown() to wrap the platform specific
.shutdown callbacks for SOF platforms.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
index 2b85ef5d6092..8d13eb13fe08 100644
--- a/sound/soc/sof/core.c
+++ b/sound/soc/sof/core.c
@@ -385,6 +385,14 @@ int snd_sof_device_remove(struct device *dev)
 }
 EXPORT_SYMBOL(snd_sof_device_remove);
 
+int snd_sof_device_shutdown(struct device *dev)
+{
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+
+	return snd_sof_shutdown(sdev);
+}
+EXPORT_SYMBOL(snd_sof_device_shutdown);
+
 MODULE_AUTHOR("Liam Girdwood");
 MODULE_DESCRIPTION("Sound Open Firmware (SOF) Core");
 MODULE_LICENSE("Dual BSD/GPL");
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] ASoC: SOF: sof-pci-dev: add .shutdown() callback
  2021-01-13 15:26 [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops Kai Vehmanen
  2021-01-13 15:26 ` [PATCH 2/4] ASoC: SOF: add snd_sof_device_shutdown() helper for shutdown Kai Vehmanen
@ 2021-01-13 15:26 ` Kai Vehmanen
  2021-01-13 15:26 ` [PATCH 4/4] ASoC: SOF: Intel: tgl: do thorough remove at " Kai Vehmanen
  2021-01-13 17:53 ` [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Kai Vehmanen @ 2021-01-13 15:26 UTC (permalink / raw)
  To: alsa-devel, broonie
  Cc: kai.vehmanen, Keyon Jie, lgirdwood, pierre-louis.bossart,
	ranjani.sridharan, daniel.baluta, Bard Liao

From: Keyon Jie <yang.jie@linux.intel.com>

Add the .shutdown() callback to the sof-pci-dev driver, to help to
handle shutting down specific tasks for SOF PCI platforms.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/soc/sof/sof-pci-dev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c
index 63b989e3ec40..5f53c3e76e6f 100644
--- a/sound/soc/sof/sof-pci-dev.c
+++ b/sound/soc/sof/sof-pci-dev.c
@@ -450,6 +450,11 @@ static void sof_pci_remove(struct pci_dev *pci)
 	pci_release_regions(pci);
 }
 
+static void sof_pci_shutdown(struct pci_dev *pci)
+{
+	snd_sof_device_shutdown(&pci->dev);
+}
+
 /* PCI IDs */
 static const struct pci_device_id sof_pci_ids[] = {
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_MERRIFIELD)
@@ -523,6 +528,7 @@ static struct pci_driver snd_sof_pci_driver = {
 	.id_table = sof_pci_ids,
 	.probe = sof_pci_probe,
 	.remove = sof_pci_remove,
+	.shutdown = sof_pci_shutdown,
 	.driver = {
 		.pm = &sof_pci_pm,
 	},
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] ASoC: SOF: Intel: tgl: do thorough remove at .shutdown() callback
  2021-01-13 15:26 [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops Kai Vehmanen
  2021-01-13 15:26 ` [PATCH 2/4] ASoC: SOF: add snd_sof_device_shutdown() helper for shutdown Kai Vehmanen
  2021-01-13 15:26 ` [PATCH 3/4] ASoC: SOF: sof-pci-dev: add .shutdown() callback Kai Vehmanen
@ 2021-01-13 15:26 ` Kai Vehmanen
  2021-01-13 17:53 ` [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Kai Vehmanen @ 2021-01-13 15:26 UTC (permalink / raw)
  To: alsa-devel, broonie
  Cc: kai.vehmanen, Keyon Jie, lgirdwood, pierre-louis.bossart,
	ranjani.sridharan, daniel.baluta, Bard Liao

From: Keyon Jie <yang.jie@linux.intel.com>

Invoke hda_dsp_remove() as the .shutdown() callback. This will help to
perform shutdown of the DSP safely on TGL platforms before shutting down
or rebooting the system.

BugLink: https://github.com/thesofproject/linux/issues/2571
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/soc/sof/intel/tgl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/intel/tgl.c b/sound/soc/sof/intel/tgl.c
index 2252ca38ff4b..419f05ba1920 100644
--- a/sound/soc/sof/intel/tgl.c
+++ b/sound/soc/sof/intel/tgl.c
@@ -22,9 +22,10 @@ static const struct snd_sof_debugfs_map tgl_dsp_debugfs[] = {
 
 /* Tigerlake ops */
 const struct snd_sof_dsp_ops sof_tgl_ops = {
-	/* probe and remove */
+	/* probe/remove/shutdown */
 	.probe		= hda_dsp_probe,
 	.remove		= hda_dsp_remove,
+	.shutdown	= hda_dsp_remove,
 
 	/* Register IO */
 	.write		= sof_io_write,
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops
  2021-01-13 15:26 [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops Kai Vehmanen
                   ` (2 preceding siblings ...)
  2021-01-13 15:26 ` [PATCH 4/4] ASoC: SOF: Intel: tgl: do thorough remove at " Kai Vehmanen
@ 2021-01-13 17:53 ` Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2021-01-13 17:53 UTC (permalink / raw)
  To: alsa-devel, Kai Vehmanen
  Cc: Keyon Jie, lgirdwood, pierre-louis.bossart, ranjani.sridharan,
	daniel.baluta, Bard Liao

On Wed, 13 Jan 2021 17:26:14 +0200, Kai Vehmanen wrote:
> Add .shutdown() callback to the struct snd_sof_dsp_ops, for
> doing platform specific actions at shutdown.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops
      commit: 7edb3051f11683640c38b93e183ef1676090a79b
[2/4] ASoC: SOF: add snd_sof_device_shutdown() helper for shutdown
      commit: daff7f1478e12cdee3e639c83c571cfd38bc5080
[3/4] ASoC: SOF: sof-pci-dev: add .shutdown() callback
      commit: 3475b44c7601d6f2b4d96e731047ef73fd2f1eb2
[4/4] ASoC: SOF: Intel: tgl: do thorough remove at .shutdown() callback
      commit: 44a4cfad8d78efcda9ec0dd97ceea38d8b602f24

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-13 17:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 15:26 [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops Kai Vehmanen
2021-01-13 15:26 ` [PATCH 2/4] ASoC: SOF: add snd_sof_device_shutdown() helper for shutdown Kai Vehmanen
2021-01-13 15:26 ` [PATCH 3/4] ASoC: SOF: sof-pci-dev: add .shutdown() callback Kai Vehmanen
2021-01-13 15:26 ` [PATCH 4/4] ASoC: SOF: Intel: tgl: do thorough remove at " Kai Vehmanen
2021-01-13 17:53 ` [PATCH 1/4] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).