drivers/dma/lpc32xx-dmamux.c
Source file repositories/reference/linux-study-clean/drivers/dma/lpc32xx-dmamux.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/lpc32xx-dmamux.c- Extension
.c- Size
- 4915 bytes
- Lines
- 205
- Domain
- Driver Families
- Bucket
- drivers/dma
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/err.hlinux/init.hlinux/mfd/syscon.hlinux/of.hlinux/of_dma.hlinux/of_platform.hlinux/platform_device.hlinux/regmap.hlinux/spinlock.h
Detected Declarations
struct lpc32xx_dmamuxstruct lpc32xx_dmamux_datafunction lpc32xx_dmamux_releasefunction lpc32xx_dmamux_probefunction lpc32xx_dmamux_init
Annotated Snippet
struct lpc32xx_dmamux {
int signal;
char *name_sel0;
char *name_sel1;
int muxval;
int muxreg;
int bit;
bool busy;
};
struct lpc32xx_dmamux_data {
struct dma_router dmarouter;
struct regmap *reg;
spinlock_t lock; /* protects busy status flag */
};
/* From LPC32x0 User manual "3.2.1 DMA request signals" */
static struct lpc32xx_dmamux lpc32xx_muxes[] = {
{
.signal = 3,
.name_sel0 = "spi2-rx-tx",
.name_sel1 = "ssp1-rx",
.muxreg = LPC32XX_SSP_CLK_CTRL,
.bit = 5,
},
{
.signal = 10,
.name_sel0 = "uart7-rx",
.name_sel1 = "i2s1-dma1",
.muxreg = LPC32XX_I2S_CLK_CTRL,
.bit = 4,
},
{
.signal = 11,
.name_sel0 = "spi1-rx-tx",
.name_sel1 = "ssp1-tx",
.muxreg = LPC32XX_SSP_CLK_CTRL,
.bit = 4,
},
{
.signal = 14,
.name_sel0 = "none",
.name_sel1 = "ssp0-rx",
.muxreg = LPC32XX_SSP_CLK_CTRL,
.bit = 3,
},
{
.signal = 15,
.name_sel0 = "none",
.name_sel1 = "ssp0-tx",
.muxreg = LPC32XX_SSP_CLK_CTRL,
.bit = 2,
},
};
static void lpc32xx_dmamux_release(struct device *dev, void *route_data)
{
struct lpc32xx_dmamux_data *dmamux = dev_get_drvdata(dev);
struct lpc32xx_dmamux *mux = route_data;
dev_dbg(dev, "releasing dma request signal %d routed to %s\n",
mux->signal, mux->muxval ? mux->name_sel1 : mux->name_sel1);
guard(spinlock)(&dmamux->lock);
mux->busy = false;
}
static void *lpc32xx_dmamux_reserve(struct of_phandle_args *dma_spec,
struct of_dma *ofdma)
{
struct platform_device *pdev = of_find_device_by_node(ofdma->of_node);
struct device *dev = &pdev->dev;
struct lpc32xx_dmamux_data *dmamux = platform_get_drvdata(pdev);
unsigned long flags;
struct lpc32xx_dmamux *mux = NULL;
int ret = -EINVAL;
int i;
if (dma_spec->args_count != 3) {
dev_err(&pdev->dev, "invalid number of dma mux args\n");
goto err_put_pdev;
}
for (i = 0; i < ARRAY_SIZE(lpc32xx_muxes); i++) {
if (lpc32xx_muxes[i].signal == dma_spec->args[0]) {
mux = &lpc32xx_muxes[i];
break;
}
}
Annotation
- Immediate include surface: `linux/err.h`, `linux/init.h`, `linux/mfd/syscon.h`, `linux/of.h`, `linux/of_dma.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/regmap.h`.
- Detected declarations: `struct lpc32xx_dmamux`, `struct lpc32xx_dmamux_data`, `function lpc32xx_dmamux_release`, `function lpc32xx_dmamux_probe`, `function lpc32xx_dmamux_init`.
- Atlas domain: Driver Families / drivers/dma.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.