drivers/media/platform/renesas/vsp1/vsp1_drv.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/vsp1/vsp1_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/vsp1/vsp1_drv.c- Extension
.c- Size
- 25410 bytes
- Lines
- 1059
- 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.
- 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/delay.hlinux/device.hlinux/interrupt.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset.hlinux/videodev2.hmedia/rcar-fcp.hmedia/v4l2-subdev.hvsp1.hvsp1_brx.hvsp1_clu.hvsp1_dl.hvsp1_drm.hvsp1_hgo.hvsp1_hgt.hvsp1_hsit.hvsp1_iif.hvsp1_lif.hvsp1_lut.hvsp1_pipe.hvsp1_regs.hvsp1_rwpf.hvsp1_sru.hvsp1_uds.hvsp1_uif.hvsp1_video.hvsp1_vspx.h
Detected Declarations
function Copyrightfunction vsp1_create_sink_linksfunction list_for_each_entryfunction vsp1_uapi_create_linksfunction list_for_each_entryfunction vsp1_destroy_entitiesfunction list_for_each_entry_safefunction list_for_each_entry_safefunction vsp1_create_entitiesfunction vsp1_reset_wpffunction vsp1_device_initfunction vsp1_mask_all_interruptsfunction vsp1_device_getfunction vsp1_device_putfunction vsp1_pm_suspendfunction vsp1_pm_resumefunction vsp1_pm_runtime_suspendfunction vsp1_pm_runtime_resumefunction vsp1_probefunction vsp1_remove
Annotated Snippet
if ((status & VI6_WPF_IRQ_STA_UND) && wpf->entity.pipe) {
wpf->entity.pipe->underrun_count++;
dev_warn_ratelimited(vsp1->dev,
"Underrun occurred at WPF%u (total underruns %u)\n",
i, wpf->entity.pipe->underrun_count);
}
if (status & VI6_WPF_IRQ_STA_DFE) {
vsp1_pipeline_frame_end(wpf->entity.pipe);
ret = IRQ_HANDLED;
}
}
return ret;
}
/* -----------------------------------------------------------------------------
* Entities
*/
/*
* vsp1_create_sink_links - Create links from all sources to the given sink
*
* This function creates media links from all valid sources to the given sink
* pad. Links that would be invalid according to the VSP1 hardware capabilities
* are skipped. Those include all links
*
* - from a UDS to a UDS (UDS entities can't be chained)
* - from an entity to itself (no loops are allowed)
*
* Furthermore, the BRS can't be connected to histogram generators, but no
* special check is currently needed as all VSP instances that include a BRS
* have no histogram generator.
*/
static int vsp1_create_sink_links(struct vsp1_device *vsp1,
struct vsp1_entity *sink)
{
struct media_entity *entity = &sink->subdev.entity;
struct vsp1_entity *source;
unsigned int pad;
int ret;
list_for_each_entry(source, &vsp1->entities, list_dev) {
u32 flags;
if (source->type == sink->type)
continue;
if (source->type == VSP1_ENTITY_HGO ||
source->type == VSP1_ENTITY_HGT ||
source->type == VSP1_ENTITY_LIF ||
source->type == VSP1_ENTITY_WPF)
continue;
flags = source->type == VSP1_ENTITY_RPF &&
sink->type == VSP1_ENTITY_WPF &&
source->index == sink->index
? MEDIA_LNK_FL_ENABLED : 0;
for (pad = 0; pad < entity->num_pads; ++pad) {
if (!(entity->pads[pad].flags & MEDIA_PAD_FL_SINK))
continue;
ret = media_create_pad_link(&source->subdev.entity,
source->source_pad,
entity, pad, flags);
if (ret < 0)
return ret;
if (flags & MEDIA_LNK_FL_ENABLED)
source->sink = sink;
}
}
return 0;
}
static int vsp1_uapi_create_links(struct vsp1_device *vsp1)
{
struct vsp1_entity *entity;
unsigned int i;
int ret;
list_for_each_entry(entity, &vsp1->entities, list_dev) {
if (entity->type == VSP1_ENTITY_LIF ||
entity->type == VSP1_ENTITY_RPF)
continue;
ret = vsp1_create_sink_links(vsp1, entity);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/interrupt.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pm_runtime.h`.
- Detected declarations: `function Copyright`, `function vsp1_create_sink_links`, `function list_for_each_entry`, `function vsp1_uapi_create_links`, `function list_for_each_entry`, `function vsp1_destroy_entities`, `function list_for_each_entry_safe`, `function list_for_each_entry_safe`, `function vsp1_create_entities`, `function vsp1_reset_wpf`.
- 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.