drivers/media/platform/renesas/vsp1/vsp1_vspx.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/vsp1/vsp1_vspx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/vsp1/vsp1_vspx.c- Extension
.c- Size
- 17261 bytes
- Lines
- 635
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
vsp1_vspx.hlinux/cleanup.hlinux/container_of.hlinux/delay.hlinux/device.hlinux/dma-mapping.hlinux/export.hlinux/list.hlinux/slab.hlinux/spinlock.hmedia/media-entity.hmedia/v4l2-subdev.hmedia/vsp1.hvsp1_dl.hvsp1_iif.hvsp1_pipe.hvsp1_rwpf.h
Detected Declarations
struct vsp1_vspx_pipelinestruct vsp1_vspxfunction to_vsp1_vspx_pipelinefunction vsp1_vspx_rwpf_set_subdev_fmtfunction vsp1_vspx_pipeline_configurefunction vsp1_vspx_pipeline_frame_endfunction scoped_guardfunction APIfunction vsp1_isp_alloc_bufferfunction vsp1_isp_alloc_bufferfunction vsp1_isp_start_streamingfunction scoped_guardfunction scoped_guardfunction vsp1_isp_stop_streamingfunction scoped_guardfunction vsp1_isp_job_runfunction vsp1_isp_job_preparefunction scoped_guardfunction scoped_guardfunction vsp1_isp_job_preparefunction vsp1_vspx_initfunction vsp1_vspx_cleanupexport vsp1_isp_initexport vsp1_isp_get_bus_masterexport vsp1_isp_alloc_bufferexport vsp1_isp_free_bufferexport vsp1_isp_start_streamingexport vsp1_isp_stop_streamingexport vsp1_isp_job_prepareexport vsp1_isp_job_runexport vsp1_isp_job_release
Annotated Snippet
struct vsp1_vspx_pipeline {
struct vsp1_pipeline pipe;
struct vsp1_partition partition;
/*
* Protects the streaming start/stop sequences.
*
* The start/stop sequences cannot be locked with the 'lock' spinlock
* as they acquire mutexes when handling the pm runtime and the vsp1
* pipe start/stop operations. Provide a dedicated mutex for this
* reason.
*/
struct mutex mutex;
/*
* Protects the enable flag.
*
* The enabled flag is contended between the start/stop streaming
* routines and the job_run one, which cannot take a mutex as it is
* called from the ISP irq context.
*/
spinlock_t lock;
bool enabled;
void (*vspx_frame_end)(void *frame_end_data);
void *frame_end_data;
};
static inline struct vsp1_vspx_pipeline *
to_vsp1_vspx_pipeline(struct vsp1_pipeline *pipe)
{
return container_of(pipe, struct vsp1_vspx_pipeline, pipe);
}
/*
* struct vsp1_vspx - VSPX device
* @vsp1: the VSP1 device
* @pipe: the VSPX pipeline
*/
struct vsp1_vspx {
struct vsp1_device *vsp1;
struct vsp1_vspx_pipeline pipe;
};
/* Apply the given width, height and fourcc to the RWPF's subdevice */
static int vsp1_vspx_rwpf_set_subdev_fmt(struct vsp1_device *vsp1,
struct vsp1_rwpf *rwpf,
u32 isp_fourcc,
unsigned int width,
unsigned int height)
{
struct vsp1_entity *ent = &rwpf->entity;
struct v4l2_subdev_format format = {};
u32 vspx_fourcc;
switch (isp_fourcc) {
case V4L2_PIX_FMT_GREY:
/* 8 bit RAW Bayer image. */
vspx_fourcc = V4L2_PIX_FMT_RGB332;
break;
case V4L2_PIX_FMT_Y10:
case V4L2_PIX_FMT_Y12:
case V4L2_PIX_FMT_Y16:
/* 10, 12 and 16 bit RAW Bayer image. */
vspx_fourcc = V4L2_PIX_FMT_RGB565;
break;
case V4L2_META_FMT_GENERIC_8:
/* ConfigDMA parameters buffer. */
vspx_fourcc = V4L2_PIX_FMT_XBGR32;
break;
default:
return -EINVAL;
}
rwpf->fmtinfo = vsp1_get_format_info(vsp1, vspx_fourcc);
format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
format.pad = RWPF_PAD_SINK;
format.format.width = width;
format.format.height = height;
format.format.field = V4L2_FIELD_NONE;
format.format.code = rwpf->fmtinfo->mbus;
return v4l2_subdev_call(&ent->subdev, pad, set_fmt, NULL, &format);
}
/* Configure the RPF->IIF->WPF pipeline for ConfigDMA or RAW image transfer. */
static int vsp1_vspx_pipeline_configure(struct vsp1_device *vsp1,
dma_addr_t addr, u32 isp_fourcc,
unsigned int width, unsigned int height,
Annotation
- Immediate include surface: `vsp1_vspx.h`, `linux/cleanup.h`, `linux/container_of.h`, `linux/delay.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/export.h`, `linux/list.h`.
- Detected declarations: `struct vsp1_vspx_pipeline`, `struct vsp1_vspx`, `function to_vsp1_vspx_pipeline`, `function vsp1_vspx_rwpf_set_subdev_fmt`, `function vsp1_vspx_pipeline_configure`, `function vsp1_vspx_pipeline_frame_end`, `function scoped_guard`, `function API`, `function vsp1_isp_alloc_buffer`, `function vsp1_isp_alloc_buffer`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.