From 6eb89de1694220517564d3b2dd996799d3e1d124 Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Mon, 16 May 2016 21:24:36 +0300 Subject: [PATCH] Enable sun8i corekeeper patch --- ...bled => sun8i-simple-cpu-corekeeper.patch} | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) rename patch/kernel/sun8i-default/{sun8i-simple-cpu-corekeeper.patch.disabled => sun8i-simple-cpu-corekeeper.patch} (65%) diff --git a/patch/kernel/sun8i-default/sun8i-simple-cpu-corekeeper.patch.disabled b/patch/kernel/sun8i-default/sun8i-simple-cpu-corekeeper.patch similarity index 65% rename from patch/kernel/sun8i-default/sun8i-simple-cpu-corekeeper.patch.disabled rename to patch/kernel/sun8i-default/sun8i-simple-cpu-corekeeper.patch index 326c29938d..1cdc5af43a 100644 --- a/patch/kernel/sun8i-default/sun8i-simple-cpu-corekeeper.patch.disabled +++ b/patch/kernel/sun8i-default/sun8i-simple-cpu-corekeeper.patch @@ -1,8 +1,24 @@ diff --git a/drivers/thermal/cpu_budget_cooling.c b/drivers/thermal/cpu_budget_cooling.c -index 2a2aad7..94cb784 100755 +index 2a2aad7..8d8fc4a 100755 --- a/drivers/thermal/cpu_budget_cooling.c +++ b/drivers/thermal/cpu_budget_cooling.c -@@ -124,6 +124,21 @@ static int get_any_online_cpu(const cpumask_t *mask) +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + #include "thermal_core.h" + + #define CREATE_TRACE_POINTS +@@ -59,6 +60,7 @@ static LIST_HEAD(cooling_cpufreq_list); + static DEFINE_IDR(cpu_budget_idr); + static DEFINE_MUTEX(cooling_cpu_budget_lock); + static unsigned int cpu_budget_dev_count; ++static int corekeeper_enabled; + static struct cpu_budget_cooling_device* notify_device=NULL; + /** + * get_idr - function to get a unique id. +@@ -124,6 +126,21 @@ static int get_any_online_cpu(const cpumask_t *mask) } return lastcpu; } @@ -24,7 +40,7 @@ index 2a2aad7..94cb784 100755 static int get_online_cpu(const cpumask_t *mask) { int cpu,num =0; -@@ -151,6 +166,7 @@ EXPORT_SYMBOL(register_budget_cooling_notifier); +@@ -151,6 +168,7 @@ EXPORT_SYMBOL(register_budget_cooling_notifier); #ifdef CONFIG_CPU_FREQ_GOV_AUTO_HOTPLUG_ROOMAGE extern int autohotplug_update_room(unsigned int c0min,unsigned int c1min,unsigned int c0max,unsigned int c1max); #endif @@ -32,7 +48,7 @@ index 2a2aad7..94cb784 100755 int cpu_budget_update_state(struct cpu_budget_cooling_device *cpu_budget_device) { int ret = 0; -@@ -160,10 +176,12 @@ int cpu_budget_update_state(struct cpu_budget_cooling_device *cpu_budget_device) +@@ -160,10 +178,12 @@ int cpu_budget_update_state(struct cpu_budget_cooling_device *cpu_budget_device) unsigned int c0_online=0,c1_online=0; unsigned int c0_takedown=0,c1_takedown=0; unsigned int c0_max,c1_max,c0_min,c1_min; @@ -45,12 +61,12 @@ index 2a2aad7..94cb784 100755 ret = 0; #ifdef CONFIG_HOTPLUG_CPU -@@ -185,6 +203,22 @@ int cpu_budget_update_state(struct cpu_budget_cooling_device *cpu_budget_device) +@@ -185,6 +205,22 @@ int cpu_budget_update_state(struct cpu_budget_cooling_device *cpu_budget_device) c0_max:cpu_budget_device->cluster0_num_floor; c0_takedown = (c0_online > c0_max)?(c0_online - c0_max):0; c1_takedown = (c1_online > c1_max)?(c1_online - c1_max):0; +#ifdef CONFIG_ARCH_SUN8IW7 -+ if ((cooling_state < old_cooling_state) && (c0_takedown + c1_takedown == 0)) ++ if (corekeeper_enabled && (cooling_state < old_cooling_state) && (c0_takedown + c1_takedown == 0)) + { + pr_info("CPU Budget:plugging cores, old state %d, new state %d\n",old_cooling_state,cooling_state); + switch (cooling_state) @@ -68,7 +84,7 @@ index 2a2aad7..94cb784 100755 while(c1_takedown) { cpuid = get_any_online_cpu(&cpu_budget_device->cluster1_cpus); -@@ -209,6 +243,26 @@ int cpu_budget_update_state(struct cpu_budget_cooling_device *cpu_budget_device) +@@ -209,6 +245,26 @@ int cpu_budget_update_state(struct cpu_budget_cooling_device *cpu_budget_device) } c0_takedown--; } @@ -95,3 +111,21 @@ index 2a2aad7..94cb784 100755 #endif #ifdef CONFIG_CPU_FREQ_GOV_AUTO_HOTPLUG_ROOMAGE autohotplug_update_room(c0_min,c1_min,c0_max,c1_max); +@@ -460,6 +516,17 @@ struct thermal_cooling_device *cpu_budget_cooling_register( + int ret = 0, i; + struct cpufreq_policy policy; + ++ /* get corekeeper state */ ++ script_item_u val; ++ script_item_value_type_e type; ++ ++ type = script_get_item("corekeeper", "corekeeper_enabled", &val); ++ if (SCIRPT_ITEM_VALUE_TYPE_INT == type) { ++ corekeeper_enabled = !!val.val; ++ if (corekeeper_enabled) ++ pr_info("CPU Budget:corekeeper enabled\n"); ++ } ++ + /*Verify that all the clip cpus have same freq_min, freq_max limit*/ + for_each_cpu(i, cluster0_cpus) { + /*continue if cpufreq policy not found and not return error*/