sound/soc/sof/sof-client.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/sof-client.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/sof-client.c- Extension
.c- Size
- 17775 bytes
- Lines
- 658
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/errno.hlinux/list.hlinux/module.hlinux/mutex.hlinux/slab.hsound/sof/ipc4/header.hops.hsof-client.hsof-priv.hipc3-priv.hipc4-priv.h
Detected Declarations
struct sof_ipc_event_entrystruct sof_state_event_entrystruct sof_client_dev_entryfunction sof_client_auxdev_releasefunction sof_client_dev_add_datafunction sof_register_ipc_flood_testfunction sof_unregister_ipc_flood_testfunction sof_register_ipc_flood_testfunction sof_unregister_ipc_flood_testfunction sof_unregister_ipc_msg_injectorfunction sof_register_ipc_msg_injectorfunction sof_unregister_ipc_msg_injectorfunction sof_unregister_ipc_kernel_injectorfunction sof_register_ipc_kernel_injectorfunction sof_unregister_ipc_kernel_injectorfunction sof_unregister_clientsfunction sof_client_dev_registerfunction sof_client_dev_unregisterfunction sof_client_auxdev_releasefunction sof_client_ipc_tx_messagefunction sof_client_ipc_rx_messagefunction sof_client_ipc_set_get_datafunction sof_suspend_clientsfunction list_for_each_entryfunction sof_resume_clientsfunction list_for_each_entryfunction sof_client_get_ipc_max_payload_sizefunction sof_client_get_ipc_typefunction sof_client_boot_dspfunction sof_client_core_module_getfunction sof_client_core_module_putfunction sof_client_ipc_rx_dispatcherfunction sof_client_register_ipc_rx_handlerfunction sof_client_unregister_ipc_rx_handlerfunction list_for_each_entryfunction sof_client_fw_state_dispatcherfunction sof_client_register_fw_state_handlerfunction sof_client_unregister_fw_state_handlerfunction list_for_each_entryfunction sof_client_get_fw_state
Annotated Snippet
struct sof_ipc_event_entry {
u32 ipc_msg_type;
struct sof_client_dev *cdev;
sof_client_event_callback callback;
struct list_head list;
};
/**
* struct sof_state_event_entry - DSP panic event subscription entry
* @cdev: sof_client_dev of the requesting client
* @callback: Callback function of the client
* @list: item in SOF core client event list
*/
struct sof_state_event_entry {
struct sof_client_dev *cdev;
sof_client_fw_state_callback callback;
struct list_head list;
};
/**
* struct sof_client_dev_entry - client device entry for internal management use
* @sdev: pointer to SOF core device struct
* @list: item in SOF core client dev list
* @client_dev: SOF client device
*/
struct sof_client_dev_entry {
struct snd_sof_dev *sdev;
struct list_head list;
struct sof_client_dev client_dev;
};
#define cdev_to_centry(cdev) \
container_of(cdev, struct sof_client_dev_entry, client_dev)
static void sof_client_auxdev_release(struct device *dev)
{
struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
struct sof_client_dev *cdev = auxiliary_dev_to_sof_client_dev(auxdev);
struct sof_client_dev_entry *centry = cdev_to_centry(cdev);
kfree(cdev->auxdev.dev.platform_data);
kfree(centry);
}
static int sof_client_dev_add_data(struct sof_client_dev *cdev, const void *data,
size_t size)
{
void *d = NULL;
if (data) {
d = kmemdup(data, size, GFP_KERNEL);
if (!d)
return -ENOMEM;
}
cdev->auxdev.dev.platform_data = d;
return 0;
}
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST)
static int sof_register_ipc_flood_test(struct snd_sof_dev *sdev)
{
int ret = 0;
int i;
if (sdev->pdata->ipc_type != SOF_IPC_TYPE_3)
return 0;
for (i = 0; i < CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_NUM; i++) {
ret = sof_client_dev_register(sdev, "ipc_flood", i, NULL, 0);
if (ret < 0)
break;
}
if (ret) {
for (; i >= 0; --i)
sof_client_dev_unregister(sdev, "ipc_flood", i);
}
return ret;
}
static void sof_unregister_ipc_flood_test(struct snd_sof_dev *sdev)
{
int i;
for (i = 0; i < CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_NUM; i++)
sof_client_dev_unregister(sdev, "ipc_flood", i);
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/errno.h`, `linux/list.h`, `linux/module.h`, `linux/mutex.h`, `linux/slab.h`, `sound/sof/ipc4/header.h`, `ops.h`.
- Detected declarations: `struct sof_ipc_event_entry`, `struct sof_state_event_entry`, `struct sof_client_dev_entry`, `function sof_client_auxdev_release`, `function sof_client_dev_add_data`, `function sof_register_ipc_flood_test`, `function sof_unregister_ipc_flood_test`, `function sof_register_ipc_flood_test`, `function sof_unregister_ipc_flood_test`, `function sof_unregister_ipc_msg_injector`.
- 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.