drivers/staging/media/ipu7/ipu7-isys-subdev.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/ipu7/ipu7-isys-subdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/ipu7/ipu7-isys-subdev.c- Extension
.c- Size
- 8384 bytes
- Lines
- 334
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bug.hlinux/device.hlinux/minmax.hlinux/types.hmedia/media-entity.hmedia/mipi-csi2.hmedia/v4l2-ctrls.hmedia/v4l2-subdev.huapi/linux/media-bus-format.hipu7-bus.hipu7-isys.hipu7-isys-subdev.h
Detected Declarations
function Copyrightfunction ipu7_isys_is_bayer_formatfunction ipu7_isys_convert_bayer_orderfunction ipu7_isys_subdev_set_fmtfunction ipu7_isys_subdev_enum_mbus_codefunction subdev_set_routingfunction ipu7_isys_get_stream_pad_fmtfunction ipu7_isys_subdev_init_statefunction ipu7_isys_subdev_set_routingfunction ipu7_isys_subdev_initfunction ipu7_isys_subdev_cleanup
Annotated Snippet
if (asd->supported_codes[i] == format->format.code) {
code = asd->supported_codes[i];
break;
}
}
format->format.code = code;
format->format.field = V4L2_FIELD_NONE;
/* Store the format and propagate it to the source pad. */
fmt = v4l2_subdev_state_get_format(state, format->pad, format->stream);
if (!fmt)
return -EINVAL;
*fmt = format->format;
if (!(sd->entity.pads[format->pad].flags & MEDIA_PAD_FL_SINK))
return 0;
/* propagate format to following source pad */
fmt = v4l2_subdev_state_get_opposite_stream_format(state, format->pad,
format->stream);
if (!fmt)
return -EINVAL;
*fmt = format->format;
ret = v4l2_subdev_routing_find_opposite_end(&state->routing,
format->pad,
format->stream,
&other_pad,
&other_stream);
if (ret)
return -EINVAL;
crop = v4l2_subdev_state_get_crop(state, other_pad, other_stream);
/* reset crop */
crop->left = 0;
crop->top = 0;
crop->width = fmt->width;
crop->height = fmt->height;
return 0;
}
int ipu7_isys_subdev_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
struct v4l2_subdev_mbus_code_enum *code)
{
struct ipu7_isys_subdev *asd = to_ipu7_isys_subdev(sd);
const u32 *supported_codes = asd->supported_codes;
u32 index;
for (index = 0; supported_codes[index]; index++) {
if (index == code->index) {
code->code = supported_codes[index];
return 0;
}
}
return -EINVAL;
}
static int subdev_set_routing(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
struct v4l2_subdev_krouting *routing)
{
static const struct v4l2_mbus_framefmt fmt = {
.width = 4096,
.height = 3072,
.code = MEDIA_BUS_FMT_SGRBG10_1X10,
.field = V4L2_FIELD_NONE,
};
struct v4l2_subdev_route *route;
int ret;
ret = v4l2_subdev_routing_validate(sd, routing,
V4L2_SUBDEV_ROUTING_ONLY_1_TO_1 |
V4L2_SUBDEV_ROUTING_NO_SOURCE_MULTIPLEXING);
if (ret)
return ret;
/*
* The device doesn't support source multiplexing, set all source
* streams to 0 to simplify stream handling through the driver.
*/
for_each_active_route(routing, route)
route->source_stream = 0;
return v4l2_subdev_set_routing_with_fmt(sd, state, routing, &fmt);
}
Annotation
- Immediate include surface: `linux/bug.h`, `linux/device.h`, `linux/minmax.h`, `linux/types.h`, `media/media-entity.h`, `media/mipi-csi2.h`, `media/v4l2-ctrls.h`, `media/v4l2-subdev.h`.
- Detected declarations: `function Copyright`, `function ipu7_isys_is_bayer_format`, `function ipu7_isys_convert_bayer_order`, `function ipu7_isys_subdev_set_fmt`, `function ipu7_isys_subdev_enum_mbus_code`, `function subdev_set_routing`, `function ipu7_isys_get_stream_pad_fmt`, `function ipu7_isys_subdev_init_state`, `function ipu7_isys_subdev_set_routing`, `function ipu7_isys_subdev_init`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
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.