linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [pm] fix time after suspend-to-*
@ 2003-10-22 23:33 Pavel Machek
  2003-10-22 23:52 ` john stultz
  2003-10-22 23:57 ` Måns Rullgård
  0 siblings, 2 replies; 44+ messages in thread
From: Pavel Machek @ 2003-10-22 23:33 UTC (permalink / raw)
  To: Patrick Mochel, kernel list

Hi!

This adds suspend/resume methods for time, so that real time is
refreshed from cmos when suspend is finished. Please apply,

							Pavel
[Code was copied from apm.c, someone familiar from apm.c can probably
kill it from there -- after adding device_power_down() and
device_power_up() to right places].

--- tmp/linux/arch/i386/kernel/time.c	2003-10-09 00:13:14.000000000 +0200
+++ linux/arch/i386/kernel/time.c	2003-10-23 01:05:36.000000000 +0200
@@ -271,16 +271,39 @@
 	unsigned long retval;
 
 	spin_lock(&rtc_lock);
-
 	retval = mach_get_cmos_time();
-
 	spin_unlock(&rtc_lock);
 
 	return retval;
 }
 
+static long clock_cmos_diff;
+static int got_clock_diff;
+
+static int pit_suspend(struct sys_device *dev, u32 state)
+{
+	/*
+	 * Estimate time zone so that set_time can update the clock
+	 */
+	clock_cmos_diff = -get_cmos_time();
+	clock_cmos_diff += get_seconds();
+	got_clock_diff = 1;
+	return 0;
+}
+
+static int pit_resume(struct sys_device *dev)
+{
+	if (got_clock_diff) {	/* Must know time zone in order to set clock */
+		xtime.tv_sec = get_cmos_time() + clock_cmos_diff;
+		xtime.tv_nsec = 0; 
+	} 
+	return 0;
+}
+
 static struct sysdev_class pit_sysclass = {
 	set_kset_name("pit"),
+	.resume = pit_resume,
+	.suspend = pit_suspend,
 };
 
 /* XXX this driverfs stuff should probably go elsewhere later -john */

-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

^ permalink raw reply	[flat|nested] 44+ messages in thread
* Re: [pm] fix time after suspend-to-*
@ 2003-10-29  8:20 Mathias Fröhlich
  0 siblings, 0 replies; 44+ messages in thread
From: Mathias Fröhlich @ 2003-10-29  8:20 UTC (permalink / raw)
  To: linux-kernel


> > Userspace behavior on suspend transitions is still a bit fuzzy at best. I
> > am beginning to look at userspace requirements, so if anyone wants to send
> > me suggestions, no matter how trivial or wacky, please feel free (on- or
> > off-list).
> 
> Many userspace applications are not prepared for suspension, like
> Evolution. When suspending the machine for a long time, all IMAP
> sessions are broken as their counterpart TCP sockets timeout. While
> resuming, Evolution is unable to handle this condition and simply
> informs the network connection has been dropped.
>
> What about sending the SIGPWR signal to all userspace processes before
> suspending so applications like Evolution can be improved to handle this
> signal, drop their IMAP connections and then, when resuming, reestablish
> them?

I think that messagebus is for such stuff. ?!

   Greetings

      Mathias

-- 
Mathias Fröhlich, email: Mathias.Froehlich@web.de


^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2003-10-30  9:03 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-22 23:33 [pm] fix time after suspend-to-* Pavel Machek
2003-10-22 23:52 ` john stultz
2003-10-23  8:17   ` Pavel Machek
2003-10-23 20:23     ` George Anzinger
2003-10-23 20:55       ` john stultz
2003-10-23 23:09         ` George Anzinger
2003-10-23 23:38           ` Pavel Machek
2003-10-24  0:29           ` john stultz
2003-10-24  0:39             ` john stultz
2003-10-24  2:10             ` George Anzinger
2003-10-24  7:48               ` Pavel Machek
2003-10-27 23:24                 ` George Anzinger
2003-10-27 23:43                   ` Patrick Mochel
2003-10-28  1:35                     ` Nigel Cunningham
2003-10-28  8:33                     ` Felipe Alfaro Solana
2003-10-28  9:32                       ` Pavel Machek
2003-10-28 11:41                         ` Stephen Rothwell
2003-10-28 12:29                           ` Pavel Machek
2003-10-28 12:39                             ` Stephen Rothwell
2003-10-28 22:23                           ` Peter Chubb
2003-10-29  2:24                             ` Valdis.Kletnieks
2003-10-29  9:43                             ` Pavel Machek
2003-10-28 14:30                         ` Felipe Alfaro Solana
2003-10-28 17:28                           ` Pavel Machek
2003-10-28 20:16                             ` Felipe Alfaro Solana
2003-10-28 21:13                               ` Andreas Schwab
2003-10-28 21:29                               ` George Anzinger
2003-10-29  9:38                               ` Pavel Machek
2003-10-29 11:28                                 ` Gabriel Paubert
2003-10-29 11:55                                   ` PCI Bus error 6290 or 0290 Remus
2003-10-29 12:40                                     ` Meelis Roos
2003-10-29 12:49                                       ` Remus
2003-10-29 20:42                                 ` [pm] fix time after suspend-to-* George Anzinger
2003-10-30  9:02                                   ` Pavel Machek
2003-10-28 15:21                         ` Valdis.Kletnieks
2003-10-28 17:26                           ` Pavel Machek
2003-10-28 18:20                       ` Patrick Mochel
2003-10-28 19:36                         ` Valdis.Kletnieks
2003-10-28 20:19                         ` Felipe Alfaro Solana
2003-10-24  7:49             ` Pavel Machek
2003-10-23 23:40       ` Pavel Machek
2003-10-27 22:43         ` Patrick Mochel
2003-10-22 23:57 ` Måns Rullgård
2003-10-29  8:20 Mathias Fröhlich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).