Commit c2475aeb authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: v4l: fwnode: Support driver-defined lane mapping defaults

Make use of the default CSI-2 lane mapping from caller-passed
configuration.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: default avatarSteve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: default avatarJacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent af11a74a
...@@ -55,10 +55,14 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode, ...@@ -55,10 +55,14 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode,
u32 v; u32 v;
int rval; int rval;
if (bus_type == V4L2_FWNODE_BUS_TYPE_CSI2_DPHY) if (bus_type == V4L2_FWNODE_BUS_TYPE_CSI2_DPHY) {
num_data_lanes = min_t(u32, bus->num_data_lanes, num_data_lanes = min_t(u32, bus->num_data_lanes,
V4L2_FWNODE_CSI2_MAX_DATA_LANES); V4L2_FWNODE_CSI2_MAX_DATA_LANES);
for (i = 0; i < num_data_lanes; i++)
array[i] = bus->data_lanes[i];
}
rval = fwnode_property_read_u32_array(fwnode, "data-lanes", NULL, 0); rval = fwnode_property_read_u32_array(fwnode, "data-lanes", NULL, 0);
if (rval > 0) { if (rval > 0) {
num_data_lanes = num_data_lanes =
...@@ -66,15 +70,15 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode, ...@@ -66,15 +70,15 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode,
fwnode_property_read_u32_array(fwnode, "data-lanes", array, fwnode_property_read_u32_array(fwnode, "data-lanes", array,
num_data_lanes); num_data_lanes);
}
for (i = 0; i < num_data_lanes; i++) { for (i = 0; i < num_data_lanes; i++) {
if (lanes_used & BIT(array[i])) if (lanes_used & BIT(array[i]))
pr_warn("duplicated lane %u in data-lanes\n", pr_warn("duplicated lane %u in data-lanes\n",
array[i]); array[i]);
lanes_used |= BIT(array[i]); lanes_used |= BIT(array[i]);
pr_debug("lane %u position %u\n", i, array[i]); pr_debug("lane %u position %u\n", i, array[i]);
}
} }
rval = fwnode_property_read_u32_array(fwnode, "lane-polarities", NULL, rval = fwnode_property_read_u32_array(fwnode, "lane-polarities", NULL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment