@@ -409,7 +409,7 @@ v4l2_fwnode_endpoint_parse_csi1_bus(struct fwnode_handle *fwnode,
static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
struct v4l2_fwnode_endpoint *vep)
{
- u32 bus_type = 0;
+ u32 bus_type = V4L2_FWNODE_BUS_TYPE_GUESS;
enum v4l2_mbus_type mbus_type;
int rval;
@@ -432,13 +432,24 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
v4l2_fwnode_bus_type_to_string(bus_type), bus_type,
v4l2_fwnode_mbus_type_to_string(vep->bus_type),
vep->bus_type);
-
mbus_type = v4l2_fwnode_bus_type_to_mbus(bus_type);
- switch (mbus_type) {
+ if (vep->bus_type != V4L2_MBUS_UNKNOWN) {
+ if (mbus_type != V4L2_MBUS_UNKNOWN &&
+ vep->bus_type != mbus_type) {
+ pr_debug("expecting bus type %s\n",
+ v4l2_fwnode_mbus_type_to_string(
+ vep->bus_type));
+ return -ENXIO;
+ }
+ } else {
+ vep->bus_type = mbus_type;
+ }
+
+ switch (vep->bus_type) {
case V4L2_MBUS_UNKNOWN:
rval = v4l2_fwnode_endpoint_parse_csi2_bus(fwnode, vep,
- mbus_type);
+ V4L2_MBUS_UNKNOWN);
if (rval)
return rval;
@@ -453,20 +464,20 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
break;
case V4L2_MBUS_CCP2:
case V4L2_MBUS_CSI1:
- v4l2_fwnode_endpoint_parse_csi1_bus(fwnode, vep, mbus_type);
+ v4l2_fwnode_endpoint_parse_csi1_bus(fwnode, vep, vep->bus_type);
break;
case V4L2_MBUS_CSI2_DPHY:
- vep->bus_type = V4L2_MBUS_CSI2_DPHY;
rval = v4l2_fwnode_endpoint_parse_csi2_bus(fwnode, vep,
- mbus_type);
+ vep->bus_type);
if (rval)
return rval;
break;
case V4L2_MBUS_PARALLEL:
case V4L2_MBUS_BT656:
- v4l2_fwnode_endpoint_parse_parallel_bus(fwnode, vep, mbus_type);
+ v4l2_fwnode_endpoint_parse_parallel_bus(fwnode, vep,
+ vep->bus_type);
break;
default: