drivers/media/pci/mgb4/mgb4_dma.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/mgb4/mgb4_dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/mgb4/mgb4_dma.c- Extension
.c- Size
- 3061 bytes
- Lines
- 124
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/dma-direction.hmgb4_core.hmgb4_dma.h
Detected Declarations
function Copyrightfunction mgb4_dma_transferfunction mgb4_dma_channel_initfunction mgb4_dma_channel_free
Annotated Snippet
msecs_to_jiffies(10000))) {
dev_err(&pdev->dev, "dma timeout\n");
dmaengine_terminate_sync(chan->chan);
return -EIO;
}
return 0;
}
int mgb4_dma_channel_init(struct mgb4_dev *mgbdev)
{
int i, ret;
char name[16];
struct pci_dev *pdev = mgbdev->pdev;
for (i = 0; i < MGB4_VIN_DEVICES; i++) {
sprintf(name, "c2h%d", i);
mgbdev->c2h_chan[i].chan = dma_request_chan(&pdev->dev, name);
if (IS_ERR(mgbdev->c2h_chan[i].chan)) {
dev_err(&pdev->dev, "failed to initialize %s", name);
ret = PTR_ERR(mgbdev->c2h_chan[i].chan);
mgbdev->c2h_chan[i].chan = NULL;
return ret;
}
init_completion(&mgbdev->c2h_chan[i].req_compl);
}
for (i = 0; i < MGB4_VOUT_DEVICES; i++) {
sprintf(name, "h2c%d", i);
mgbdev->h2c_chan[i].chan = dma_request_chan(&pdev->dev, name);
if (IS_ERR(mgbdev->h2c_chan[i].chan)) {
dev_err(&pdev->dev, "failed to initialize %s", name);
ret = PTR_ERR(mgbdev->h2c_chan[i].chan);
mgbdev->h2c_chan[i].chan = NULL;
return ret;
}
init_completion(&mgbdev->h2c_chan[i].req_compl);
}
return 0;
}
void mgb4_dma_channel_free(struct mgb4_dev *mgbdev)
{
int i;
for (i = 0; i < MGB4_VIN_DEVICES; i++) {
if (mgbdev->c2h_chan[i].chan)
dma_release_channel(mgbdev->c2h_chan[i].chan);
}
for (i = 0; i < MGB4_VOUT_DEVICES; i++) {
if (mgbdev->h2c_chan[i].chan)
dma_release_channel(mgbdev->h2c_chan[i].chan);
}
}
Annotation
- Immediate include surface: `linux/pci.h`, `linux/dma-direction.h`, `mgb4_core.h`, `mgb4_dma.h`.
- Detected declarations: `function Copyright`, `function mgb4_dma_transfer`, `function mgb4_dma_channel_init`, `function mgb4_dma_channel_free`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.