Fix values of the flag.
Signed-off-by: Lukasz Luba l.luba@partner.samsung.com --- kernel/sched/power.c | 28 +++++++++++++++++----------- kernel/sched/sched.h | 6 +++--- 2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/kernel/sched/power.c b/kernel/sched/power.c index 5639e6c2825d..fded1ba78b5e 100644 --- a/kernel/sched/power.c +++ b/kernel/sched/power.c @@ -131,15 +131,15 @@ EXPORT_SYMBOL_GPL(sched_power_cpu_reinit_weight); //////////////////////////////////////////////////////////////
-static bool should_update_next_weight(u64 time, int flags) +static bool should_process_next_request(u64 time, int flags) { if (flags & SCHED_POWER_FORCE_UPDATE_RT) return 1;
- if (time >= sched_clock() + MINIMUM_UPDATE_TIME) - return 1; + /* if (time >= sched_clock() + MINIMUM_UPDATE_TIME) */ + /* return 1; */
- return 0; + return 1; }
static int play_idle_setup; @@ -240,12 +240,14 @@ static int sched_power_reweight_cluster(int cpu, struct cpumask *cpus, mutex_unlock(&tz_list_lock);
if (system_zone) { + pr_info("zone found\n"); mutex_lock(&system_zone->lock); cluster_inst->weight = weight; mutex_unlock(&system_zone->lock); thermal_notify_framework(system_zone->tz, system_zone->trip_ctrl_alg.desired_id); } else { + pr_info("no such zone\n"); return -ENODEV; }
@@ -277,6 +279,7 @@ static int sched_power_handle_request(struct power_request *req)
cpower = (&per_cpu(cpu_power, req->cpu));
+ pr_info("req->flags=%d\n", req->flags); switch (req->flags) { case SCHED_POWER_CPU_WEIGHT: break; @@ -338,7 +341,7 @@ static void sched_power_irq_work(struct irq_work *irq_work) }
static void -sched_power_update_cpu_weight(struct cpu_power *cpower, int cpu, int weight, +sched_power_update_weight(struct cpu_power *cpower, int cpu, int weight, int flags, int time) { raw_spin_lock(&cpower->update_lock); @@ -361,15 +364,17 @@ static void sched_power_update(struct update_sched_power *update, int cpu, return;
/* Filter to frequent changes or not needed*/ - if (!should_update_next_weight(time, flags)) + if (!should_process_next_request(time, flags)) return;
+ flags &= 0x3; + switch (flags) { case SCHED_POWER_CPU_WEIGHT: - sched_power_update_cpu_weight(cpower, cpu, weight, flags, time); + sched_power_update_weight(cpower, cpu, weight, flags, time); break; case SCHED_POWER_CLUSTER_WEIGHT: - + sched_power_update_weight(cpower, cpu, weight, flags, time); break; default: return; @@ -382,7 +387,8 @@ static void sched_power_update(struct update_sched_power *update, int cpu, irq_work_queue(&sp->irq_work); }
- if (!play_idle_setup && cpu == 4) { + if (!play_idle_setup) { + pr_info("play idle demo\n"); play_idle_setup = 1; idle_inject_set_duration(cpower->ii_dev, 10, 4); idle_inject_start(cpower->ii_dev); @@ -670,8 +676,8 @@ static int set_power(struct _cooling_instance *inst, struct _thermal_zone *zone, cdev = inst->cooling->cdev; ret = cdev->ops->power2state(cdev, tz, power, &state);
- pr_info("set_power=%u, state=%lu, temp=%d\n", power, state, - tz->temperature); + pr_info("inst_weight=%u, set_power=%u, state=%lu, temp=%d\n", + inst->weight, power, state, tz->temperature); if (!ret) { ret = cooling_dev_set_state(zone, inst->cooling, state); } diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 0b8f8505d3bc..838bb7d318be 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2245,9 +2245,9 @@ unsigned long scale_irq_capacity(unsigned long util, unsigned long irq, unsigned } #endif
-#define SCHED_POWER_FORCE_UPDATE_RT 0x01 -#define SCHED_POWER_CPU_WEIGHT 0x2 -#define SCHED_POWER_CLUSTER_WEIGHT 0x4 +#define SCHED_POWER_CPU_WEIGHT 0x1 +#define SCHED_POWER_CLUSTER_WEIGHT 0x2 +#define SCHED_POWER_FORCE_UPDATE_RT 0x04
#ifdef CONFIG_THERMAL struct update_sched_power {