RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
thermal.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2006-2022, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2022-3-08 GuEe-GUI the first version
9 */
10
11#ifndef __THERMAL_H__
12#define __THERMAL_H__
13
14#include <rtdef.h>
15#include <dt-bindings/thermal/thermal.h>
16
17/* No upper/lower limit requirement */
18#define RT_THERMAL_NO_LIMIT ((rt_uint32_t)THERMAL_NO_LIMIT)
19#define RT_THERMAL_TEMP_INVALID (-274000)
20
25
35
37{
38 /* Temperature value in millidegree celsius */
40 /* Relative hysteresis in millidegree celsius */
43
44 void *priv;
45};
46
48{
49 /* Sustainable power (heat) that this thermal zone can dissipate in mW */
51 /* Slope of a linear temperature adjustment curve */
52 int slope;
53 /* Offset of a linear temperature adjustment curve */
54 int offset;
55};
56
63
72
105
107{
108 rt_err_t (*get_temp)(struct rt_thermal_zone_device *zdev, int *out_temp);
109 rt_err_t (*set_trips)(struct rt_thermal_zone_device *zdev, int low_temp, int high_temp);
110 rt_err_t (*set_trip_temp)(struct rt_thermal_zone_device *zdev, int trip_id, int temp);
111 rt_err_t (*set_trip_hyst)(struct rt_thermal_zone_device *zdev, int trip_id, int hyst);
112 void (*hot)(struct rt_thermal_zone_device *zdev);
113 void (*critical)(struct rt_thermal_zone_device *zdev);
114};
115
116/*
117 * We don't want to make a temperature control system
118 * that is finer than an air conditioner's temperature control,
119 * just ensure get a reliable heat dissipation under high-load task
120 * or when the SoC temperature is too high.
121 */
123{
125
127
128 /* The cooling capacity indicator */
132
133 void *priv;
134};
135
144
146{
148
149 const char *name;
151
152 void (*tuning)(struct rt_thermal_zone_device *zdev,
153 int map_idx, int cell_idx, rt_ubase_t *level);
154};
155
157
158#define RT_THERMAL_MSG_EVENT_UNSPECIFIED RT_BIT(0) /* Unspecified event */
159#define RT_THERMAL_MSG_EVENT_TEMP_SAMPLE RT_BIT(1) /* New Temperature sample */
160#define RT_THERMAL_MSG_TRIP_VIOLATED RT_BIT(2) /* TRIP Point violation */
161#define RT_THERMAL_MSG_TRIP_CHANGED RT_BIT(3) /* TRIP Point temperature changed */
162#define RT_THERMAL_MSG_DEVICE_DOWN RT_BIT(4) /* Thermal device is down */
163#define RT_THERMAL_MSG_DEVICE_UP RT_BIT(5) /* Thermal device is up after a down event */
164#define RT_THERMAL_MSG_DEVICE_POWER_CAPABILITY_CHANGED RT_BIT(6) /* Power capability changed */
165#define RT_THERMAL_MSG_TABLE_CHANGED RT_BIT(7) /* Thermal table(s) changed */
166#define RT_THERMAL_MSG_EVENT_KEEP_ALIVE RT_BIT(8) /* Request for user space handler to respond */
167
169 rt_ubase_t msg);
170
179
182
185
188
190 const char *name);
191
193 struct rt_thermal_notifier *notifier);
195 struct rt_thermal_notifier *notifier);
196
199
201 const struct rt_thermal_trip *trip);
203 struct rt_thermal_trip *out_trip);
204
205#endif /* __THERMAL_H__ */
int rt_bool_t
rt_base_t rt_err_t
rt_uint32_t rt_tick_t
rt_ubase_t rt_size_t
struct rt_list_node rt_list_t
unsigned int rt_uint32_t
rt_uint32_t rt_ubase_t
struct rt_thermal_cooling_device * cooling_devices
rt_uint32_t level_range[2]
rt_err_t(* bind)(struct rt_thermal_cooling_device *cdev, struct rt_thermal_zone_device *zdev)
rt_err_t(* get_max_level)(struct rt_thermal_cooling_device *cdev, rt_ubase_t *out_level)
rt_err_t(* set_cur_level)(struct rt_thermal_cooling_device *cdev, rt_ubase_t level)
rt_err_t(* get_cur_level)(struct rt_thermal_cooling_device *cdev, rt_ubase_t *out_level)
rt_err_t(* unbind)(struct rt_thermal_cooling_device *cdev, struct rt_thermal_zone_device *zdev)
const struct rt_thermal_cooling_device_ops * ops
struct rt_thermal_cooling_governor * gov
void(* tuning)(struct rt_thermal_zone_device *zdev, int map_idx, int cell_idx, rt_ubase_t *level)
struct rt_thermal_cooling_cell * cells
struct rt_thermal_trip * trips
rt_thermal_notifier_callback callback
struct rt_thermal_zone_device * zdev
enum rt_thermal_trip_type type
struct rt_device parent
const struct rt_thermal_zone_ops * ops
struct rt_spinlock nodes_lock
struct rt_thermal_cooling_map * cooling_maps
struct rt_thermal_zone_params params
struct rt_mutex mutex
struct rt_work poller
struct rt_thermal_trip * trips
void(* hot)(struct rt_thermal_zone_device *zdev)
rt_err_t(* set_trip_hyst)(struct rt_thermal_zone_device *zdev, int trip_id, int hyst)
rt_err_t(* set_trips)(struct rt_thermal_zone_device *zdev, int low_temp, int high_temp)
rt_err_t(* set_trip_temp)(struct rt_thermal_zone_device *zdev, int trip_id, int temp)
rt_err_t(* get_temp)(struct rt_thermal_zone_device *zdev, int *out_temp)
void(* critical)(struct rt_thermal_zone_device *zdev)
rt_err_t rt_thermal_cooling_device_unregister(struct rt_thermal_cooling_device *cdev)
rt_err_t rt_thermal_zone_set_trip(struct rt_thermal_zone_device *zdev, int trip_id, const struct rt_thermal_trip *trip)
void rt_thermal_cooling_device_kick(struct rt_thermal_zone_device *zdev)
rt_err_t rt_thermal_zone_device_unregister(struct rt_thermal_zone_device *zdev)
void rt_thermal_zone_device_update(struct rt_thermal_zone_device *zdev, rt_ubase_t msg)
rt_err_t rt_thermal_zone_get_trip(struct rt_thermal_zone_device *zdev, int trip_id, struct rt_thermal_trip *out_trip)
rt_err_t rt_thermal_zone_notifier_unregister(struct rt_thermal_zone_device *zdev, struct rt_thermal_notifier *notifier)
rt_err_t rt_thermal_cooling_device_change_governor(struct rt_thermal_cooling_device *cdev, const char *name)
rt_err_t(* rt_thermal_notifier_callback)(struct rt_thermal_notifier *notifier, rt_ubase_t msg)
rt_thermal_trip_type
@ RT_THERMAL_TRIP_PASSIVE
@ RT_THERMAL_TRIP_ACTIVE
@ RT_THERMAL_TRIP_CRITICAL
@ RT_THERMAL_TRIP_HOT
@ RT_THERMAL_TRIP_TYPE_MAX
rt_err_t rt_thermal_zone_notifier_register(struct rt_thermal_zone_device *zdev, struct rt_thermal_notifier *notifier)
rt_err_t rt_thermal_zone_device_register(struct rt_thermal_zone_device *zdev)
rt_err_t rt_thermal_cooling_device_register(struct rt_thermal_cooling_device *cdev)
rt_err_t rt_thermal_cooling_governor_unregister(struct rt_thermal_cooling_governor *gov)
rt_err_t rt_thermal_cooling_governor_register(struct rt_thermal_cooling_governor *gov)