Browse Source

msm: camera: cpas: Update bus node level parsing logic

Currently, the order in which we read the camera bus nodes
is dependent of the order camera device tree is laid out,
which causes issues if the arragement is changed. Update DT
parsing logic to read node levels independent of arrangement.

CRs-Fixed: 2841729
Change-Id: I73f2aa27a71d6521fe4e1fc9af95293411bd75c2
Signed-off-by: Mukund Madhusudan Atre <[email protected]>
Mukund Madhusudan Atre 4 năm trước cách đây
mục cha
commit
d099238a67

+ 9 - 2
drivers/cam_cpas/cam_cpas_soc.c

@@ -186,13 +186,13 @@ static int cam_cpas_parse_node_tree(struct cam_cpas *cpas_core,
 	struct device_node *curr_node;
 	struct device_node *curr_node;
 	struct device_node *parent_node;
 	struct device_node *parent_node;
 	struct device_node *mnoc_node;
 	struct device_node *mnoc_node;
-	int mnoc_idx = 0, camnoc_idx = 0;
+	int mnoc_idx = 0, camnoc_idx = 0, level_idx = 0;
 	uint32_t path_idx;
 	uint32_t path_idx;
 	bool camnoc_max_needed = false;
 	bool camnoc_max_needed = false;
 	struct cam_cpas_tree_node *curr_node_ptr = NULL;
 	struct cam_cpas_tree_node *curr_node_ptr = NULL;
 	struct cam_cpas_client *curr_client = NULL;
 	struct cam_cpas_client *curr_client = NULL;
 	const char *client_name = NULL;
 	const char *client_name = NULL;
-	uint32_t client_idx = 0, cell_idx = 0, level_idx = 0;
+	uint32_t client_idx = 0, cell_idx = 0;
 	int rc = 0, count = 0, i;
 	int rc = 0, count = 0, i;
 
 
 	camera_bus_node = of_get_child_by_name(of_node, "camera-bus-nodes");
 	camera_bus_node = of_get_child_by_name(of_node, "camera-bus-nodes");
@@ -218,6 +218,13 @@ static int cam_cpas_parse_node_tree(struct cam_cpas *cpas_core,
 		soc_private->level_node[level_idx] = level_node;
 		soc_private->level_node[level_idx] = level_node;
 		camnoc_max_needed = of_property_read_bool(level_node,
 		camnoc_max_needed = of_property_read_bool(level_node,
 			"camnoc-max-needed");
 			"camnoc-max-needed");
+	}
+
+	for (level_idx = (CAM_CPAS_MAX_TREE_LEVELS - 1); level_idx >= 0;
+		level_idx--) {
+		level_node = soc_private->level_node[level_idx];
+		if (!level_node)
+			continue;
 
 
 		for_each_available_child_of_node(level_node, curr_node) {
 		for_each_available_child_of_node(level_node, curr_node) {
 			curr_node_ptr =
 			curr_node_ptr =

+ 1 - 1
drivers/cam_cpas/cam_cpas_soc.h

@@ -53,7 +53,7 @@ struct cam_cpas_vdd_ahb_mapping {
  */
  */
 struct cam_cpas_tree_node {
 struct cam_cpas_tree_node {
 	uint32_t cell_idx;
 	uint32_t cell_idx;
-	uint32_t level_idx;
+	int level_idx;
 	int axi_port_idx;
 	int axi_port_idx;
 	int camnoc_axi_port_idx;
 	int camnoc_axi_port_idx;
 	const char *node_name;
 	const char *node_name;