Browse Source

msm: camera: common: Add support to populate i3c slaves as platform device

Currently, the mechanism to create platform device out of i3c slave DT
nodes is done through "simple-bus" compatibility string in camera DT. The
addition of this compatibility string in parent nodes is causing probes
to be fired for parent drivers when they don't expect it. Change this
mechanism and add support to do the same using of_platform_populate()
call for camera sensor module nodes under i3c master DT node.

CRs-Fixed: 3259550
Change-Id: I92523e7178ff78cdc783ca0b67b2dfbcebd0be61
Signed-off-by: Mukund Madhusudan Atre <[email protected]>
Mukund Madhusudan Atre 2 năm trước cách đây
mục cha
commit
11d9f8afa7
1 tập tin đã thay đổi với 21 bổ sung0 xóa
  1. 21 0
      drivers/cam_req_mgr/cam_req_mgr_dev.c

+ 21 - 0
drivers/cam_req_mgr/cam_req_mgr_dev.c

@@ -33,6 +33,7 @@
 #include "camera_main.h"
 
 #define CAM_REQ_MGR_EVENT_MAX 30
+#define CAM_I3C_MASTER_COMPAT "qcom,geni-i3c"
 
 static struct cam_req_mgr_device g_dev;
 struct kmem_cache *g_cam_req_mgr_timer_cachep;
@@ -43,6 +44,15 @@ DECLARE_RWSEM(rwsem_lock);
 static struct device_attribute camera_debug_sysfs_attr =
 	__ATTR(debug_node, 0600, NULL, cam_debug_sysfs_node_store);
 
+static const struct of_device_id cam_sensor_module_dt_match[] = {
+	{.compatible = "qcom,cam-sensor"},
+	{ .compatible = "qcom,eeprom" },
+	{.compatible = "qcom,actuator"},
+	{ .compatible = "qcom,ois" },
+	{.compatible = "qcom,camera-flash", .data = NULL},
+	{}
+};
+
 static int cam_media_device_setup(struct device *dev)
 {
 	int rc;
@@ -1092,6 +1102,17 @@ static int cam_req_mgr_probe(struct platform_device *pdev)
 		}
 	}
 
+	np = NULL;
+	while ((np = of_find_compatible_node(np, NULL, CAM_I3C_MASTER_COMPAT))) {
+		rc = of_platform_populate(np, cam_sensor_module_dt_match, NULL, NULL);
+		if (rc) {
+			CAM_ERR(CAM_CRM,
+				"Failed to populate child nodes as platform devices for parent: %s, rc=%d",
+				np->full_name, rc);
+			goto end;
+		}
+	}
+
 	rc = camera_component_match_add_drivers(dev, &match_list);
 	if (rc) {
 		CAM_ERR(CAM_CRM,