drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c- Extension
.c- Size
- 14245 bytes
- Lines
- 472
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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
media/v4l2-common.hmedia/v4l2-event.hmedia/v4l2-ioctl.hmedia/videobuf2-core.hmedia/videobuf2-vmalloc.hrkisp1-common.h
Detected Declarations
function Copyrightfunction rkisp1_stats_g_fmt_meta_capfunction rkisp1_stats_querycapfunction rkisp1_stats_vb2_queue_setupfunction rkisp1_stats_vb2_buf_queuefunction rkisp1_stats_vb2_buf_preparefunction rkisp1_stats_vb2_stop_streamingfunction rkisp1_stats_init_vb2_queuefunction rkisp1_stats_get_awb_meas_v10function rkisp1_stats_get_awb_meas_v12function rkisp1_stats_get_aec_meas_v10function rkisp1_stats_get_aec_meas_v12function rkisp1_stats_get_afc_measfunction rkisp1_stats_get_hst_meas_v10function rkisp1_stats_get_hst_meas_v12function rkisp1_stats_get_bls_measfunction rkisp1_stats_send_measurementfunction rkisp1_stats_isrfunction rkisp1_init_statsfunction rkisp1_stats_registerfunction rkisp1_stats_unregister
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Rockchip ISP1 Driver - Stats subdevice
*
* Copyright (C) 2017 Rockchip Electronics Co., Ltd.
*/
#include <media/v4l2-common.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-core.h>
#include <media/videobuf2-vmalloc.h> /* for ISP statistics */
#include "rkisp1-common.h"
#define RKISP1_STATS_DEV_NAME RKISP1_DRIVER_NAME "_stats"
#define RKISP1_ISP_STATS_REQ_BUFS_MIN 2
#define RKISP1_ISP_STATS_REQ_BUFS_MAX 8
static int rkisp1_stats_enum_fmt_meta_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
struct video_device *video = video_devdata(file);
struct rkisp1_stats *stats = video_get_drvdata(video);
if (f->index > 0 || f->type != video->queue->type)
return -EINVAL;
f->pixelformat = stats->vdev_fmt.fmt.meta.dataformat;
return 0;
}
static int rkisp1_stats_g_fmt_meta_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
struct video_device *video = video_devdata(file);
struct rkisp1_stats *stats = video_get_drvdata(video);
struct v4l2_meta_format *meta = &f->fmt.meta;
if (f->type != video->queue->type)
return -EINVAL;
memset(meta, 0, sizeof(*meta));
meta->dataformat = stats->vdev_fmt.fmt.meta.dataformat;
meta->buffersize = stats->vdev_fmt.fmt.meta.buffersize;
return 0;
}
static int rkisp1_stats_querycap(struct file *file,
void *priv, struct v4l2_capability *cap)
{
struct video_device *vdev = video_devdata(file);
strscpy(cap->driver, RKISP1_DRIVER_NAME, sizeof(cap->driver));
strscpy(cap->card, vdev->name, sizeof(cap->card));
strscpy(cap->bus_info, RKISP1_BUS_INFO, sizeof(cap->bus_info));
return 0;
}
/* ISP video device IOCTLs */
static const struct v4l2_ioctl_ops rkisp1_stats_ioctl = {
.vidioc_reqbufs = vb2_ioctl_reqbufs,
.vidioc_querybuf = vb2_ioctl_querybuf,
.vidioc_create_bufs = vb2_ioctl_create_bufs,
.vidioc_qbuf = vb2_ioctl_qbuf,
.vidioc_dqbuf = vb2_ioctl_dqbuf,
.vidioc_prepare_buf = vb2_ioctl_prepare_buf,
.vidioc_expbuf = vb2_ioctl_expbuf,
.vidioc_streamon = vb2_ioctl_streamon,
.vidioc_streamoff = vb2_ioctl_streamoff,
.vidioc_enum_fmt_meta_cap = rkisp1_stats_enum_fmt_meta_cap,
.vidioc_g_fmt_meta_cap = rkisp1_stats_g_fmt_meta_cap,
.vidioc_s_fmt_meta_cap = rkisp1_stats_g_fmt_meta_cap,
.vidioc_try_fmt_meta_cap = rkisp1_stats_g_fmt_meta_cap,
.vidioc_querycap = rkisp1_stats_querycap,
.vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
};
static const struct v4l2_file_operations rkisp1_stats_fops = {
.mmap = vb2_fop_mmap,
.unlocked_ioctl = video_ioctl2,
.poll = vb2_fop_poll,
.open = v4l2_fh_open,
.release = vb2_fop_release
};
Annotation
- Immediate include surface: `media/v4l2-common.h`, `media/v4l2-event.h`, `media/v4l2-ioctl.h`, `media/videobuf2-core.h`, `media/videobuf2-vmalloc.h`, `rkisp1-common.h`.
- Detected declarations: `function Copyright`, `function rkisp1_stats_g_fmt_meta_cap`, `function rkisp1_stats_querycap`, `function rkisp1_stats_vb2_queue_setup`, `function rkisp1_stats_vb2_buf_queue`, `function rkisp1_stats_vb2_buf_prepare`, `function rkisp1_stats_vb2_stop_streaming`, `function rkisp1_stats_init_vb2_queue`, `function rkisp1_stats_get_awb_meas_v10`, `function rkisp1_stats_get_awb_meas_v12`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.