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

Function thermal_ofw_params_parse

components/drivers/thermal/thermal.c:32–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31#ifdef RT_USING_OFW
32static void thermal_ofw_params_parse(struct rt_ofw_node *np,
33 struct rt_thermal_zone_params *tz_params)
34{
35 rt_uint32_t coef[2], prop;
36
37 if (!np)
38 {
39 return;
40 }
41
42 if (!rt_ofw_prop_read_u32(np, "sustainable-power", &prop))
43 {
44 tz_params->sustainable_power = prop;
45 }
46
47 /*
48 * For now, the thermal framework supports only one sensor per thermal zone.
49 * Thus, we are considering only the first two values as slope and offset.
50 */
51 if (rt_ofw_prop_read_u32_array_index(np, "coefficients", 0, 2, coef) < 0)
52 {
53 coef[0] = 1;
54 coef[1] = 0;
55 }
56
57 tz_params->slope = coef[0];
58 tz_params->offset = coef[1];
59}
60
61static void thermal_ofw_setup(struct rt_ofw_node *np, struct rt_thermal_zone_device *zdev)
62{

Callers 1

thermal_ofw_setupFunction · 0.85

Calls 1

rt_ofw_prop_read_u32Function · 0.85

Tested by

no test coverage detected