|
63 | 63 |
|
64 | 64 | struct thermal_zone_device;
|
65 | 65 | struct thermal_cooling_device;
|
| 66 | +struct thermal_instance; |
66 | 67 |
|
67 | 68 | enum thermal_device_mode {
|
68 | 69 | THERMAL_DEVICE_DISABLED = 0,
|
@@ -116,6 +117,12 @@ struct thermal_cooling_device_ops {
|
116 | 117 | int (*get_max_state) (struct thermal_cooling_device *, unsigned long *);
|
117 | 118 | int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *);
|
118 | 119 | int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
|
| 120 | + int (*get_requested_power)(struct thermal_cooling_device *, |
| 121 | + struct thermal_zone_device *, u32 *); |
| 122 | + int (*state2power)(struct thermal_cooling_device *, |
| 123 | + struct thermal_zone_device *, unsigned long, u32 *); |
| 124 | + int (*power2state)(struct thermal_cooling_device *, |
| 125 | + struct thermal_zone_device *, u32, unsigned long *); |
119 | 126 | };
|
120 | 127 |
|
121 | 128 | struct thermal_cooling_device {
|
@@ -331,6 +338,16 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
|
331 | 338 | #endif
|
332 | 339 |
|
333 | 340 | #if IS_ENABLED(CONFIG_THERMAL)
|
| 341 | +static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) |
| 342 | +{ |
| 343 | + return cdev->ops->get_requested_power && cdev->ops->state2power && |
| 344 | + cdev->ops->power2state; |
| 345 | +} |
| 346 | + |
| 347 | +int power_actor_get_max_power(struct thermal_cooling_device *, |
| 348 | + struct thermal_zone_device *tz, u32 *max_power); |
| 349 | +int power_actor_set_power(struct thermal_cooling_device *, |
| 350 | + struct thermal_instance *, u32); |
334 | 351 | struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
|
335 | 352 | void *, struct thermal_zone_device_ops *,
|
336 | 353 | const struct thermal_zone_params *, int, int);
|
@@ -359,6 +376,14 @@ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
|
359 | 376 | void thermal_cdev_update(struct thermal_cooling_device *);
|
360 | 377 | void thermal_notify_framework(struct thermal_zone_device *, int);
|
361 | 378 | #else
|
| 379 | +static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) |
| 380 | +{ return false; } |
| 381 | +static inline int power_actor_get_max_power(struct thermal_cooling_device *cdev, |
| 382 | + struct thermal_zone_device *tz, u32 *max_power) |
| 383 | +{ return 0; } |
| 384 | +static inline int power_actor_set_power(struct thermal_cooling_device *cdev, |
| 385 | + struct thermal_instance *tz, u32 power) |
| 386 | +{ return 0; } |
362 | 387 | static inline struct thermal_zone_device *thermal_zone_device_register(
|
363 | 388 | const char *type, int trips, int mask, void *devdata,
|
364 | 389 | struct thermal_zone_device_ops *ops,
|
|
0 commit comments