drivers/staging/media/atomisp/pci/atomisp_subdev.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/atomisp_subdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/atomisp_subdev.c- Extension
.c- Size
- 27198 bytes
- Lines
- 920
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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/module.hlinux/uaccess.hlinux/delay.hlinux/device.hlinux/mm.hlinux/sched.hlinux/slab.hmedia/v4l2-event.hmedia/v4l2-mediabus.hmedia/videobuf2-vmalloc.hatomisp_cmd.hatomisp_common.hatomisp_compat.hatomisp_fops.hatomisp_internal.hatomisp_ioctl.h
Detected Declarations
function atomisp_subdev_uncompressed_codefunction atomisp_subdev_is_compressedfunction atomisp_subdev_format_conversionfunction isp_subdev_ioctlfunction isp_subdev_subscribe_eventfunction isp_subdev_enum_mbus_codefunction isp_subdev_validate_rectfunction isp_get_fmt_rectfunction isp_subdev_get_selectionfunction atomisp_subdev_set_selectionfunction isp_subdev_set_selectionfunction atomisp_subdev_set_ffmtfunction isp_subdev_get_formatfunction isp_subdev_set_formatfunction isp_subdev_init_paramsfunction atomisp_link_setupfunction atomisp_init_subdev_pipefunction isp_subdev_init_entitiesfunction atomisp_subdev_cleanup_entitiesfunction atomisp_subdev_cleanup_pending_eventsfunction list_for_each_entry_safefunction atomisp_subdev_unregister_entitiesfunction atomisp_subdev_register_subdevfunction atomisp_subdev_init
Annotated Snippet
switch (target) {
case V4L2_SEL_TGT_CROP:
return 0;
}
break;
default:
switch (target) {
case V4L2_SEL_TGT_COMPOSE:
return 0;
}
break;
}
return -EINVAL;
}
struct v4l2_rect *atomisp_subdev_get_rect(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
u32 which, u32 pad,
u32 target)
{
struct atomisp_sub_device *isp_sd = v4l2_get_subdevdata(sd);
if (which == V4L2_SUBDEV_FORMAT_TRY) {
switch (target) {
case V4L2_SEL_TGT_CROP:
return v4l2_subdev_state_get_crop(sd_state, pad);
case V4L2_SEL_TGT_COMPOSE:
return v4l2_subdev_state_get_compose(sd_state, pad);
}
}
switch (target) {
case V4L2_SEL_TGT_CROP:
return &isp_sd->fmt[pad].crop;
case V4L2_SEL_TGT_COMPOSE:
return &isp_sd->fmt[pad].compose;
}
return NULL;
}
struct v4l2_mbus_framefmt
*atomisp_subdev_get_ffmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state, u32 which,
u32 pad)
{
struct atomisp_sub_device *isp_sd = v4l2_get_subdevdata(sd);
if (which == V4L2_SUBDEV_FORMAT_TRY)
return v4l2_subdev_state_get_format(sd_state, pad);
return &isp_sd->fmt[pad].fmt;
}
static void isp_get_fmt_rect(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
u32 which,
struct v4l2_mbus_framefmt **ffmt,
struct v4l2_rect *crop[ATOMISP_SUBDEV_PADS_NUM],
struct v4l2_rect *comp[ATOMISP_SUBDEV_PADS_NUM])
{
unsigned int i;
for (i = 0; i < ATOMISP_SUBDEV_PADS_NUM; i++) {
ffmt[i] = atomisp_subdev_get_ffmt(sd, sd_state, which, i);
crop[i] = atomisp_subdev_get_rect(sd, sd_state, which, i,
V4L2_SEL_TGT_CROP);
comp[i] = atomisp_subdev_get_rect(sd, sd_state, which, i,
V4L2_SEL_TGT_COMPOSE);
}
}
static int isp_subdev_get_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{
struct v4l2_rect *rec;
int rval = isp_subdev_validate_rect(sd, sel->pad, sel->target);
if (rval)
return rval;
rec = atomisp_subdev_get_rect(sd, sd_state, sel->which, sel->pad,
sel->target);
if (!rec)
return -EINVAL;
sel->r = *rec;
return 0;
Annotation
- Immediate include surface: `linux/module.h`, `linux/uaccess.h`, `linux/delay.h`, `linux/device.h`, `linux/mm.h`, `linux/sched.h`, `linux/slab.h`, `media/v4l2-event.h`.
- Detected declarations: `function atomisp_subdev_uncompressed_code`, `function atomisp_subdev_is_compressed`, `function atomisp_subdev_format_conversion`, `function isp_subdev_ioctl`, `function isp_subdev_subscribe_event`, `function isp_subdev_enum_mbus_code`, `function isp_subdev_validate_rect`, `function isp_get_fmt_rect`, `function isp_subdev_get_selection`, `function atomisp_subdev_set_selection`.
- Atlas domain: Driver Families / drivers/staging.
- 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.