drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c- Extension
.c- Size
- 29706 bytes
- Lines
- 1101
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/of.hlinux/regmap.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-ioctl.hmedia/v4l2-mc.hmedia/videobuf2-dma-contig.hmedia/videobuf2-v4l2.hsun6i_csi.hsun6i_csi_bridge.hsun6i_csi_capture.hsun6i_csi_reg.h
Detected Declarations
function Copyrightfunction sun6i_csi_capture_formatfunction sun6i_csi_capture_format_matchfunction sun6i_csi_capture_buffer_configurefunction sun6i_csi_capture_configurefunction sun6i_csi_capture_state_cleanupfunction list_for_each_entryfunction sun6i_csi_capture_state_updatefunction sun6i_csi_capture_state_completefunction sun6i_csi_capture_frame_donefunction sun6i_csi_capture_syncfunction sun6i_csi_capture_queue_setupfunction sun6i_csi_capture_buffer_preparefunction sun6i_csi_capture_buffer_queuefunction sun6i_csi_capture_start_streamingfunction sun6i_csi_capture_stop_streamingfunction sun6i_csi_capture_format_preparefunction sun6i_csi_capture_querycapfunction sun6i_csi_capture_enum_fmtfunction sun6i_csi_capture_g_fmtfunction sun6i_csi_capture_s_fmtfunction sun6i_csi_capture_try_fmtfunction sun6i_csi_capture_enum_inputfunction sun6i_csi_capture_g_inputfunction sun6i_csi_capture_s_inputfunction sun6i_csi_capture_openfunction sun6i_csi_capture_closefunction sun6i_csi_capture_link_validatefunction sun6i_csi_capture_setupfunction sun6i_csi_capture_cleanup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2011-2018 Magewell Electronics Co., Ltd. (Nanjing)
* Author: Yong Deng <yong.deng@magewell.com>
* Copyright 2021-2022 Bootlin
* Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
*/
#include <linux/of.h>
#include <linux/regmap.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mc.h>
#include <media/videobuf2-dma-contig.h>
#include <media/videobuf2-v4l2.h>
#include "sun6i_csi.h"
#include "sun6i_csi_bridge.h"
#include "sun6i_csi_capture.h"
#include "sun6i_csi_reg.h"
/* Helpers */
void sun6i_csi_capture_dimensions(struct sun6i_csi_device *csi_dev,
unsigned int *width, unsigned int *height)
{
if (width)
*width = csi_dev->capture.format.fmt.pix.width;
if (height)
*height = csi_dev->capture.format.fmt.pix.height;
}
void sun6i_csi_capture_format(struct sun6i_csi_device *csi_dev,
u32 *pixelformat, u32 *field)
{
if (pixelformat)
*pixelformat = csi_dev->capture.format.fmt.pix.pixelformat;
if (field)
*field = csi_dev->capture.format.fmt.pix.field;
}
/* Format */
static const struct sun6i_csi_capture_format sun6i_csi_capture_formats[] = {
/* Bayer */
{
.pixelformat = V4L2_PIX_FMT_SBGGR8,
.output_format_frame = SUN6I_CSI_OUTPUT_FMT_FRAME_RAW_8,
.output_format_field = SUN6I_CSI_OUTPUT_FMT_FIELD_RAW_8,
},
{
.pixelformat = V4L2_PIX_FMT_SGBRG8,
.output_format_frame = SUN6I_CSI_OUTPUT_FMT_FRAME_RAW_8,
.output_format_field = SUN6I_CSI_OUTPUT_FMT_FIELD_RAW_8,
},
{
.pixelformat = V4L2_PIX_FMT_SGRBG8,
.output_format_frame = SUN6I_CSI_OUTPUT_FMT_FRAME_RAW_8,
.output_format_field = SUN6I_CSI_OUTPUT_FMT_FIELD_RAW_8,
},
{
.pixelformat = V4L2_PIX_FMT_SRGGB8,
.output_format_frame = SUN6I_CSI_OUTPUT_FMT_FRAME_RAW_8,
.output_format_field = SUN6I_CSI_OUTPUT_FMT_FIELD_RAW_8,
},
{
.pixelformat = V4L2_PIX_FMT_SBGGR10,
.output_format_frame = SUN6I_CSI_OUTPUT_FMT_FRAME_RAW_10,
.output_format_field = SUN6I_CSI_OUTPUT_FMT_FIELD_RAW_10,
},
{
.pixelformat = V4L2_PIX_FMT_SGBRG10,
.output_format_frame = SUN6I_CSI_OUTPUT_FMT_FRAME_RAW_10,
.output_format_field = SUN6I_CSI_OUTPUT_FMT_FIELD_RAW_10,
},
{
.pixelformat = V4L2_PIX_FMT_SGRBG10,
.output_format_frame = SUN6I_CSI_OUTPUT_FMT_FRAME_RAW_10,
.output_format_field = SUN6I_CSI_OUTPUT_FMT_FIELD_RAW_10,
},
{
.pixelformat = V4L2_PIX_FMT_SRGGB10,
.output_format_frame = SUN6I_CSI_OUTPUT_FMT_FRAME_RAW_10,
.output_format_field = SUN6I_CSI_OUTPUT_FMT_FIELD_RAW_10,
},
{
.pixelformat = V4L2_PIX_FMT_SBGGR12,
.output_format_frame = SUN6I_CSI_OUTPUT_FMT_FRAME_RAW_12,
Annotation
- Immediate include surface: `linux/of.h`, `linux/regmap.h`, `media/v4l2-device.h`, `media/v4l2-event.h`, `media/v4l2-ioctl.h`, `media/v4l2-mc.h`, `media/videobuf2-dma-contig.h`, `media/videobuf2-v4l2.h`.
- Detected declarations: `function Copyright`, `function sun6i_csi_capture_format`, `function sun6i_csi_capture_format_match`, `function sun6i_csi_capture_buffer_configure`, `function sun6i_csi_capture_configure`, `function sun6i_csi_capture_state_cleanup`, `function list_for_each_entry`, `function sun6i_csi_capture_state_update`, `function sun6i_csi_capture_state_complete`, `function sun6i_csi_capture_frame_done`.
- 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.