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

Function regulator_ofw_parse

components/drivers/regulator/regulator_dm.c:14–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13#ifdef RT_USING_OFW
14rt_err_t regulator_ofw_parse(struct rt_ofw_node *np, struct rt_regulator_param *param)
15{
16 rt_uint32_t pval;
17
18 param->name = rt_ofw_prop_read_raw(np, "regulator-name", RT_NULL);
19
20 if (!rt_ofw_prop_read_u32(np, "regulator-min-microvolt", &pval))
21 {
22 param->min_uvolt = pval;
23 }
24
25 if (!rt_ofw_prop_read_u32(np, "regulator-max-microvolt", &pval))
26 {
27 param->max_uvolt = pval;
28 }
29
30 if (!rt_ofw_prop_read_u32(np, "regulator-min-microamp", &pval))
31 {
32 param->min_uamp = pval;
33 }
34
35 if (!rt_ofw_prop_read_u32(np, "regulator-max-microamp", &pval))
36 {
37 param->max_uamp = pval;
38 }
39
40 if (!rt_ofw_prop_read_u32(np, "regulator-ramp-delay", &pval))
41 {
42 param->ramp_delay = pval;
43 }
44
45 if (!rt_ofw_prop_read_u32(np, "regulator-enable-ramp-delay", &pval))
46 {
47 param->enable_delay = pval;
48 }
49
50 param->enable_active_high = rt_ofw_prop_read_bool(np, "enable-active-high");
51 param->boot_on = rt_ofw_prop_read_bool(np, "regulator-boot-on");
52 param->always_on = rt_ofw_prop_read_bool(np, "regulator-always-on");
53 param->soft_start = rt_ofw_prop_read_bool(np, "regulator-soft-start");
54 param->pull_down = rt_ofw_prop_read_bool(np, "regulator-pull-down");
55 param->over_current_protection = rt_ofw_prop_read_bool(np, "regulator-over-current-protection");
56
57 return RT_EOK;
58}
59#endif /* RT_USING_OFW */

Callers 2

regulator_gpio_probeFunction · 0.85
regulator_fixed_probeFunction · 0.85

Calls 3

rt_ofw_prop_read_rawFunction · 0.85
rt_ofw_prop_read_u32Function · 0.85
rt_ofw_prop_read_boolFunction · 0.85

Tested by

no test coverage detected