sound/soc/sof/ops.h
Source file repositories/reference/linux-study-clean/sound/soc/sof/ops.h
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/ops.h- Extension
.h- Size
- 17135 bytes
- Lines
- 660
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/interrupt.hlinux/kernel.hlinux/types.hsound/pcm.hsof-priv.h
Detected Declarations
function Copyrightfunction sof_ops_freefunction snd_sof_probe_earlyfunction snd_sof_probefunction snd_sof_removefunction snd_sof_remove_latefunction snd_sof_shutdownfunction snd_sof_dsp_runfunction snd_sof_dsp_stallfunction snd_sof_dsp_resetfunction snd_sof_dsp_core_getfunction snd_sof_dsp_core_putfunction snd_sof_dsp_pre_fw_runfunction snd_sof_dsp_post_fw_runfunction snd_sof_dsp_parse_platform_ext_manifestfunction indexfunction snd_sof_dsp_get_mailbox_offsetfunction snd_sof_dsp_get_window_offsetfunction snd_sof_dsp_resumefunction snd_sof_dsp_suspendfunction snd_sof_dsp_runtime_resumefunction snd_sof_dsp_runtime_suspendfunction snd_sof_dsp_runtime_idlefunction snd_sof_dsp_hw_params_upon_resumefunction snd_sof_dsp_set_clkfunction snd_sof_dsp_set_power_statefunction snd_sof_debugfs_add_region_itemfunction snd_sof_dsp_write8function snd_sof_dsp_writefunction snd_sof_dsp_write64function snd_sof_dsp_read8function snd_sof_dsp_readfunction snd_sof_dsp_read64function snd_sof_dsp_update8function snd_sof_dsp_block_readfunction snd_sof_dsp_block_writefunction snd_sof_dsp_mailbox_readfunction snd_sof_dsp_mailbox_writefunction snd_sof_dsp_send_msgfunction snd_sof_pcm_platform_openfunction snd_sof_pcm_platform_closefunction snd_sof_pcm_platform_hw_paramsfunction snd_sof_pcm_platform_hw_freefunction snd_sof_pcm_platform_triggerfunction snd_sof_load_firmwarefunction snd_sof_ipc_msg_datafunction snd_sof_set_stream_data_offsetfunction snd_sof_pcm_platform_pointer
Annotated Snippet
if (sdev->dsp_core_ref_count[core] > 0) {
sdev->dsp_core_ref_count[core]++;
return 0;
}
/* power up the core */
ret = sof_ops(sdev)->core_get(sdev, core);
if (ret < 0)
return ret;
/* increment ref_count */
sdev->dsp_core_ref_count[core]++;
/* and update enabled_cores_mask */
sdev->enabled_cores_mask |= BIT(core);
dev_dbg(sdev->dev, "Core %d powered up\n", core);
}
return 0;
}
static inline int snd_sof_dsp_core_put(struct snd_sof_dev *sdev, int core)
{
if (core > sdev->num_cores - 1) {
dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core,
sdev->num_cores);
return -EINVAL;
}
if (sof_ops(sdev)->core_put) {
int ret;
/* decrement ref_count and return if it is > 0 */
if (--(sdev->dsp_core_ref_count[core]) > 0)
return 0;
/* power down the core */
ret = sof_ops(sdev)->core_put(sdev, core);
if (ret < 0)
return ret;
/* and update enabled_cores_mask */
sdev->enabled_cores_mask &= ~BIT(core);
dev_dbg(sdev->dev, "Core %d powered down\n", core);
}
return 0;
}
/* pre/post fw load */
static inline int snd_sof_dsp_pre_fw_run(struct snd_sof_dev *sdev)
{
if (sof_ops(sdev)->pre_fw_run)
return sof_ops(sdev)->pre_fw_run(sdev);
return 0;
}
static inline int snd_sof_dsp_post_fw_run(struct snd_sof_dev *sdev)
{
if (sof_ops(sdev)->post_fw_run)
return sof_ops(sdev)->post_fw_run(sdev);
return 0;
}
/* parse platform specific extended manifest */
static inline int snd_sof_dsp_parse_platform_ext_manifest(struct snd_sof_dev *sdev,
const struct sof_ext_man_elem_header *hdr)
{
if (sof_ops(sdev)->parse_platform_ext_manifest)
return sof_ops(sdev)->parse_platform_ext_manifest(sdev, hdr);
return 0;
}
/* misc */
/**
* snd_sof_dsp_get_bar_index - Maps a section type with a BAR index
*
* @sdev: sof device
* @type: section type as described by snd_sof_fw_blk_type
*
* Returns the corresponding BAR index (a positive integer) or -EINVAL
* in case there is no mapping
*/
static inline int snd_sof_dsp_get_bar_index(struct snd_sof_dev *sdev, u32 type)
Annotation
- Immediate include surface: `linux/device.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/types.h`, `sound/pcm.h`, `sof-priv.h`.
- Detected declarations: `function Copyright`, `function sof_ops_free`, `function snd_sof_probe_early`, `function snd_sof_probe`, `function snd_sof_remove`, `function snd_sof_remove_late`, `function snd_sof_shutdown`, `function snd_sof_dsp_run`, `function snd_sof_dsp_stall`, `function snd_sof_dsp_reset`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.