diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2018-07-19 11:22:49 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-10-04 16:23:12 -0400 |
commit | e7b2f5185e4cc44c11d01f0aac162837829b72f1 (patch) | |
tree | 5e3e7ccb9b2bfd2335182bb8939f42fe7628cb51 /drivers/media | |
parent | 3eb32c264d893156256c33bdfdfbd71dbb996b5b (diff) |
media: v4l: fwnode: Use V4L2 fwnode endpoint media bus type if set
Use the given media bus type set by the caller. If none is given (i.e. the
mbus type is V4L2_MBUS_UNKNOWN, or 0), fall back to the old behaviour.
This is to obtain the information from the DT or try to guess the bus
type.
-ENXIO is returned if the caller sets the bus type but that does not match
with what's in DT. Also return -ENXIO if bus type detection failed to
separate this from the rest of the errors.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-fwnode.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 0bbe84867cb1..6bbf02422a36 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -404,7 +404,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; @@ -427,13 +427,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; @@ -448,20 +459,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: |