drivers/media/platform/renesas/rcar-vin/rcar-core.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/rcar-vin/rcar-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/rcar-vin/rcar-core.c- Extension
.c- Size
- 30787 bytes
- Lines
- 1297
- 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.
- 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/idr.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/pm_runtime.hlinux/slab.hmedia/v4l2-async.hmedia/v4l2-fwnode.hmedia/v4l2-mc.hrcar-vin.h
Detected Declarations
function rvin_group_cleanupfunction rvin_group_initfunction rvin_group_releasefunction rvin_group_getfunction rvin_group_putfunction rvin_group_entity_to_remote_idfunction rvin_group_notify_completefunction rvin_group_notify_unbindfunction rvin_group_notify_boundfunction rvin_group_parse_offunction rvin_parallel_parse_offunction rvin_group_notifier_initfunction rvin_s_ctrlfunction rvin_free_controlsfunction rvin_create_controlsfunction maskfunction rvin_csi2_create_linkfunction rvin_parallel_setup_linksfunction rvin_csi2_setup_linksfunction rvin_csi2_initfunction rvin_isp_setup_linksfunction rvin_isp_initfunction rvin_suspendfunction rvin_resumefunction rvin_id_getfunction rvin_id_putfunction rcar_vin_probefunction rcar_vin_remove
Annotated Snippet
if (!group) {
ret = -ENOMEM;
goto err_group;
}
ret = rvin_group_init(group, vin, link_setup, ops);
if (ret) {
kfree(group);
vin_err(vin, "Failed to initialize group\n");
goto err_group;
}
kref_init(&group->refcount);
group->info = vin->info;
rvin_group_data = group;
}
mutex_unlock(&rvin_group_lock);
/* Add VIN to group */
mutex_lock(&group->lock);
if (group->vin[vin->id]) {
vin_err(vin, "Duplicate renesas,id property value %u\n", vin->id);
mutex_unlock(&group->lock);
kref_put(&group->refcount, rvin_group_release);
return -EINVAL;
}
group->vin[vin->id] = vin;
vin->group = group;
vin->v4l2_dev.mdev = &group->mdev;
mutex_unlock(&group->lock);
return 0;
err_group:
mutex_unlock(&rvin_group_lock);
return ret;
}
static void rvin_group_put(struct rvin_dev *vin)
{
struct rvin_group *group = vin->group;
mutex_lock(&group->lock);
vin->group = NULL;
vin->v4l2_dev.mdev = NULL;
if (WARN_ON(group->vin[vin->id] != vin))
goto out;
group->vin[vin->id] = NULL;
out:
mutex_unlock(&group->lock);
kref_put(&group->refcount, rvin_group_release);
}
/* group lock should be held when calling this function. */
static int rvin_group_entity_to_remote_id(struct rvin_group *group,
struct media_entity *entity)
{
struct v4l2_subdev *sd;
unsigned int i;
sd = media_entity_to_v4l2_subdev(entity);
for (i = 0; i < ARRAY_SIZE(group->remotes); i++)
if (group->remotes[i].subdev == sd)
return i;
return -ENODEV;
}
static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier)
{
struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev);
unsigned int i;
int ret;
ret = media_device_register(&vin->group->mdev);
if (ret)
return ret;
ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev);
if (ret) {
vin_err(vin, "Failed to register subdev nodes\n");
Annotation
- Immediate include surface: `linux/idr.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/slab.h`, `media/v4l2-async.h`.
- Detected declarations: `function rvin_group_cleanup`, `function rvin_group_init`, `function rvin_group_release`, `function rvin_group_get`, `function rvin_group_put`, `function rvin_group_entity_to_remote_id`, `function rvin_group_notify_complete`, `function rvin_group_notify_unbind`, `function rvin_group_notify_bound`, `function rvin_group_parse_of`.
- 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.