struct pass_resource *res = user_data;
struct pass_level *levels;
struct pass_cpuhp *cpuhp;
- double curr_gov_timeout, next_gov_timeout;
+ int curr_gov_timeout, next_gov_timeout;
int level;
if (!res) {
* same as the current one
*/
if (curr_gov_timeout != next_gov_timeout) {
- _I("Change the period of governor timer from %fs to %fs\n",
+ _I("Change the period of governor timer from %dms to %dms\n",
curr_gov_timeout,
next_gov_timeout);
pass_resmon_update_timer_interval(res, cpuhp->timer_id,
- next_gov_timeout * 1000);
+ next_gov_timeout);
}
return TRUE;
/* Register the resource-monitor for CPUHP module */
ret = pass_resmon_register_timer(res, RESMON_SRC_CPUHP,
RESMON_TIMER_PERIODIC,
- res->config_data.gov_timeout * 1000,
+ res->config_data.gov_timeout,
cpuhp_timer_func,
res);
if (ret < 0) {
struct pass_cpuhp *cpuhp = &res->cpuhp;
if (res->config_data.gov_timeout < 0) {
- _E("invalid timeout value [%lf]!", res->config_data.gov_timeout);
+ _E("invalid timeout value [%d]!", res->config_data.gov_timeout);
cpuhp_governor_update(res, PASS_OFF);
return -EINVAL;
}
#include "pass.h"
#define MAX_NUM 255
-#define MIN_TIMEOUT_SEC 0.2 /* 200 millisecond */
-#define MAX_TIMEOUT_SEC 3600.0 /* 1 hour */
+#define MIN_TIMEOUT_MS 200
+#define MAX_TIMEOUT_MS 3600000 /* 1 hour */
#define INIT_VALUE -1
static int compare_compatible_name(const char *compatible,
int num_left_cond_freq;
int num_left_cond_nr_running;
int num_left_cond_busy_cpu;
- double governor_timeout_sec;
+ int governor_timeout_ms;
int fault_around_bytes;
int cooling_device_state;
int charging_status;
ret += get_property(obj, "hotplug,num_left_cond_busy_cpu", DATA_TYPE_INT,
false, (void *)&num_left_cond_busy_cpu);
- ret += get_property(obj, "hotplug,governor_timeout_sec", DATA_TYPE_DOUBLE,
- false, (void *)&governor_timeout_sec);
+ ret += get_property(obj, "hotplug,governor_timeout_ms", DATA_TYPE_INT,
+ false, (void *)&governor_timeout_ms);
ret += get_property(obj, "memory,fault_around_bytes", DATA_TYPE_INT,
false, (void *)&fault_around_bytes);
if (num_right_cond_busy_cpu >= 0)
target_level->right_cond[0].busy_cpu = num_right_cond_busy_cpu;
- if (governor_timeout_sec >= 0) {
- if (governor_timeout_sec < MIN_TIMEOUT_SEC
- || governor_timeout_sec > MAX_TIMEOUT_SEC)
- governor_timeout_sec = MIN_TIMEOUT_SEC;
- target_level->gov_timeout = governor_timeout_sec;
+ if (governor_timeout_ms >= 0) {
+ if (governor_timeout_ms < MIN_TIMEOUT_MS
+ || governor_timeout_ms > MAX_TIMEOUT_MS)
+ governor_timeout_ms = MIN_TIMEOUT_MS;
+ target_level->gov_timeout = governor_timeout_ms;
}
/*
{
int cpuhp_support;
int cpuhp_governor;
- double cpuhp_timer_interval_sec;
+ int cpuhp_timer_interval_ms;
int cpuhp_min_level;
int cpuhp_max_level;
int cpuhp_init_level;
true, (void *)&cpuhp_support);
ret += get_property(obj, "cpuhp_governor", DATA_TYPE_INT,
false, (void *)&cpuhp_governor);
- ret += get_property(obj, "cpuhp_timer_interval_sec", DATA_TYPE_DOUBLE,
- false, (void *)&cpuhp_timer_interval_sec);
+ ret += get_property(obj, "cpuhp_timer_interval_ms", DATA_TYPE_INT,
+ false, (void *)&cpuhp_timer_interval_ms);
ret += get_property(obj, "cpuhp_min_level", DATA_TYPE_INT,
false, (void *)&cpuhp_min_level);
ret += get_property(obj, "cpuhp_max_level", DATA_TYPE_INT,
/* - core */
res->config_data.state = cpuhp_support;
res->config_data.gov_type = cpuhp_governor;
- res->config_data.gov_timeout = cpuhp_timer_interval_sec;
- if (res->config_data.gov_timeout < MIN_TIMEOUT_SEC
- || res->config_data.gov_timeout > MAX_TIMEOUT_SEC)
- res->config_data.gov_timeout = MIN_TIMEOUT_SEC;
+ res->config_data.gov_timeout = cpuhp_timer_interval_ms;
+ if (res->config_data.gov_timeout < MIN_TIMEOUT_MS
+ || res->config_data.gov_timeout > MAX_TIMEOUT_MS)
+ res->config_data.gov_timeout = MIN_TIMEOUT_MS;
/* - properties for rescon module */
res->rescon.min_level = cpuhp_min_level;