v4l2_fwnode_endpoint_parse(9)
π v4l2_fwnode_endpoint_parse π
okay so bestie, this is a page from the Kernel API Manual β yes, the actual kernel docs, and yes, we're gonna make it cute. sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
v4l2_fwnode_endpoint_parse β the girl whose whole job is parsing all the fwnode node properties. that's it, that's the vibe. π
πΈ SYNOPSIS πΈ
int v4l2_fwnode_endpoint_parse (struct fwnode_handle *fwnode , struct
v4l2_fwnode_endpoint *vep );
like literally that's the whole signature, no notes. π
π¦ ARGUMENTS π¦
fwnodeβ pointer to the endpoint's fwnode handle. and listen, it may beNULLπ (we'll get to what happens then, don't worry).vepβ pointer to the V4L2 fwnode data structure. the main character of this whole operation fr fr.
π DESCRIPTION π
so what does she actually do? she parses the V4L2 fwnode endpoint specific parameters straight out of the firmware. iconic behaviour honestly. β¨
there are two ways to use this function, and you gotta pick your lane:
- let it figure out the type of the bus itself β you do this by setting the
vep.bus_typefield toV4L2_MBUS_UNKNOWN - or specify the bus type explicitly, using one of the
enum v4l2_mbus_typetypes
option 1 β the "you decide" route: when vep.bus_type is V4L2_MBUS_UNKNOWN, the function will use the "bus-type" property to determine the type when it is available. and then β this is important, bestie β the caller is responsible for validating the contents of the vep.bus_type field after the call returns. it does not do that part for you. you are the validator. you are the moment. π
and now the messy part π«£: there's this deprecated functionality that exists to support older DT bindings that don't have a "bus-type" property, for devices that support multiple types. if the "bus-type" property does not exist, the function will attempt to guess the type based on the endpoint properties available.
π¨ NEVER RELY ON GUESSING THE BUS TYPE IN NEW DRIVERS OR BINDINGS. π¨ like, ever. it's giving deprecated. it's giving legacy. do not do it. periodt.
option 2 β the "i already know" route: it's also possible to set vep.bus_type corresponding to an actual bus. in this case the function will only attempt to parse properties related to this bus, and it will return an error if the value of the "bus-type" property corresponds to a different bus. mismatched. rejected. blocked. π
housekeeping rule π§Ή: the caller is required to initialise all fields of vep β either with explicit values, or by zeroing them. all of them. no leaving fields in mystery states, that's not the vibe.
and the safety net π«Ά: the function does not change the V4L2 fwnode endpoint state if it fails. so if it flops, nothing got messed up. we love a clean failure.
β NOTE β
heads up bestie: this function does not parse the "link-frequencies" property, because its size is not known in advance π like it literally can't know how big it's gonna be. so if you need properties of variable size, please use v4l2_fwnode_endpoint_alloc_parse instead. she's the one for that job. π
π₯ RETURN π₯
0on success π (we love a zero)- a negative error code on failure, specifically:
-ENOMEMon memory allocation failure-EINVALon parsing failure-ENXIOon mismatching bus types-EPROBE_DEFERonNULLfwnode
so yeah, that NULL fwnode from earlier? that's your -EPROBE_DEFER. told you we'd get there π
π§ SEE ALSO π§
- Kernel file
./include/media/v4l2-fwnode.h struct v4l2_fwnode_endpoint(9)V4L2_FWNODE_PROPERTY_UNSET(9)enum v4l2_fwnode_orientation(9)struct v4l2_fwnode_device_properties(9)struct v4l2_fwnode_link(9)enum v4l2_connector_type(9)struct v4l2_connector_link(9)struct v4l2_fwnode_connector_analog(9)struct v4l2_fwnode_connector(9)enum v4l2_fwnode_bus_type(9)v4l2_fwnode_endpoint_free(9)v4l2_fwnode_endpoint_alloc_parse(9)v4l2_fwnode_parse_link(9)v4l2_fwnode_put_link(9)v4l2_fwnode_connector_free(9)v4l2_fwnode_connector_parse(9)v4l2_fwnode_connector_add_link(9)v4l2_fwnode_device_parse(9)
like, read the whole friend group, they all matter. π«Άβ¨
aaaand that's the page!! π this one lives at ./include/media, dated October 2026, and it's filed under v4l2_fwnode_endpoint_parse(9). go parse something, bestie β safely, and never by guessing the bus type. ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms