sound/soc/sof/pm.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/pm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/pm.c- Extension
.c- Size
- 11077 bytes
- Lines
- 427
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hops.hsof-priv.hsof-audio.h
Detected Declarations
function snd_sof_dsp_power_targetfunction sof_cache_debugfsfunction list_for_each_entryfunction snd_sof_boot_dsp_firmwarefunction sof_resumefunction sof_suspendfunction snd_sof_dsp_power_down_notifyfunction snd_sof_runtime_suspendfunction snd_sof_runtime_idlefunction snd_sof_runtime_resumefunction snd_sof_resumefunction snd_sof_suspendfunction snd_sof_preparefunction snd_sof_completeexport snd_sof_boot_dsp_firmwareexport snd_sof_runtime_suspendexport snd_sof_runtime_idleexport snd_sof_runtime_resumeexport snd_sof_resumeexport snd_sof_suspendexport snd_sof_prepareexport snd_sof_complete
Annotated Snippet
if (ret < 0) {
dev_err(sdev->dev, "%s: failed to restore pipeline: %d\n",
__func__, ret);
goto setup_fail;
}
}
/* Notify clients not managed by pm framework about core resume */
sof_resume_clients(sdev);
/* notify DSP of system resume */
if (pm_ops && pm_ops->ctx_restore) {
ret = pm_ops->ctx_restore(sdev);
if (ret < 0)
dev_err(sdev->dev, "%s: ctx_restore IPC failed: %d\n",
__func__, ret);
}
setup_fail:
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE)
if (ret < 0) {
/*
* Debugfs cannot be read in runtime suspend, so cache
* the contents upon failure. This allows to capture
* possible DSP coredump information.
*/
sof_cache_debugfs(sdev);
}
#endif
return ret;
}
EXPORT_SYMBOL(snd_sof_boot_dsp_firmware);
static int sof_resume(struct device *dev, bool runtime_resume)
{
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
u32 old_state = sdev->dsp_power_state.state;
bool on_demand_boot;
int ret;
/* do nothing if dsp resume callbacks are not set */
if (!runtime_resume && !sof_ops(sdev)->resume)
return 0;
if (runtime_resume && !sof_ops(sdev)->runtime_resume)
return 0;
/* DSP was never successfully started, nothing to resume */
if (sdev->first_boot)
return 0;
/*
* if the runtime_resume flag is set, call the runtime_resume routine
* or else call the system resume routine
*/
if (runtime_resume)
ret = snd_sof_dsp_runtime_resume(sdev);
else
ret = snd_sof_dsp_resume(sdev);
if (ret < 0) {
dev_err(sdev->dev,
"error: failed to power up DSP after resume\n");
return ret;
}
if (sdev->dspless_mode_selected) {
sof_set_fw_state(sdev, SOF_DSPLESS_MODE);
return 0;
}
/*
* Nothing further to be done for platforms that support the low power
* D0 substate. Resume trace and return when resuming from
* low-power D0 substate
*/
if (!runtime_resume && sof_ops(sdev)->set_power_state &&
old_state == SOF_DSP_PM_D0) {
ret = sof_fw_trace_resume(sdev);
if (ret < 0)
/* non fatal */
dev_warn(sdev->dev,
"failed to enable trace after resume %d\n", ret);
return 0;
}
if (override_on_demand_boot > -1)
on_demand_boot = override_on_demand_boot ? true : false;
else
on_demand_boot = sdev->pdata->desc->on_demand_dsp_boot;
Annotation
- Immediate include surface: `linux/module.h`, `ops.h`, `sof-priv.h`, `sof-audio.h`.
- Detected declarations: `function snd_sof_dsp_power_target`, `function sof_cache_debugfs`, `function list_for_each_entry`, `function snd_sof_boot_dsp_firmware`, `function sof_resume`, `function sof_suspend`, `function snd_sof_dsp_power_down_notify`, `function snd_sof_runtime_suspend`, `function snd_sof_runtime_idle`, `function snd_sof_runtime_resume`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.