drivers/staging/media/ipu7/ipu7-isys-video.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/ipu7/ipu7-isys-video.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/ipu7/ipu7-isys-video.c- Extension
.c- Size
- 29341 bytes
- Lines
- 1079
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/align.hlinux/bits.hlinux/bug.hlinux/completion.hlinux/container_of.hlinux/compat.hlinux/device.hlinux/iopoll.hlinux/list.hlinux/minmax.hlinux/module.hlinux/mutex.hlinux/pm_runtime.hlinux/spinlock.hlinux/string.hmedia/media-entity.hmedia/v4l2-dev.hmedia/v4l2-fh.hmedia/v4l2-ioctl.hmedia/v4l2-mc.hmedia/v4l2-subdev.hmedia/videobuf2-v4l2.habi/ipu7_fw_isys_abi.hipu7.hipu7-bus.hipu7-buttress-regs.hipu7-fw-isys.hipu7-isys.hipu7-isys-video.hipu7-platform-regs.h
Detected Declarations
function ipu7_isys_vidioc_querycapfunction ipu7_isys_vidioc_enum_fmtfunction ipu7_isys_vidioc_enum_framesizesfunction ipu7_isys_vidioc_g_fmt_vid_capfunction ipu7_isys_try_fmt_capfunction __ipu_isys_vidioc_try_fmt_vid_capfunction ipu7_isys_vidioc_try_fmt_vid_capfunction ipu7_isys_vidioc_s_fmt_vid_capfunction ipu7_isys_vidioc_reqbufsfunction ipu7_isys_vidioc_create_bufsfunction link_validatefunction get_stream_openedfunction put_stream_openedfunction ipu7_isys_fw_pin_cfgfunction start_stream_firmwarefunction list_for_each_entryfunction stop_streaming_firmwarefunction close_streaming_firmwarefunction ipu7_isys_video_prepare_streamfunction ipu7_isys_put_streamfunction ipu7_isys_get_streamfunction ipu7_isys_query_stream_by_handlefunction ipu7_isys_query_stream_by_sourcefunction ipu7_isys_video_set_streamingfunction ipu7_isys_fw_openfunction ipu7_isys_fw_closefunction ipu7_isys_setup_videofunction ipu7_isys_video_initfunction ipu7_isys_video_cleanup
Annotated Snippet
if (num_found < f->index) {
num_found++;
continue;
}
f->flags = 0;
f->pixelformat = ipu7_isys_pfmts[i].pixelformat;
return 0;
}
return -EINVAL;
}
static int ipu7_isys_vidioc_enum_framesizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *fsize)
{
unsigned int i;
if (fsize->index > 0)
return -EINVAL;
for (i = 0; i < ARRAY_SIZE(ipu7_isys_pfmts); i++) {
if (fsize->pixel_format != ipu7_isys_pfmts[i].pixelformat)
continue;
fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
fsize->stepwise.min_width = IPU_ISYS_MIN_WIDTH;
fsize->stepwise.max_width = IPU_ISYS_MAX_WIDTH;
fsize->stepwise.min_height = IPU_ISYS_MIN_HEIGHT;
fsize->stepwise.max_height = IPU_ISYS_MAX_HEIGHT;
fsize->stepwise.step_width = 2;
fsize->stepwise.step_height = 2;
return 0;
}
return -EINVAL;
}
static int ipu7_isys_vidioc_g_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *f)
{
struct ipu7_isys_video *av = video_drvdata(file);
f->fmt.pix = av->pix_fmt;
return 0;
}
static void ipu7_isys_try_fmt_cap(struct ipu7_isys_video *av, u32 type,
u32 *format, u32 *width, u32 *height,
u32 *bytesperline, u32 *sizeimage)
{
const struct ipu7_isys_pixelformat *pfmt =
ipu7_isys_get_isys_format(*format);
*format = pfmt->pixelformat;
*width = clamp(*width, IPU_ISYS_MIN_WIDTH, IPU_ISYS_MAX_WIDTH);
*height = clamp(*height, IPU_ISYS_MIN_HEIGHT, IPU_ISYS_MAX_HEIGHT);
if (pfmt->bpp != pfmt->bpp_packed)
*bytesperline = *width * DIV_ROUND_UP(pfmt->bpp, BITS_PER_BYTE);
else
*bytesperline = DIV_ROUND_UP(*width * pfmt->bpp, BITS_PER_BYTE);
*bytesperline = ALIGN(*bytesperline, 64U);
/*
* (height + 1) * bytesperline due to a hardware issue: the DMA unit
* is a power of two, and a line should be transferred as few units
* as possible. The result is that up to line length more data than
* the image size may be transferred to memory after the image.
* Another limitation is the GDA allocation unit size. For low
* resolution it gives a bigger number. Use larger one to avoid
* memory corruption.
*/
*sizeimage = *bytesperline * *height +
max(*bytesperline,
av->isys->pdata->ipdata->isys_dma_overshoot);
}
static void __ipu_isys_vidioc_try_fmt_vid_cap(struct ipu7_isys_video *av,
struct v4l2_format *f)
{
ipu7_isys_try_fmt_cap(av, f->type, &f->fmt.pix.pixelformat,
&f->fmt.pix.width, &f->fmt.pix.height,
&f->fmt.pix.bytesperline, &f->fmt.pix.sizeimage);
f->fmt.pix.field = V4L2_FIELD_NONE;
Annotation
- Immediate include surface: `linux/align.h`, `linux/bits.h`, `linux/bug.h`, `linux/completion.h`, `linux/container_of.h`, `linux/compat.h`, `linux/device.h`, `linux/iopoll.h`.
- Detected declarations: `function ipu7_isys_vidioc_querycap`, `function ipu7_isys_vidioc_enum_fmt`, `function ipu7_isys_vidioc_enum_framesizes`, `function ipu7_isys_vidioc_g_fmt_vid_cap`, `function ipu7_isys_try_fmt_cap`, `function __ipu_isys_vidioc_try_fmt_vid_cap`, `function ipu7_isys_vidioc_try_fmt_vid_cap`, `function ipu7_isys_vidioc_s_fmt_vid_cap`, `function ipu7_isys_vidioc_reqbufs`, `function ipu7_isys_vidioc_create_bufs`.
- 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.
- 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.