This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enlightenment.

View the commit online.

commit bc33aa5d280cbcd122c3929192fa1aaf83aea223
Author: Carsten Haitzler <ras...@rasterman.com>
AuthorDate: Fri Jan 3 13:18:01 2025 +0000

    cpufreq - ensure min cpu freq is real min
---
 src/bin/system/e_system_cpufreq.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/bin/system/e_system_cpufreq.c b/src/bin/system/e_system_cpufreq.c
index 98b195893..95e24ef22 100644
--- a/src/bin/system/e_system_cpufreq.c
+++ b/src/bin/system/e_system_cpufreq.c
@@ -5,6 +5,37 @@
 #elif defined __FreeBSD__
 // no local funcs
 #else
+static int
+sys_cpu_set_all_min_freq(void)
+{
+   int num = 0;
+   char buf[4096];
+   char buf2[256];
+   size_t sz;
+   FILE *f;
+
+   for (;;)
+     {
+        snprintf(buf, sizeof(buf),
+                 "/sys/devices/system/cpu/cpu%i/cpufreq/cpuinfo_min_freq", num);
+        f = fopen(buf, "r");
+        if (!f) return num;
+        sz = fread(buf2, 1, sizeof(buf2), f);
+        fclose(f);
+        if (sz > 0)
+          {
+             snprintf(buf, sizeof(buf),
+                      "/sys/devices/system/cpu/cpu%i/cpufreq/scaling_min_freq", num);
+             f = fopen(buf, "w");
+             if (!f) return num;
+             fwrite(buf2, 1, sz, f);
+             fclose(f);
+          }
+        num++;
+     }
+   return 0;
+}
+
 static int
 sys_cpu_setall(const char *control, const char *value)
 {
@@ -22,7 +53,7 @@ sys_cpu_setall(const char *control, const char *value)
         fclose(f);
         num++;
      }
-   return 1;
+   return 0;
 }
 
 static int
@@ -230,6 +261,9 @@ _cb_cpufreq_pwr_set(void *data EINA_UNUSED, const char *params)
 #else
   int v = atoi(params); // 0->100
 
+  // ensure min freq is as low as possible
+  sys_cpu_set_all_min_freq();
+
   if (v < 0) v = 0;
   else if (v > 100) v = 100;
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to