drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.c- Extension
.c- Size
- 3256 bytes
- Lines
- 122
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
s5p_mfc_debug.hs5p_mfc_opr.hs5p_mfc_opr_v5.hs5p_mfc_opr_v6.h
Detected Declarations
function MFCfunction s5p_mfc_init_regsfunction s5p_mfc_alloc_priv_buffunction s5p_mfc_alloc_generic_buffunction s5p_mfc_release_priv_buffunction s5p_mfc_release_generic_buf
Annotated Snippet
if (b->dma < base) {
mfc_err("Invalid memory configuration - buffer (%pad) is below base memory address(%pad)\n",
&b->dma, &base);
dma_free_coherent(mem_dev, b->size, b->virt, b->dma);
return -ENOMEM;
}
}
mfc_debug(3, "Allocated addr %p %pad\n", b->virt, &b->dma);
return 0;
no_mem:
mfc_err("Allocating private buffer of size %zu failed\n", b->size);
return -ENOMEM;
}
int s5p_mfc_alloc_generic_buf(struct s5p_mfc_dev *dev, unsigned int mem_ctx,
struct s5p_mfc_priv_buf *b)
{
struct device *mem_dev = dev->mem_dev[mem_ctx];
mfc_debug(3, "Allocating generic buf: %zu\n", b->size);
b->ctx = mem_ctx;
b->virt = dma_alloc_coherent(mem_dev, b->size, &b->dma, GFP_KERNEL);
if (!b->virt)
goto no_mem;
mfc_debug(3, "Allocated addr %p %pad\n", b->virt, &b->dma);
return 0;
no_mem:
mfc_err("Allocating generic buffer of size %zu failed\n", b->size);
return -ENOMEM;
}
void s5p_mfc_release_priv_buf(struct s5p_mfc_dev *dev,
struct s5p_mfc_priv_buf *b)
{
if (dev->mem_virt) {
unsigned int start = (b->dma - dev->mem_base) >> PAGE_SHIFT;
unsigned int count = b->size >> PAGE_SHIFT;
bitmap_clear(dev->mem_bitmap, start, count);
} else {
struct device *mem_dev = dev->mem_dev[b->ctx];
dma_free_coherent(mem_dev, b->size, b->virt, b->dma);
}
b->virt = NULL;
b->dma = 0;
b->size = 0;
}
void s5p_mfc_release_generic_buf(struct s5p_mfc_dev *dev,
struct s5p_mfc_priv_buf *b)
{
struct device *mem_dev = dev->mem_dev[b->ctx];
dma_free_coherent(mem_dev, b->size, b->virt, b->dma);
b->virt = NULL;
b->dma = 0;
b->size = 0;
}
Annotation
- Immediate include surface: `s5p_mfc_debug.h`, `s5p_mfc_opr.h`, `s5p_mfc_opr_v5.h`, `s5p_mfc_opr_v6.h`.
- Detected declarations: `function MFC`, `function s5p_mfc_init_regs`, `function s5p_mfc_alloc_priv_buf`, `function s5p_mfc_alloc_generic_buf`, `function s5p_mfc_release_priv_buf`, `function s5p_mfc_release_generic_buf`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- 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.