thermal: power_allocator: Add support to change state by system monitor

Change-Id: Ib0ed0c5df3fbae078be7ec88e93ba69cee894286
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
Finley Xiao
2019-04-01 21:27:52 +08:00
committed by Tao Huang
parent 89b636c1e5
commit 2fa7e1c4ed
2 changed files with 20 additions and 0 deletions

View File

@@ -19,6 +19,9 @@
#include <linux/slab.h>
#include <linux/thermal.h>
#ifdef CONFIG_ARCH_ROCKCHIP
#include <soc/rockchip/rockchip_system_monitor.h>
#endif
#define CREATE_TRACE_POINTS
#include <trace/events/thermal_power_allocator.h>
@@ -530,6 +533,11 @@ static void allow_maximum_power(struct thermal_zone_device *tz)
continue;
instance->target = 0;
#ifdef CONFIG_ARCH_ROCKCHIP
rockchip_system_monitor_adjust_cdev_state(instance->cdev,
tz->temperature,
&instance->target);
#endif
mutex_lock(&instance->cdev->lock);
instance->cdev->updated = false;
mutex_unlock(&instance->cdev->lock);

View File

@@ -22,6 +22,9 @@
#include <net/netlink.h>
#include <net/genetlink.h>
#include <linux/suspend.h>
#ifdef CONFIG_ARCH_ROCKCHIP
#include <soc/rockchip/rockchip_system_monitor.h>
#endif
#define CREATE_TRACE_POINTS
#include <trace/events/thermal.h>
@@ -587,6 +590,15 @@ int power_actor_set_power(struct thermal_cooling_device *cdev,
return -EINVAL;
ret = cdev->ops->power2state(cdev, instance->tz, power, &state);
#ifdef CONFIG_ARCH_ROCKCHIP
if (ret)
state = THERMAL_CSTATE_INVALID;
rockchip_system_monitor_adjust_cdev_state(cdev,
instance->tz->temperature,
&state);
if (state == THERMAL_CSTATE_INVALID)
ret = -EINVAL;
#endif
if (ret)
return ret;