| 30 | |
| 31 | #ifdef RT_USING_OFW |
| 32 | static 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 | |
| 61 | static void thermal_ofw_setup(struct rt_ofw_node *np, struct rt_thermal_zone_device *zdev) |
| 62 | { |
no test coverage detected