MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / regulator_check_parent

Function regulator_check_parent

components/drivers/regulator/regulator.c:505–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503}
504
505static void regulator_check_parent(struct rt_regulator_node *reg_np)
506{
507 if (reg_np->parent)
508 {
509 return;
510 }
511 else
512 {
513 #ifdef RT_USING_OFW
514 rt_phandle parent_phandle = 0;
515 struct rt_ofw_node *np = reg_np->dev->ofw_node;
516
517 while (np)
518 {
519 if (rt_ofw_prop_read_u32(np, "vin-supply", &parent_phandle))
520 {
521 break;
522 }
523
524 if (!(np = rt_ofw_find_node_by_phandle(parent_phandle)))
525 {
526 break;
527 }
528
529 if (!(reg_np->parent = rt_ofw_data(np)))
530 {
531 LOG_W("%s parent ofw node = %s not init",
532 reg_np->supply_name, rt_ofw_node_full_name(np));
533
534 rt_ofw_node_put(np);
535 break;
536 }
537
538 rt_list_insert_after(&reg_np->parent->children_nodes, &reg_np->list);
539 rt_ofw_node_put(np);
540 }
541 #endif
542 }
543}
544
545struct rt_regulator *rt_regulator_get(struct rt_device *dev, const char *id)
546{

Callers 1

rt_regulator_getFunction · 0.85

Calls 5

rt_ofw_prop_read_u32Function · 0.85
rt_ofw_node_full_nameFunction · 0.85
rt_ofw_node_putFunction · 0.85
rt_list_insert_afterFunction · 0.85

Tested by

no test coverage detected