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

Function rt_regulator_register

components/drivers/regulator/regulator.c:32–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30static rt_err_t regulator_disable(struct rt_regulator_node *reg_np);
31
32rt_err_t rt_regulator_register(struct rt_regulator_node *reg_np)
33{
34 const struct rt_regulator_param *param;
35
36 if (!reg_np || !reg_np->dev || !reg_np->param || !reg_np->ops)
37 {
38 return -RT_EINVAL;
39 }
40
41 rt_list_init(&reg_np->list);
42 rt_list_init(&reg_np->children_nodes);
43 rt_list_init(&reg_np->notifier_nodes);
44 rt_ref_init(&reg_np->ref);
45 rt_atomic_store(&reg_np->enabled_count, 0);
46
47 param = reg_np->param;
48
49 reg_np->parent = RT_NULL;
50
51#ifdef RT_USING_OFW
52 if (reg_np->dev->ofw_node)
53 {
54 rt_ofw_data(reg_np->dev->ofw_node) = reg_np;
55 }
56#endif /* RT_USING_OFW */
57
58 if (param->boot_on || param->always_on)
59 {
60 regulator_enable(reg_np);
61 }
62
63 return RT_EOK;
64}
65
66rt_err_t rt_regulator_unregister(struct rt_regulator_node *reg_np)
67{

Callers 2

regulator_gpio_probeFunction · 0.85
regulator_fixed_probeFunction · 0.85

Calls 3

rt_list_initFunction · 0.85
rt_ref_initFunction · 0.85
regulator_enableFunction · 0.70

Tested by

no test coverage detected