/* Register all SoC external sub-devices */ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) { struct device_node *parent = fmd->pdev->dev.of_node; struct device_node *node, *ports; int index = 0; int ret; /* * Runtime resume one of the FIMC entities to make sure * the sclk_cam clocks are not globally disabled. */ if (!fmd->pmf) return -ENXIO; ret = pm_runtime_get_sync(fmd->pmf); if (ret < 0) return ret; fmd->num_sensors = 0; /* Attach sensors linked to MIPI CSI-2 receivers */ for_each_available_child_of_node(parent, node) { struct device_node *port; if (of_node_cmp(node->name, "csis")) continue; /* The csis node can have only port subnode. */ port = of_get_next_child(node, NULL); if (!port) continue; ret = fimc_md_parse_port_node(fmd, port, index); if (ret < 0) { of_node_put(node); goto rpm_put; } index++; } /* Attach sensors listed in the parallel-ports node */ ports = of_get_child_by_name(parent, "parallel-ports"); if (!ports) goto rpm_put; for_each_child_of_node(ports, node) { ret = fimc_md_parse_port_node(fmd, node, index); if (ret < 0) { of_node_put(node); break; } index++; }
/* Register all SoC external sub-devices */ static int fimc_md_of_sensors_register(struct fimc_md *fmd, struct device_node *np) { struct device_node *parent = fmd->pdev->dev.of_node; struct device_node *node, *ports; int index = 0; int ret; /* Attach sensors linked to MIPI CSI-2 receivers */ for_each_available_child_of_node(parent, node) { struct device_node *port; if (of_node_cmp(node->name, "csis")) continue; /* The csis node can have only port subnode. */ port = of_get_next_child(node, NULL); if (!port) continue; ret = fimc_md_parse_port_node(fmd, port, index); if (ret < 0) return ret; index++; } /* Attach sensors listed in the parallel-ports node */ ports = of_get_child_by_name(parent, "parallel-ports"); if (!ports) return 0; for_each_child_of_node(ports, node) { ret = fimc_md_parse_port_node(fmd, node, index); if (ret < 0) break; index++; }