Skip to content

Commit adb6a91

Browse files
committed
PENDING: media: qcom: camss: validate local/remote endpoint bus-type
Parse the remote (sensor) endpoint in camss_parse_endpoint_node() and compare its bus-type against the local (CSIPHY) endpoint. Reject the link with -EINVAL if the two ends disagree, so CPHY/DPHY mismatches are caught early during probe. CRs-Fixed: 4571838 Co-developed-by: Jigarkumar Zala <jzala@qti.qualcomm.com> Signed-off-by: Jigarkumar Zala <jzala@qti.qualcomm.com> Signed-off-by: Anusha Arun Nandi <aarunnan@qti.qualcomm.com>
1 parent 0f4181f commit adb6a91

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

  • drivers/media/platform/qcom/camss

drivers/media/platform/qcom/camss/camss.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4568,7 +4568,9 @@ static int camss_parse_endpoint_node(struct device *dev,
45684568
{
45694569
struct csiphy_lanes_cfg *lncfg = &csd->interface.csi2.lane_cfg;
45704570
struct v4l2_mbus_config_mipi_csi2 *mipi_csi2;
4571-
struct v4l2_fwnode_endpoint vep = { { 0 } };
4571+
struct v4l2_fwnode_endpoint vep = { .bus_type = V4L2_MBUS_UNKNOWN };
4572+
struct v4l2_fwnode_endpoint remote_vep = { .bus_type = V4L2_MBUS_UNKNOWN };
4573+
struct fwnode_handle *remote_ep;
45724574
unsigned int i;
45734575
int ret;
45744576

@@ -4585,6 +4587,30 @@ static int camss_parse_endpoint_node(struct device *dev,
45854587
return -EINVAL;
45864588
}
45874589

4590+
/* Get the remote (sensor) endpoint handle, e.g. imx686_ep1 */
4591+
remote_ep = fwnode_graph_get_remote_endpoint(ep);
4592+
if (!remote_ep) {
4593+
dev_dbg(dev, "No remote endpoint found for %pfw\n", ep);
4594+
return -ENODEV;
4595+
}
4596+
4597+
/* Parse the remote bus type and release the handle */
4598+
ret = v4l2_fwnode_endpoint_parse(remote_ep, &remote_vep);
4599+
fwnode_handle_put(remote_ep);
4600+
if (ret) {
4601+
dev_dbg(dev, "Failed to parse remote endpoint\n");
4602+
return ret;
4603+
}
4604+
4605+
/* The local (CSIPHY) and remote (sensor) ends must agree */
4606+
if (vep.bus_type != remote_vep.bus_type) {
4607+
dev_dbg(dev, "Bus type mismatch! Local (CSI-PHY): %u, Remote (Sensor): %u\n",
4608+
vep.bus_type, remote_vep.bus_type);
4609+
return -EINVAL;
4610+
}
4611+
4612+
dev_dbg(dev, "Verified link: both ends use bus-type %u\n", vep.bus_type);
4613+
45884614
csd->interface.csiphy_id = vep.base.port;
45894615

45904616
mipi_csi2 = &vep.bus.mipi_csi2;

0 commit comments

Comments
 (0)