* [RFC] cpufreq_driver->resume
@ 2003-09-02 8:32 Dominik Brodowski
2003-09-02 11:08 ` Dave Jones
0 siblings, 1 reply; 3+ messages in thread
From: Dominik Brodowski @ 2003-09-02 8:32 UTC (permalink / raw)
To: cpufreq
diff -ruN linux-original/Documentation/cpu-freq/cpu-drivers.txt linux/Documentation/cpu-freq/cpu-drivers.txt
--- linux-original/Documentation/cpu-freq/cpu-drivers.txt 2003-09-02 08:55:01.896637296 +0200
+++ linux/Documentation/cpu-freq/cpu-drivers.txt 2003-09-02 08:53:16.908597904 +0200
@@ -64,6 +64,12 @@
cpufreq_driver.exit - A pointer to a per-CPU cleanup function.
+cpufreq_driver.resume - A pointer to a per-CPU resume function
+ which is called with interrupts disabled
+ and _before_ the pre-suspend frequency
+ and/or policy is restored by a call to
+ ->target or ->setpolicy.
+
cpufreq_driver.attr - A pointer to a NULL-terminated list of
"struct freq_attr" which allow to
export values to sysfs.
diff -ruN linux-original/drivers/cpufreq/cpufreq.c linux/drivers/cpufreq/cpufreq.c
--- linux-original/drivers/cpufreq/cpufreq.c 2003-09-02 08:55:01.897637144 +0200
+++ linux/drivers/cpufreq/cpufreq.c 2003-09-02 08:55:44.440169696 +0200
@@ -493,6 +493,13 @@
if (!cpu_policy)
return -EINVAL;
+ if (cpufreq_driver->resume)
+ ret = cpufreq_driver->resume(cpu_policy);
+ if (ret) {
+ printk(KERN_ERR "cpufreq: resume failed in ->resume step on CPU %u\n", cpu_policy->cpu);
+ goto out;
+ }
+
if (cpufreq_driver->setpolicy)
ret = cpufreq_driver->setpolicy(cpu_policy);
else
@@ -501,6 +508,12 @@
*/
ret = cpufreq_driver->target(cpu_policy, cpu_policy->cur, CPUFREQ_RELATION_H);
+ if (ret) {
+ printk(KERN_ERR "cpufreq: resume failed in ->setpolicy/target step on CPU %u\n", cpu_policy->cpu);
+ goto out;
+ }
+
+ out:
cpufreq_cpu_put(cpu_policy);
return ret;
diff -ruN linux-original/include/linux/cpufreq.h linux/include/linux/cpufreq.h
--- linux-original/include/linux/cpufreq.h 2003-09-02 08:55:01.897637144 +0200
+++ linux/include/linux/cpufreq.h 2003-09-02 08:50:16.363045000 +0200
@@ -179,6 +179,7 @@
/* optional */
int (*exit) (struct cpufreq_policy *policy);
+ int (*resume) (struct cpufreq_policy *policy);
struct freq_attr **attr;
};
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] cpufreq_driver->resume
2003-09-02 8:32 [RFC] cpufreq_driver->resume Dominik Brodowski
@ 2003-09-02 11:08 ` Dave Jones
2003-09-02 13:41 ` Dominik Brodowski
0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2003-09-02 11:08 UTC (permalink / raw)
To: Dominik Brodowski; +Cc: cpufreq
On Tue, Sep 02, 2003 at 10:32:27AM +0200, Dominik Brodowski wrote:
> +cpufreq_driver.resume - A pointer to a per-CPU resume function
> + which is called with interrupts disabled
> + and _before_ the pre-suspend frequency
> + and/or policy is restored by a call to
> + ->target or ->setpolicy.
> +
What advantage is there to doing things this way over just
setting the speed to the last known value before we suspended ?
(though some drivers may need fixing, as they shortcut the
'trying to set to current speed' thing with a return so we
don't actually poke anything.)
Dave
--
Dave Jones http://www.codemonkey.org.uk
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] cpufreq_driver->resume
2003-09-02 11:08 ` Dave Jones
@ 2003-09-02 13:41 ` Dominik Brodowski
0 siblings, 0 replies; 3+ messages in thread
From: Dominik Brodowski @ 2003-09-02 13:41 UTC (permalink / raw)
To: Dave Jones; +Cc: cpufreq
On Tue, Sep 02, 2003 at 12:08:26PM +0100, Dave Jones wrote:
>
> On Tue, Sep 02, 2003 at 10:32:27AM +0200, Dominik Brodowski wrote:
>
> > +cpufreq_driver.resume - A pointer to a per-CPU resume function
> > + which is called with interrupts disabled
> > + and _before_ the pre-suspend frequency
> > + and/or policy is restored by a call to
> > + ->target or ->setpolicy.
> > +
>
> What advantage is there to doing things this way over just
> setting the speed to the last known value before we suspended ?
> (though some drivers may need fixing, as they shortcut the
> 'trying to set to current speed' thing with a return so we
> don't actually poke anything.)
Check the speedstep_smi driver -- it needs to pass a value to the BIOS after
every resume sequence. It was done there using a pm_dev, the generic/new
->resume callback seems to be better suited for this.
Dominik
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-09-02 13:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-02 8:32 [RFC] cpufreq_driver->resume Dominik Brodowski
2003-09-02 11:08 ` Dave Jones
2003-09-02 13:41 ` Dominik Brodowski
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.