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.

Dependency Surface

Detected Declarations

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

Implementation Notes