drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-subdev.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-subdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-subdev.c- Extension
.c- Size
- 10095 bytes
- Lines
- 377
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
rzv2h-ivc.hlinux/media.hlinux/media-bus-format.hlinux/v4l2-mediabus.hmedia/v4l2-async.hmedia/v4l2-ctrls.hmedia/v4l2-dev.hmedia/v4l2-event.h
Detected Declarations
function rzv2h_ivc_get_mbus_output_from_inputfunction rzv2h_ivc_enum_mbus_codefunction rzv2h_ivc_enum_frame_sizefunction rzv2h_ivc_set_fmtfunction rzv2h_ivc_enable_streamsfunction rzv2h_ivc_disable_streamsfunction rzv2h_ivc_init_statefunction rzv2h_ivc_registeredfunction rzv2h_ivc_link_validatefunction rzv2h_ivc_initialise_subdevicefunction rzv2h_ivc_deinit_subdevice
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Renesas RZ/V2H(P) Input Video Control Block driver
*
* Copyright (C) 2025 Ideas on Board Oy
*/
#include "rzv2h-ivc.h"
#include <linux/media.h>
#include <linux/media-bus-format.h>
#include <linux/v4l2-mediabus.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-event.h>
#define RZV2H_IVC_N_INPUTS_PER_OUTPUT 6
/*
* We support 8/10/12/14/16/20 bit input in any bayer order, but the output
* format is fixed at 20-bits with the same order as the input.
*/
static const struct {
u32 inputs[RZV2H_IVC_N_INPUTS_PER_OUTPUT];
u32 output;
} rzv2h_ivc_formats[] = {
{
.inputs = {
MEDIA_BUS_FMT_SBGGR8_1X8,
MEDIA_BUS_FMT_SBGGR10_1X10,
MEDIA_BUS_FMT_SBGGR12_1X12,
MEDIA_BUS_FMT_SBGGR14_1X14,
MEDIA_BUS_FMT_SBGGR16_1X16,
MEDIA_BUS_FMT_SBGGR20_1X20,
},
.output = MEDIA_BUS_FMT_SBGGR20_1X20
},
{
.inputs = {
MEDIA_BUS_FMT_SGBRG8_1X8,
MEDIA_BUS_FMT_SGBRG10_1X10,
MEDIA_BUS_FMT_SGBRG12_1X12,
MEDIA_BUS_FMT_SGBRG14_1X14,
MEDIA_BUS_FMT_SGBRG16_1X16,
MEDIA_BUS_FMT_SGBRG20_1X20,
},
.output = MEDIA_BUS_FMT_SGBRG20_1X20
},
{
.inputs = {
MEDIA_BUS_FMT_SGRBG8_1X8,
MEDIA_BUS_FMT_SGRBG10_1X10,
MEDIA_BUS_FMT_SGRBG12_1X12,
MEDIA_BUS_FMT_SGRBG14_1X14,
MEDIA_BUS_FMT_SGRBG16_1X16,
MEDIA_BUS_FMT_SGRBG20_1X20,
},
.output = MEDIA_BUS_FMT_SGRBG20_1X20
},
{
.inputs = {
MEDIA_BUS_FMT_SRGGB8_1X8,
MEDIA_BUS_FMT_SRGGB10_1X10,
MEDIA_BUS_FMT_SRGGB12_1X12,
MEDIA_BUS_FMT_SRGGB14_1X14,
MEDIA_BUS_FMT_SRGGB16_1X16,
MEDIA_BUS_FMT_SRGGB20_1X20,
},
.output = MEDIA_BUS_FMT_SRGGB20_1X20
},
};
static u32 rzv2h_ivc_get_mbus_output_from_input(u32 mbus_code)
{
unsigned int i, j;
for (i = 0; i < ARRAY_SIZE(rzv2h_ivc_formats); i++) {
for (j = 0; j < RZV2H_IVC_N_INPUTS_PER_OUTPUT; j++) {
if (rzv2h_ivc_formats[i].inputs[j] == mbus_code)
return rzv2h_ivc_formats[i].output;
}
}
return 0;
}
static int rzv2h_ivc_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
Annotation
- Immediate include surface: `rzv2h-ivc.h`, `linux/media.h`, `linux/media-bus-format.h`, `linux/v4l2-mediabus.h`, `media/v4l2-async.h`, `media/v4l2-ctrls.h`, `media/v4l2-dev.h`, `media/v4l2-event.h`.
- Detected declarations: `function rzv2h_ivc_get_mbus_output_from_input`, `function rzv2h_ivc_enum_mbus_code`, `function rzv2h_ivc_enum_frame_size`, `function rzv2h_ivc_set_fmt`, `function rzv2h_ivc_enable_streams`, `function rzv2h_ivc_disable_streams`, `function rzv2h_ivc_init_state`, `function rzv2h_ivc_registered`, `function rzv2h_ivc_link_validate`, `function rzv2h_ivc_initialise_subdevice`.
- 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.