-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy pathregulator_dm.c
More file actions
78 lines (64 loc) · 2.04 KB
/
Copy pathregulator_dm.c
File metadata and controls
78 lines (64 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-09-23 GuEe-GUI first version
*/
#include "regulator_dm.h"
#ifdef RT_USING_OFW
rt_err_t regulator_ofw_parse(struct rt_ofw_node *np, struct rt_regulator_param *param)
{
rt_uint32_t pval;
param->name = rt_ofw_prop_read_raw(np, "regulator-name", RT_NULL);
if (!rt_ofw_prop_read_u32(np, "regulator-min-microvolt", &pval))
{
param->min_uvolt = pval;
}
if (!rt_ofw_prop_read_u32(np, "regulator-max-microvolt", &pval))
{
param->max_uvolt = pval;
}
if (!rt_ofw_prop_read_u32(np, "regulator-min-microamp", &pval))
{
param->min_uamp = pval;
}
if (!rt_ofw_prop_read_u32(np, "regulator-max-microamp", &pval))
{
param->max_uamp = pval;
}
if (!rt_ofw_prop_read_u32(np, "regulator-ramp-delay", &pval))
{
param->ramp_delay = pval;
}
else
{
param->ramp_disable = RT_TRUE;
}
if (!rt_ofw_prop_read_u32(np, "regulator-enable-ramp-delay", &pval))
{
param->enable_delay = pval;
}
if (!rt_ofw_prop_read_u32(np, "regulator-settling-time-us", &pval))
{
param->settling_time = pval;
}
if (!rt_ofw_prop_read_u32(np, "regulator-settling-time-up-us", &pval))
{
param->settling_time_up = pval;
}
if (!rt_ofw_prop_read_u32(np, "regulator-settling-time-down-us", &pval))
{
param->settling_time_down = pval;
}
param->enable_active_high = rt_ofw_prop_read_bool(np, "enable-active-high");
param->boot_on = rt_ofw_prop_read_bool(np, "regulator-boot-on");
param->always_on = rt_ofw_prop_read_bool(np, "regulator-always-on");
param->soft_start = rt_ofw_prop_read_bool(np, "regulator-soft-start");
param->pull_down = rt_ofw_prop_read_bool(np, "regulator-pull-down");
param->over_current_protection = rt_ofw_prop_read_bool(np, "regulator-over-current-protection");
return RT_EOK;
}
#endif /* RT_USING_OFW */