drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c- Extension
.c- Size
- 24242 bytes
- Lines
- 877
- 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.
- 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/device.hlinux/errno.hlinux/interrupt.hlinux/kernel.hlinux/minmax.hlinux/mutex.hlinux/of.hlinux/platform_device.hlinux/types.hlinux/videodev2.hmedia/media-entity.hmedia/v4l2-subdev.hmedia/videobuf2-v4l2.himx8-isi-core.himx8-isi-regs.h
Detected Declarations
function mxc_isi_bus_format_by_codefunction mxc_isi_bus_format_by_indexfunction mxc_isi_pipe_enablefunction mxc_isi_pipe_disablefunction mxc_isi_pipe_get_pad_formatfunction mxc_isi_pipe_get_pad_cropfunction mxc_isi_pipe_get_pad_composefunction mxc_isi_pipe_init_statefunction mxc_isi_pipe_enum_mbus_codefunction mxc_isi_pipe_set_fmtfunction mxc_isi_pipe_get_selectionfunction mxc_isi_pipe_set_selectionfunction mxc_isi_pipe_irq_handlerfunction mxc_isi_pipe_initfunction mxc_isi_pipe_cleanupfunction mxc_isi_pipe_acquirefunction mxc_isi_pipe_release
Annotated Snippet
if (info->encoding == MXC_ISI_ENC_RAW) {
/*
* For RAW formats, the sink and source media bus codes
* must match.
*/
if (code->index)
return -EINVAL;
code->code = info->output;
} else {
/*
* For RGB or YUV formats, the ISI supports format
* conversion. Either of the two output formats can be
* used regardless of the input.
*/
if (code->index > 1)
return -EINVAL;
code->code = output_codes[code->index];
}
return 0;
}
index = code->index;
for (i = 0; i < ARRAY_SIZE(mxc_isi_bus_formats); ++i) {
info = &mxc_isi_bus_formats[i];
if (!(info->pads & BIT(MXC_ISI_PIPE_PAD_SINK)))
continue;
if (index == 0) {
code->code = info->mbus_code;
return 0;
}
index--;
}
return -EINVAL;
}
static int mxc_isi_pipe_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
struct v4l2_subdev_format *fmt)
{
struct mxc_isi_pipe *pipe = to_isi_pipe(sd);
struct v4l2_mbus_framefmt *mf = &fmt->format;
const struct mxc_isi_bus_format_info *info;
struct v4l2_mbus_framefmt *format;
struct v4l2_rect *rect;
if (vb2_is_busy(&pipe->video.vb2_q))
return -EBUSY;
if (fmt->pad == MXC_ISI_PIPE_PAD_SINK) {
unsigned int max_width;
info = mxc_isi_bus_format_by_code(mf->code,
MXC_ISI_PIPE_PAD_SINK);
if (!info)
info = mxc_isi_bus_format_by_code(MXC_ISI_DEF_MBUS_CODE_SINK,
MXC_ISI_PIPE_PAD_SINK);
/*
* Limit the max line length if there's no adjacent pipe to
* chain with.
*/
max_width = pipe->id == pipe->isi->pdata->num_channels - 1
? MXC_ISI_MAX_WIDTH_UNCHAINED
: MXC_ISI_MAX_WIDTH_CHAINED;
mf->code = info->mbus_code;
mf->width = clamp(mf->width, MXC_ISI_MIN_WIDTH, max_width);
mf->height = clamp(mf->height, MXC_ISI_MIN_HEIGHT,
MXC_ISI_MAX_HEIGHT);
/* Propagate the format to the source pad. */
rect = mxc_isi_pipe_get_pad_compose(pipe, state,
MXC_ISI_PIPE_PAD_SINK);
rect->width = mf->width;
rect->height = mf->height;
rect = mxc_isi_pipe_get_pad_crop(pipe, state,
MXC_ISI_PIPE_PAD_SOURCE);
rect->left = 0;
rect->top = 0;
rect->width = mf->width;
rect->height = mf->height;
Annotation
- Immediate include surface: `linux/device.h`, `linux/errno.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/minmax.h`, `linux/mutex.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `function mxc_isi_bus_format_by_code`, `function mxc_isi_bus_format_by_index`, `function mxc_isi_pipe_enable`, `function mxc_isi_pipe_disable`, `function mxc_isi_pipe_get_pad_format`, `function mxc_isi_pipe_get_pad_crop`, `function mxc_isi_pipe_get_pad_compose`, `function mxc_isi_pipe_init_state`, `function mxc_isi_pipe_enum_mbus_code`, `function mxc_isi_pipe_set_fmt`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- 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.