sound/soc/sof/imx/imx-common.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/imx/imx-common.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/imx/imx-common.c- Extension
.c- Size
- 12316 bytes
- Lines
- 481
- 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/firmware/imx/dsp.hlinux/module.hlinux/of_address.hlinux/of_reserved_mem.hlinux/pm_domain.hsound/sof/xtensa.h../ops.himx-common.h
Detected Declarations
function imx8_get_registersfunction imx8_dumpfunction imx_handle_replyfunction imx_handle_requestfunction imx_send_msgfunction imx_get_bar_indexfunction imx_get_mailbox_offsetfunction imx_get_window_offsetfunction imx_set_power_statefunction imx_common_resumefunction imx_common_suspendfunction imx_runtime_resumefunction imx_resumefunction imx_runtime_suspendfunction imx_suspendfunction imx_region_name_to_blk_typefunction imx_parse_ioremap_memoryfunction imx_unregister_actionfunction imx_probefunction imx_removeexport imx8_dumpexport sof_imx_ops
Annotated Snippet
if ((panic_code & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) {
snd_sof_dsp_panic(sdev, panic_code, true);
return;
}
}
snd_sof_ipc_msgs_rx(sdev);
}
static struct imx_dsp_ops imx_ipc_ops = {
.handle_reply = imx_handle_reply,
.handle_request = imx_handle_request,
};
static int imx_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
{
struct imx_common_data *common = sdev->pdata->hw_pdata;
sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, msg->msg_size);
imx_dsp_ring_doorbell(common->ipc_handle, 0x0);
return 0;
}
static int imx_get_bar_index(struct snd_sof_dev *sdev, u32 type)
{
switch (type) {
case SOF_FW_BLK_TYPE_IRAM:
case SOF_FW_BLK_TYPE_SRAM:
return type;
default:
return -EINVAL;
}
}
static int imx_get_mailbox_offset(struct snd_sof_dev *sdev)
{
return get_chip_info(sdev)->ipc_info.boot_mbox_offset;
}
static int imx_get_window_offset(struct snd_sof_dev *sdev, u32 id)
{
return get_chip_info(sdev)->ipc_info.window_offset;
}
static int imx_set_power_state(struct snd_sof_dev *sdev,
const struct sof_dsp_power_state *target)
{
sdev->dsp_power_state = *target;
return 0;
}
static int imx_common_resume(struct snd_sof_dev *sdev)
{
struct imx_common_data *common;
int ret, i;
common = sdev->pdata->hw_pdata;
ret = clk_bulk_prepare_enable(common->clk_num, common->clks);
if (ret)
dev_err(sdev->dev, "failed to enable clocks: %d\n", ret);
for (i = 0; i < DSP_MU_CHAN_NUM; i++)
imx_dsp_request_channel(common->ipc_handle, i);
/* done. If need be, core will be started by SOF core immediately after */
return 0;
}
static int imx_common_suspend(struct snd_sof_dev *sdev)
{
struct imx_common_data *common;
int i, ret;
common = sdev->pdata->hw_pdata;
ret = imx_chip_core_shutdown(sdev);
if (ret < 0) {
dev_err(sdev->dev, "failed to shutdown core: %d\n", ret);
return ret;
}
for (i = 0; i < DSP_MU_CHAN_NUM; i++)
imx_dsp_free_channel(common->ipc_handle, i);
clk_bulk_disable_unprepare(common->clk_num, common->clks);
return 0;
Annotation
- Immediate include surface: `linux/firmware/imx/dsp.h`, `linux/module.h`, `linux/of_address.h`, `linux/of_reserved_mem.h`, `linux/pm_domain.h`, `sound/sof/xtensa.h`, `../ops.h`, `imx-common.h`.
- Detected declarations: `function imx8_get_registers`, `function imx8_dump`, `function imx_handle_reply`, `function imx_handle_request`, `function imx_send_msg`, `function imx_get_bar_index`, `function imx_get_mailbox_offset`, `function imx_get_window_offset`, `function imx_set_power_state`, `function imx_common_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.