drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c- Extension
.c- Size
- 10482 bytes
- Lines
- 443
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/clk.hlinux/module.hlinux/mod_devicetable.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/pm_runtime.hmedia/v4l2-fwnode.hmedia/v4l2-mc.hrzg2l-cru.hrzg2l-cru-regs.h
Detected Declarations
function Copyrightfunction rzg2l_cru_group_notify_completefunction rzg2l_cru_group_notify_unbindfunction rzg2l_cru_group_notify_boundfunction rzg2l_cru_mc_parse_offunction rzg2l_cru_mc_parse_of_graphfunction rzg2l_cru_media_initfunction rzg2l_cru_probefunction rzg2l_cru_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Driver for Renesas RZ/G2L CRU
*
* Copyright (C) 2022 Renesas Electronics Corp.
*
* Based on Renesas R-Car VIN
* Copyright (C) 2011-2013 Renesas Solutions Corp.
* Copyright (C) 2013 Cogent Embedded, Inc., <source@cogentembedded.com>
* Copyright (C) 2008 Magnus Damm
*/
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-mc.h>
#include "rzg2l-cru.h"
#include "rzg2l-cru-regs.h"
static inline struct rzg2l_cru_dev *notifier_to_cru(struct v4l2_async_notifier *n)
{
return container_of(n, struct rzg2l_cru_dev, notifier);
}
static const struct media_device_ops rzg2l_cru_media_ops = {
.link_notify = v4l2_pipeline_link_notify,
};
/* -----------------------------------------------------------------------------
* Group async notifier
*/
static int rzg2l_cru_group_notify_complete(struct v4l2_async_notifier *notifier)
{
struct rzg2l_cru_dev *cru = notifier_to_cru(notifier);
struct media_entity *source, *sink;
int ret;
ret = rzg2l_cru_ip_subdev_register(cru);
if (ret)
return ret;
ret = v4l2_device_register_subdev_nodes(&cru->v4l2_dev);
if (ret) {
dev_err(cru->dev, "Failed to register subdev nodes\n");
return ret;
}
ret = rzg2l_cru_video_register(cru);
if (ret)
return ret;
/*
* CRU can be connected either to CSI2 or PARALLEL device
* For now we are only supporting CSI2
*
* Create media device link between CSI-2 <-> CRU IP
*/
source = &cru->csi.subdev->entity;
sink = &cru->ip.subdev.entity;
ret = media_create_pad_link(source, 1, sink, 0,
MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (ret) {
dev_err(cru->dev, "Error creating link from %s to %s\n",
source->name, sink->name);
return ret;
}
cru->ip.remote = cru->csi.subdev;
/* Create media device link between CRU IP <-> CRU OUTPUT */
source = &cru->ip.subdev.entity;
sink = &cru->vdev.entity;
ret = media_create_pad_link(source, 1, sink, 0,
MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (ret) {
dev_err(cru->dev, "Error creating link from %s to %s\n",
source->name, sink->name);
return ret;
}
return 0;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/of.h`, `linux/of_graph.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `media/v4l2-fwnode.h`.
- Detected declarations: `function Copyright`, `function rzg2l_cru_group_notify_complete`, `function rzg2l_cru_group_notify_unbind`, `function rzg2l_cru_group_notify_bound`, `function rzg2l_cru_mc_parse_of`, `function rzg2l_cru_mc_parse_of_graph`, `function rzg2l_cru_media_init`, `function rzg2l_cru_probe`, `function rzg2l_cru_remove`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.