sound/soc/fsl/imx-audmux.c
Source file repositories/reference/linux-study-clean/sound/soc/fsl/imx-audmux.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/fsl/imx-audmux.c- Extension
.c- Size
- 8654 bytes
- Lines
- 381
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/clk.hlinux/debugfs.hlinux/err.hlinux/io.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/slab.himx-audmux.h
Detected Declarations
function audmux_read_filefunction audmux_debugfs_initfunction audmux_debugfs_removefunction audmux_debugfs_initfunction imx_audmux_v1_configure_portfunction imx_audmux_v2_configure_portfunction imx_audmux_parse_dt_defaultsfunction for_each_available_child_of_nodefunction imx_audmux_probefunction imx_audmux_removefunction imx_audmux_suspendfunction imx_audmux_resumefunction imx_audmux_initfunction imx_audmux_exitmodule init imx_audmux_initexport imx_audmux_v1_configure_portexport imx_audmux_v2_configure_port
Annotated Snippet
static const struct file_operations audmux_debugfs_fops = {
.open = simple_open,
.read = audmux_read_file,
.llseek = default_llseek,
};
static void audmux_debugfs_init(void)
{
uintptr_t i;
char buf[20];
audmux_debugfs_root = debugfs_create_dir("audmux", NULL);
for (i = 0; i < MX31_AUDMUX_PORT7_SSI_PINS_7 + 1; i++) {
snprintf(buf, sizeof(buf), "ssi%lu", i);
debugfs_create_file(buf, 0444, audmux_debugfs_root,
(void *)i, &audmux_debugfs_fops);
}
}
static void audmux_debugfs_remove(void)
{
debugfs_remove_recursive(audmux_debugfs_root);
}
#else
static inline void audmux_debugfs_init(void)
{
}
static inline void audmux_debugfs_remove(void)
{
}
#endif
static enum imx_audmux_type {
IMX21_AUDMUX,
IMX31_AUDMUX,
} audmux_type;
static const struct of_device_id imx_audmux_dt_ids[] = {
{ .compatible = "fsl,imx21-audmux", .data = (void *)IMX21_AUDMUX, },
{ .compatible = "fsl,imx31-audmux", .data = (void *)IMX31_AUDMUX, },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, imx_audmux_dt_ids);
static const uint8_t port_mapping[] = {
0x0, 0x4, 0x8, 0x10, 0x14, 0x1c,
};
int imx_audmux_v1_configure_port(unsigned int port, unsigned int pcr)
{
if (audmux_type != IMX21_AUDMUX)
return -EINVAL;
if (!audmux_base)
return -ENOSYS;
if (port >= ARRAY_SIZE(port_mapping))
return -EINVAL;
writel(pcr, audmux_base + port_mapping[port]);
return 0;
}
EXPORT_SYMBOL_GPL(imx_audmux_v1_configure_port);
int imx_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
unsigned int pdcr)
{
int ret;
if (audmux_type != IMX31_AUDMUX)
return -EINVAL;
if (!audmux_base)
return -ENOSYS;
ret = clk_prepare_enable(audmux_clk);
if (ret)
return ret;
writel(ptcr, audmux_base + IMX_AUDMUX_V2_PTCR(port));
writel(pdcr, audmux_base + IMX_AUDMUX_V2_PDCR(port));
clk_disable_unprepare(audmux_clk);
return 0;
}
EXPORT_SYMBOL_GPL(imx_audmux_v2_configure_port);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/debugfs.h`, `linux/err.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/slab.h`.
- Detected declarations: `function audmux_read_file`, `function audmux_debugfs_init`, `function audmux_debugfs_remove`, `function audmux_debugfs_init`, `function imx_audmux_v1_configure_port`, `function imx_audmux_v2_configure_port`, `function imx_audmux_parse_dt_defaults`, `function for_each_available_child_of_node`, `function imx_audmux_probe`, `function imx_audmux_remove`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: pattern 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.