Bladeren bron

msm: camera: req_mgr: Add condition to defer crm probe

Currently, if i2c master has not probed by the time camera
request manager probes, the camera i2c slave device will not
be found on the i2c bus. In this case, compoenent framework
can't keep track of those i2c driver probes and synchronize
them. Add condition to defer crm probe in case i2c device is
not available on the bus, if we have added DTSI node for it.

CRs-Fixed: 3241160
Change-Id: I6cad2be8afd96de52f559d4b88563247a0ec6627
Signed-off-by: Mukund Madhusudan Atre <[email protected]>
Mukund Madhusudan Atre 3 jaren geleden
bovenliggende
commit
5624995aec
1 gewijzigde bestanden met toevoegingen van 17 en 1 verwijderingen
  1. 17 1
      drivers/cam_req_mgr/cam_req_mgr_dev.c

+ 17 - 1
drivers/cam_req_mgr/cam_req_mgr_dev.c

@@ -30,6 +30,7 @@
 #include "cam_compat.h"
 #include "cam_cpas_hw.h"
 #include "cam_compat.h"
+#include "camera_main.h"
 
 #define CAM_REQ_MGR_EVENT_MAX 30
 
@@ -1047,9 +1048,23 @@ static int cam_req_mgr_remove(struct platform_device *pdev)
 
 static int cam_req_mgr_probe(struct platform_device *pdev)
 {
-	int rc = 0;
+	int rc = 0, i;
 	struct component_match *match_list = NULL;
 	struct device *dev = &pdev->dev;
+	struct device_node *np = NULL;
+
+	for (i = 0; i < ARRAY_SIZE(cam_component_i2c_drivers); i++) {
+		while ((np = of_find_compatible_node(np, NULL,
+			cam_component_i2c_drivers[i]->driver.of_match_table->compatible))) {
+			if (of_device_is_available(np) && !(of_find_i2c_device_by_node(np))) {
+				CAM_INFO_RATE_LIMIT(CAM_CRM,
+					"I2C device: %s not available, deferring probe",
+					np->full_name);
+				rc = -EPROBE_DEFER;
+				goto end;
+			}
+		}
+	}
 
 	rc = camera_component_match_add_drivers(dev, &match_list);
 	if (rc) {
@@ -1070,6 +1085,7 @@ static int cam_req_mgr_probe(struct platform_device *pdev)
 	}
 
 end:
+	of_node_put(np);
 	return rc;
 }