Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sound/soc/sof/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PCI driver shutdown has "void" return type, so we can't return an error to upper layer. But, but, I think it's ok to keep the "int" and return type, and keep this aligned with rest of SOF ops API.

{
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");
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/sof/intel/tgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In commit, "Fixes:" is only used when pointing to commit hashes. To refer to a bug URL, please use "BugLink: " instead.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kv2019i since we are here and I know on i.MX there might be similar issues, do you know how the HIFI DSP is reset / power on / power off on Intel platforms?
Does the BIOS takes care of this. Or DSP by itself can initiate the rest/power off procedure?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbaluta Actual power-on is triggered via PCI MMIO writes, see hda-dsp.c:hda_dsp_core_power_down() in kernel. On DSP side, there is a sequence to ramp down resources and got a loop executing waiti, see for example platform_pm_runtime_power_off().

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kv2019i fixes is a github construct, it should be used in PR description to help autoclose related bugs if possible. But yes i agree not in the commit message.

.remove = hda_dsp_remove,
.shutdown = hda_dsp_remove,

/* Register IO */
.write = sof_io_write,
Expand Down
8 changes: 8 additions & 0 deletions sound/soc/sof/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ static inline int snd_sof_remove(struct snd_sof_dev *sdev)
return 0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In commit: "platform specific shutdown stuff" -> "platform specific actions at shutdown"

}

static inline int snd_sof_shutdown(struct snd_sof_dev *sdev)
Comment thread
ranj063 marked this conversation as resolved.
Resolved
{
if (sof_ops(sdev)->shutdown)
return sof_ops(sdev)->shutdown(sdev);

return 0;
}

/* control */

/*
Expand Down
6 changes: 6 additions & 0 deletions sound/soc/sof/sof-pci-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
},
Expand Down
4 changes: 3 additions & 1 deletion sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down