From: "Rafał Bilski" <rafalbilski@interia.pl>
To: Dave Jones <davej@codemonkey.org.uk>
Cc: cpufreq@lists.linux.org.uk
Subject: [PATCH] Longhaul - Test
Date: Thu, 13 Jul 2006 20:57:18 +0200 [thread overview]
Message-ID: <44B6978E.5040805@interia.pl> (raw)
Test checking if ACPI C3 is really working in user computer.
Signed-off-by: Rafa³ Bilski <rafalbilski@interia.pl>
---
diff -uprN -X linux-2.6.17-git20-vanilla/Documentation/dontdiff linux-2.6.17-git20-vanilla/arch/i386/kernel/cpu/cpufreq/longhaul.c linux-2.6.17-git20/arch/i386/kernel/cpu/cpufreq/longhaul.c
--- linux-2.6.17-git20-vanilla/arch/i386/kernel/cpu/cpufreq/longhaul.c 2006-07-13 07:39:41.000000000 +0200
+++ linux-2.6.17-git20/arch/i386/kernel/cpu/cpufreq/longhaul.c 2006-07-13 20:36:22.000000000 +0200
@@ -543,6 +543,7 @@ static int __init longhaul_cpu_init(stru
struct cpuinfo_x86 *c = cpu_data;
char *cpuname=NULL;
int ret;
+ unsigned int i, min, min_index, max, max_index;
/* Check ACPI support for C3 state */
acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
@@ -642,6 +643,30 @@ static int __init longhaul_cpu_init(stru
(dont_scale_voltage==0))
longhaul_setup_voltagescaling();
+ /* Check if longhaul really works */
+ /* Find min and max frequencies */
+ i = max = max_index = min_index = 0;
+ min = ~0;
+ while (longhaul_table[i].frequency != CPUFREQ_TABLE_END) {
+ if (longhaul_table[i].frequency < min) {
+ min = longhaul_table[i].frequency;
+ min_index = longhaul_table[i].index;
+ } else if (longhaul_table[i].frequency > max) {
+ max = longhaul_table[i].frequency;
+ max_index = longhaul_table[i].index;
+ }
+ i++;
+ }
+ /* Change to min */
+ longhaul_setstate(min_index);
+ /* Check */
+ if ( calc_speed(longhaul_get_cpu_mult()) != min ) goto err_test;
+ /* Change to max */
+ longhaul_setstate(max_index);
+ /* Check */
+ if ( calc_speed(longhaul_get_cpu_mult()) != max ) goto err_test;
+
+ /* Seems to be working. Add longhaul driver to cpufreq core */
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
policy->cpuinfo.transition_latency = 200000; /* nsec */
policy->cur = calc_speed(longhaul_get_cpu_mult());
@@ -657,6 +682,11 @@ static int __init longhaul_cpu_init(stru
err_acpi:
printk(KERN_ERR PFX "No ACPI support for CPU frequency changes.\n");
return -ENODEV;
+
+err_test:
+ printk(KERN_ERR PFX "Test failed. Aborting.\n");
+ kfree(longhaul_table);
+ return -ENODEV;
}
static int __devexit longhaul_cpu_exit(struct cpufreq_policy *policy)
----------------------------------------------------------------------
Upal jakby mniejszy... http://link.interia.pl/f1975
reply other threads:[~2006-07-13 18:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44B6978E.5040805@interia.pl \
--to=rafalbilski@interia.pl \
--cc=cpufreq@lists.linux.org.uk \
--cc=davej@codemonkey.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.