sound/soc/ti/omap-mcbsp.c
Source file repositories/reference/linux-study-clean/sound/soc/ti/omap-mcbsp.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/ti/omap-mcbsp.c- Extension
.c- Size
- 38635 bytes
- Lines
- 1434
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/init.hlinux/module.hlinux/device.hlinux/pm_runtime.hlinux/of.hsound/core.hsound/pcm.hsound/pcm_params.hsound/initval.hsound/soc.hsound/dmaengine_pcm.homap-mcbsp-priv.homap-mcbsp.hsdma-pcm.h
Detected Declarations
function omap_mcbsp_dump_regfunction omap2_mcbsp_set_clks_srcfunction omap_mcbsp_irq_handlerfunction omap_mcbsp_tx_irq_handlerfunction omap_mcbsp_rx_irq_handlerfunction omap_mcbsp_startfunction omap_mcbsp_dma_reg_paramsfunction omap_mcbsp_set_tx_thresholdfunction omap_mcbsp_set_rx_thresholdfunction omap_mcbsp_get_tx_delayfunction valuefunction omap_mcbsp_requestfunction scoped_guardfunction scoped_guardfunction omap_mcbsp_freefunction scoped_guardfunction omap_mcbsp_startfunction omap_mcbsp_stopfunction dma_op_mode_showfunction dma_op_mode_storefunction omap_mcbsp_initfunction omap_mcbsp_set_thresholdfunction omap_mcbsp_hwrule_min_buffersizefunction omap_mcbsp_dai_startupfunction againfunction omap_mcbsp_dai_shutdownfunction omap_mcbsp_dai_preparefunction omap_mcbsp_dai_triggerfunction omap_mcbsp_dai_delayfunction omap_mcbsp_dai_hw_paramsfunction omap_mcbsp_dai_set_dai_fmtfunction omap_mcbsp_dai_set_clkdivfunction omap_mcbsp_dai_set_dai_sysclkfunction omap_mcbsp_probefunction omap_mcbsp_removefunction asoc_mcbsp_probefunction asoc_mcbsp_remove
Annotated Snippet
if (!mcbsp->free) {
dev_err(mcbsp->dev, "McBSP%d is currently in use\n", mcbsp->id);
return -EBUSY;
}
mcbsp->free = false;
mcbsp->reg_cache = reg_cache;
reg_cache = NULL;
}
if (mcbsp->pdata->ops && mcbsp->pdata->ops->request)
mcbsp->pdata->ops->request(mcbsp->id - 1);
/*
* Make sure that transmitter, receiver and sample-rate generator are
* not running before activating IRQs.
*/
MCBSP_WRITE(mcbsp, SPCR1, 0);
MCBSP_WRITE(mcbsp, SPCR2, 0);
if (mcbsp->irq) {
err = request_irq(mcbsp->irq, omap_mcbsp_irq_handler, 0,
"McBSP", (void *)mcbsp);
if (err != 0) {
dev_err(mcbsp->dev, "Unable to request IRQ\n");
}
} else {
err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler, 0,
"McBSP TX", (void *)mcbsp);
if (err != 0) {
dev_err(mcbsp->dev, "Unable to request TX IRQ\n");
} else {
err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler, 0,
"McBSP RX", (void *)mcbsp);
if (err != 0) {
dev_err(mcbsp->dev, "Unable to request RX IRQ\n");
free_irq(mcbsp->tx_irq, (void *)mcbsp);
}
}
}
if (err != 0) {
if (mcbsp->pdata->ops && mcbsp->pdata->ops->free)
mcbsp->pdata->ops->free(mcbsp->id - 1);
/* Disable wakeup behavior */
if (mcbsp->pdata->has_wakeup)
MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
scoped_guard(spinlock, &mcbsp->lock) {
reg_cache = mcbsp->reg_cache;
mcbsp->free = true;
mcbsp->reg_cache = NULL;
}
return err;
}
return 0;
}
static void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
{
void *reg_cache;
if(mcbsp->pdata->ops && mcbsp->pdata->ops->free)
mcbsp->pdata->ops->free(mcbsp->id - 1);
/* Disable wakeup behavior */
if (mcbsp->pdata->has_wakeup)
MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
/* Disable interrupt requests */
if (mcbsp->irq) {
MCBSP_WRITE(mcbsp, IRQEN, 0);
free_irq(mcbsp->irq, (void *)mcbsp);
} else {
free_irq(mcbsp->rx_irq, (void *)mcbsp);
free_irq(mcbsp->tx_irq, (void *)mcbsp);
}
reg_cache = mcbsp->reg_cache;
/*
* Select CLKS source from internal source unconditionally before
* marking the McBSP port as free.
* If the external clock source via MCBSP_CLKS pin has been selected the
* system will refuse to enter idle if the CLKS pin source is not reset
* back to internal source.
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/device.h`, `linux/pm_runtime.h`, `linux/of.h`, `sound/core.h`, `sound/pcm.h`, `sound/pcm_params.h`.
- Detected declarations: `function omap_mcbsp_dump_reg`, `function omap2_mcbsp_set_clks_src`, `function omap_mcbsp_irq_handler`, `function omap_mcbsp_tx_irq_handler`, `function omap_mcbsp_rx_irq_handler`, `function omap_mcbsp_start`, `function omap_mcbsp_dma_reg_params`, `function omap_mcbsp_set_tx_threshold`, `function omap_mcbsp_set_rx_threshold`, `function omap_mcbsp_get_tx_delay`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.