Permalink
Browse files

Merge pull request #152 from ThomasKaiser/master

Try to fix potential overvolting and overheating for Orange Pi One

OK, will do ASAP.
  • Loading branch information...
2 parents 31bfd7e + 40d71f7 commit c93d7dfb3538c36739fb8841bd314d75e7d7cbe5 @igorpecovnik committed Feb 18, 2016
Showing with 115 additions and 7 deletions.
  1. +4 −5 config/orangepione.fex
  2. +2 −2 configuration.sh
  3. +109 −0 patch/kernel/sun8i-default/0005-h3-thermal.patch
@@ -734,16 +734,15 @@ ir_tx = port:PH07<2><default><default><default>
[dvfs_table]
pmuic_type = 1
pmu_gpio0 = port:PL06<1><1><2><1>
-pmu_level0 = 11300
-pmu_level1 = 1100
-;extremity_freq = 1296000000
+pmu_level0 = 1270
+pmu_level1 = 1270
max_freq = 1200000000
min_freq = 648000000
LV_count = 2
LV1_freq = 1200000000
-LV1_volt = 1300
+LV1_volt = 1270
LV2_freq = 648000000
-LV2_volt = 1100
+LV2_volt = 1270
[gpu_dvfs_table]
G_LV_count = 3
View
@@ -254,7 +254,7 @@
MODULES="gpio_sunxi w1-sunxi w1-gpio w1-therm"
MODULES_NEXT=""
CPUMIN="648000"
- CPUMAX="1200000"
+ CPUMAX="1104000"
GOVERNOR="interactive"
;;
@@ -266,7 +266,7 @@
MODULES="8189es gpio_sunxi w1-sunxi w1-gpio w1-therm"
MODULES_NEXT=""
CPUMIN="648000"
- CPUMAX="1200000"
+ CPUMAX="1104000"
GOVERNOR="interactive"
;;
@@ -0,0 +1,109 @@
+diff --git a/drivers/thermal/cpu_budget_cooling.c b/drivers/thermal/cpu_budget_cooling.c
+index fb316b6..ce1f9bb 100755
+--- a/drivers/thermal/cpu_budget_cooling.c
++++ b/drivers/thermal/cpu_budget_cooling.c
+@@ -30,8 +30,6 @@
+ #include <linux/cpu.h>
+ #include <linux/cpumask.h>
+ #include <linux/cpu_budget_cooling.h>
+-#include "thermal_core.h"
+-
+ #define CREATE_TRACE_POINTS
+ #include <trace/events/budget_cooling.h>
+ #define BOOT_CPU 0
+@@ -249,8 +247,6 @@ static int cpu_budget_apply_cooling(struct cpu_budget_cooling_device *cpu_budget
+ unsigned long cooling_state)
+ {
+ unsigned long flags;
+- struct thermal_instance *instance;
+- int temperature = 0;
+
+ /* Check if the old cooling action is same as new cooling action */
+ if (cpu_budget_device->cpu_budget_state == cooling_state)
+@@ -275,11 +271,7 @@ static int cpu_budget_apply_cooling(struct cpu_budget_cooling_device *cpu_budget
+ cpu_budget_device->cluster1_freq_limit,
+ cpu_budget_device->cluster1_num_limit,
+ cpu_budget_device->gpu_throttle);
+- list_for_each_entry(instance, &(cpu_budget_device->cool_dev->thermal_instances), cdev_node) {
+- if(instance->tz->temperature > temperature)
+- temperature = instance->tz->temperature;
+- }
+- pr_info("CPU Budget: Temperature: %u Limit state:%lu item[%d,%d,%d,%d %d]\n",temperature,cooling_state,
++ pr_debug("CPU Budget: Limit state:%lu item[%d,%d,%d,%d %d]\n",cooling_state,
+ cpu_budget_device->cluster0_freq_limit,
+ cpu_budget_device->cluster0_num_limit ,
+ cpu_budget_device->cluster1_freq_limit ,
+@@ -381,7 +373,7 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,
+ {
+ cpufreq_verify_within_limits(policy, min_freq, max_freq);
+ policy->user_policy.max = policy->max;
+- pr_info("CPU Budget:update CPU %d cpufreq max to %lu min to %lu\n",policy->cpu,max_freq, min_freq);
++ pr_debug("CPU Budget:update CPU %d cpufreq max to %lu min to %lu\n",policy->cpu,max_freq, min_freq);
+ }
+ }
+ return 0;
+diff --git a/drivers/thermal/sunxi-cpu-budget-cooling.c b/drivers/thermal/sunxi-cpu-budget-cooling.c
+index 71ebc41..3a1b42b 100755
+--- a/drivers/thermal/sunxi-cpu-budget-cooling.c
++++ b/drivers/thermal/sunxi-cpu-budget-cooling.c
+@@ -69,14 +69,16 @@ static struct cpu_budget_table m_default_budgets_table[]=
+ {1,816000,4,816000,1},
+ };
+ #endif
++/* LOBO */
+ #ifdef CONFIG_ARCH_SUN8IW7
+ static struct cpu_budget_table m_default_budgets_table[]=
+ {
++ {1,1296000 ,4,INVALID_FREQ,0},
+ {1,1200000 ,4,INVALID_FREQ,0},
+ {1,1008000 ,4,INVALID_FREQ,0},
+- {1,1008000 ,2,INVALID_FREQ,0},
+- {1,1008000 ,1,INVALID_FREQ,0},
+- {1,504000 ,1,INVALID_FREQ,0},
++ {1,816000 ,4,INVALID_FREQ,0},
++ {1,648000 ,4,INVALID_FREQ,0},
++ {1,480000 ,1,INVALID_FREQ,0},
+ };
+ #endif
+ #ifdef CONFIG_ARCH_SUN9IW1
+@@ -480,7 +482,7 @@ static int sunxi_cpu_budget_syscfg_init(void)
+ &m_syscfg_budgets_table[i].cluster1_freq,
+ &m_syscfg_budgets_table[i].cluster1_cpunr,
+ &m_syscfg_budgets_table[i].gpu_throttle);
+-#elif defined(CONFIG_ARCH_SUN8IW5) || defined(CONFIG_ARCH_SUN8IW6) || defined(CONFIG_ARCH_SUN8IW7)
++#elif defined(CONFIG_ARCH_SUN8IW5) || defined(CONFIG_ARCH_SUN8IW6)
+ num=sscanf(val.str, "%u %u %u %u %u",
+ &m_syscfg_budgets_table[i].cluster0_freq,
+ &m_syscfg_budgets_table[i].cluster0_cpunr,
+diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
+old mode 100755
+new mode 100644
+index d897818..0e1fa39
+--- a/drivers/thermal/thermal_sys.c
++++ b/drivers/thermal/thermal_sys.c
+@@ -359,9 +359,8 @@ static void handle_critical_trips(struct thermal_zone_device *tz,
+ tz->ops->notify(tz, trip, trip_type);
+
+ if (trip_type == THERMAL_TRIP_CRITICAL) {
+- /* Our system report temperature in centigrade, by qin 2014 .11.25 */
+ pr_emerg("Critical temperature reached(%d C),shutting down\n",
+- tz->temperature );
++ tz->temperature / 1000);
+ orderly_poweroff(true);
+ }
+ }
+diff --git a/drivers/arisc/binary/Makefile b/drivers/arisc/binary/Makefile
+index 08b81fd..ab3d5d2 100755
+--- a/drivers/arisc/binary/Makefile
++++ b/drivers/arisc/binary/Makefile
+@@ -29,8 +29,8 @@ ifdef CONFIG_ARCH_SUN9IW1P1
+ PLATFORM=arisc_sun9iw1p1
+ endif
+
+-$(obj)/$(PLATFORM).bin : $(src)/$(PLATFORM).code
+- cp $< $(obj)/$(PLATFORM).tar.bz2; \
++$(obj)/$(PLATFORM).bin : $(obj)/$(PLATFORM).code
++ cp $(obj)/$(PLATFORM).code $(obj)/$(PLATFORM).tar.bz2; \
+ tar -xjvf $(obj)/$(PLATFORM).tar.bz2 -C $(obj)/; \
+ cp $(obj)/arisc_package/$(PLATFORM).bin $(obj)/$(PLATFORM).bin; \
+ cp $(obj)/arisc_package/$(PLATFORM).tar.bz2.aes $(obj)/arisc; \

0 comments on commit c93d7df

Please sign in to comment.