drivers/media/i2c/alvium-csi2.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/alvium-csi2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/alvium-csi2.c- Extension
.c- Size
- 64462 bytes
- Lines
- 2554
- 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/i2c.hlinux/module.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hmedia/mipi-csi2.hmedia/v4l2-async.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.halvium-csi2.h
Detected Declarations
function alvium_readfunction alvium_writefunction alvium_write_hshakefunction alvium_get_bcrm_versfunction alvium_get_fw_versionfunction alvium_get_bcrm_addrfunction alvium_is_alivefunction alvium_print_avail_mipi_fmtfunction alvium_print_avail_featfunction alvium_print_avail_bayerfunction alvium_get_feat_inqfunction alvium_get_host_supp_csi_lanesfunction alvium_set_csi_lanesfunction alvium_set_lp2hs_delayfunction alvium_get_csi_clk_paramsfunction alvium_set_csi_clkfunction alvium_get_img_width_paramsfunction alvium_get_img_height_paramsfunction alvium_set_img_widthfunction alvium_set_img_heightfunction alvium_set_img_offxfunction alvium_set_img_offyfunction alvium_get_offx_paramsfunction alvium_get_offy_paramsfunction alvium_get_gain_paramsfunction alvium_get_exposure_paramsfunction alvium_get_red_balance_ratio_paramsfunction alvium_get_blue_balance_ratio_paramsfunction alvium_get_hue_paramsfunction alvium_get_black_lvl_paramsfunction alvium_get_gamma_paramsfunction alvium_get_sharpness_paramsfunction alvium_get_contrast_paramsfunction alvium_get_saturation_paramsfunction alvium_set_bcm_modefunction alvium_get_modefunction alvium_get_avail_mipi_data_formatfunction alvium_setup_mipi_fmtfunction alvium_set_mipi_fmtfunction alvium_get_avail_bayerfunction alvium_set_bayer_patternfunction alvium_get_frame_intervalfunction alvium_set_frame_ratefunction alvium_set_stream_mipifunction alvium_get_gainfunction alvium_set_ctrl_gainfunction alvium_set_ctrl_auto_gainfunction alvium_get_exposure
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Allied Vision Technologies GmbH Alvium camera driver
*
* Copyright (C) 2023 Tommaso Merciai
* Copyright (C) 2023 Martin Hecht
* Copyright (C) 2023 Avnet EMG GmbH
*/
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <media/mipi-csi2.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>
#include "alvium-csi2.h"
static const struct v4l2_mbus_framefmt alvium_csi2_default_fmt = {
.code = MEDIA_BUS_FMT_UYVY8_1X16,
.width = 640,
.height = 480,
.colorspace = V4L2_COLORSPACE_SRGB,
.ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(V4L2_COLORSPACE_SRGB),
.quantization = V4L2_QUANTIZATION_FULL_RANGE,
.xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(V4L2_COLORSPACE_SRGB),
.field = V4L2_FIELD_NONE,
};
static const struct alvium_pixfmt alvium_csi2_fmts[] = {
{
/* UYVY8_2X8 */
.id = ALVIUM_FMT_UYVY8_2X8,
.code = MEDIA_BUS_FMT_UYVY8_2X8,
.colorspace = V4L2_COLORSPACE_SRGB,
.fmt_av_bit = ALVIUM_BIT_YUV422_8,
.bay_av_bit = ALVIUM_BIT_BAY_NONE,
.mipi_fmt_regval = MIPI_CSI2_DT_YUV422_8B,
.bay_fmt_regval = -1,
.is_raw = 0,
}, {
/* UYVY8_1X16 */
.id = ALVIUM_FMT_UYVY8_1X16,
.code = MEDIA_BUS_FMT_UYVY8_1X16,
.colorspace = V4L2_COLORSPACE_SRGB,
.fmt_av_bit = ALVIUM_BIT_YUV422_8,
.bay_av_bit = ALVIUM_BIT_BAY_NONE,
.mipi_fmt_regval = MIPI_CSI2_DT_YUV422_8B,
.bay_fmt_regval = -1,
.is_raw = 0,
}, {
/* YUYV8_1X16 */
.id = ALVIUM_FMT_YUYV8_1X16,
.code = MEDIA_BUS_FMT_YUYV8_1X16,
.colorspace = V4L2_COLORSPACE_SRGB,
.fmt_av_bit = ALVIUM_BIT_YUV422_8,
.bay_av_bit = ALVIUM_BIT_BAY_NONE,
.mipi_fmt_regval = MIPI_CSI2_DT_YUV422_8B,
.bay_fmt_regval = -1,
.is_raw = 0,
}, {
/* YUYV8_2X8 */
.id = ALVIUM_FMT_YUYV8_2X8,
.code = MEDIA_BUS_FMT_YUYV8_2X8,
.colorspace = V4L2_COLORSPACE_SRGB,
.fmt_av_bit = ALVIUM_BIT_YUV422_8,
.bay_av_bit = ALVIUM_BIT_BAY_NONE,
.mipi_fmt_regval = MIPI_CSI2_DT_YUV422_8B,
.bay_fmt_regval = -1,
.is_raw = 0,
}, {
/* YUYV10_1X20 */
.id = ALVIUM_FMT_YUYV10_1X20,
.code = MEDIA_BUS_FMT_YUYV10_1X20,
.colorspace = V4L2_COLORSPACE_SRGB,
.fmt_av_bit = ALVIUM_BIT_YUV422_10,
.bay_av_bit = ALVIUM_BIT_BAY_NONE,
.mipi_fmt_regval = MIPI_CSI2_DT_YUV422_10B,
.bay_fmt_regval = -1,
.is_raw = 0,
}, {
/* RGB888_1X24 */
.id = ALVIUM_FMT_RGB888_1X24,
.code = MEDIA_BUS_FMT_RGB888_1X24,
.colorspace = V4L2_COLORSPACE_SRGB,
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/regulator/consumer.h`, `media/mipi-csi2.h`, `media/v4l2-async.h`, `media/v4l2-ctrls.h`.
- Detected declarations: `function alvium_read`, `function alvium_write`, `function alvium_write_hshake`, `function alvium_get_bcrm_vers`, `function alvium_get_fw_version`, `function alvium_get_bcrm_addr`, `function alvium_is_alive`, `function alvium_print_avail_mipi_fmt`, `function alvium_print_avail_feat`, `function alvium_print_avail_bayer`.
- 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.