| 30 | static rt_err_t regulator_disable(struct rt_regulator_node *reg_np); |
| 31 | |
| 32 | rt_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(®_np->list); |
| 42 | rt_list_init(®_np->children_nodes); |
| 43 | rt_list_init(®_np->notifier_nodes); |
| 44 | rt_ref_init(®_np->ref); |
| 45 | rt_atomic_store(®_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 | |
| 66 | rt_err_t rt_regulator_unregister(struct rt_regulator_node *reg_np) |
| 67 | { |
no test coverage detected