drivers/media/platform/renesas/vsp1/vsp1_uif.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/vsp1/vsp1_uif.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/vsp1/vsp1_uif.c- Extension
.c- Size
- 6065 bytes
- Lines
- 230
- 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.
- 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/device.hlinux/gfp.hlinux/sys_soc.hmedia/media-entity.hmedia/v4l2-subdev.hvsp1.hvsp1_dl.hvsp1_entity.hvsp1_uif.h
Detected Declarations
function Copyrightfunction vsp1_uif_writefunction vsp1_uif_get_crcfunction uif_get_selectionfunction uif_set_selectionfunction uif_configure_stream
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* vsp1_uif.c -- R-Car VSP1 User Logic Interface
*
* Copyright (C) 2017-2018 Laurent Pinchart
*
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*/
#include <linux/device.h>
#include <linux/gfp.h>
#include <linux/sys_soc.h>
#include <media/media-entity.h>
#include <media/v4l2-subdev.h>
#include "vsp1.h"
#include "vsp1_dl.h"
#include "vsp1_entity.h"
#include "vsp1_uif.h"
#define UIF_MIN_SIZE 4U
#define UIF_MAX_SIZE 8190U
/* -----------------------------------------------------------------------------
* Device Access
*/
static inline u32 vsp1_uif_read(struct vsp1_uif *uif, u32 reg)
{
return vsp1_read(uif->entity.vsp1,
uif->entity.index * VI6_UIF_OFFSET + reg);
}
static inline void vsp1_uif_write(struct vsp1_uif *uif,
struct vsp1_dl_body *dlb, u32 reg, u32 data)
{
vsp1_dl_body_write(dlb, reg + uif->entity.index * VI6_UIF_OFFSET, data);
}
u32 vsp1_uif_get_crc(struct vsp1_uif *uif)
{
return vsp1_uif_read(uif, VI6_UIF_DISCOM_DOCMCCRCR);
}
/* -----------------------------------------------------------------------------
* V4L2 Subdevice Pad Operations
*/
static const unsigned int uif_codes[] = {
MEDIA_BUS_FMT_ARGB8888_1X32,
MEDIA_BUS_FMT_AHSV8888_1X32,
MEDIA_BUS_FMT_AYUV8_1X32,
};
static int uif_get_selection(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{
struct vsp1_uif *uif = to_uif(subdev);
struct v4l2_subdev_state *state;
struct v4l2_mbus_framefmt *format;
if (sel->pad != UIF_PAD_SINK)
return -EINVAL;
guard(mutex)(&uif->entity.lock);
state = vsp1_entity_get_state(&uif->entity, sd_state, sel->which);
if (!state)
return -EINVAL;
switch (sel->target) {
case V4L2_SEL_TGT_CROP_BOUNDS:
case V4L2_SEL_TGT_CROP_DEFAULT:
format = v4l2_subdev_state_get_format(state, UIF_PAD_SINK);
sel->r.left = 0;
sel->r.top = 0;
sel->r.width = format->width;
sel->r.height = format->height;
break;
case V4L2_SEL_TGT_CROP:
sel->r = *v4l2_subdev_state_get_crop(state, sel->pad);
break;
default:
return -EINVAL;
}
Annotation
- Immediate include surface: `linux/device.h`, `linux/gfp.h`, `linux/sys_soc.h`, `media/media-entity.h`, `media/v4l2-subdev.h`, `vsp1.h`, `vsp1_dl.h`, `vsp1_entity.h`.
- Detected declarations: `function Copyright`, `function vsp1_uif_write`, `function vsp1_uif_get_crc`, `function uif_get_selection`, `function uif_set_selection`, `function uif_configure_stream`.
- 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.