public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* save/restore sysdev - re:2.6.9 S4: clock not updated after resume
@ 2004-10-25  6:16 Li, Shaohua
       [not found] ` <16A54BF5D6E14E4D916CE26C9AD3057563CCE1-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Li, Shaohua @ 2004-10-25  6:16 UTC (permalink / raw)
  To: Pavel Machek, ML ACPI-devel

>
>> I use with success 'echo disk > /sys/power/state' on my ASUS M6N
(BIOS
>> 0210A), Debian /experimental/, vanilla 2.6.9, XFree86/GNOME, with all
>> the modules installed (i.e, ALSA, bcm5700, ipw2100, USB, radeonfb,
>AGP/DRM).
>>
>> The resume is always ok, even if I suspend from battery or from AC,
>> there're no problem at all. The only remark is that the internal
clock
>> is 'freezed' at the time I suspended the machine and I must re-update
it
>> using the NTP service. This is not so problematic if your machine is
>> always connected to Internet, but as sometimes I work offline, I
should
>> re-update the internal clock by hand.
>
>It is a bug, here's the fix.
>
>
Pavel
>--- clean/arch/i386/kernel/time.c	2004-10-01 00:29:59.000000000
+0200
>+++ linux/arch/i386/kernel/time.c	2004-10-19 15:16:14.000000000
+0200
>@@ -319,7 +319,7 @@
> 	return retval;
> }
>
>-static long clock_cmos_diff;
>+static long clock_cmos_diff, sleep_start;
>
> static int time_suspend(struct sys_device *dev, u32 state)
> {
>@@ -328,6 +328,7 @@
> 	 */
> 	clock_cmos_diff = -get_cmos_time();
> 	clock_cmos_diff += get_seconds();
>+	sleep_start = get_cmos_time();
> 	return 0;
> }
>
>@@ -335,10 +336,13 @@
> {
> 	unsigned long flags;
> 	unsigned long sec = get_cmos_time() + clock_cmos_diff;
>+	unsigned long sleep_length = get_cmos_time() - sleep_start;
>+
> 	write_seqlock_irqsave(&xtime_lock, flags);
> 	xtime.tv_sec = sec;
> 	xtime.tv_nsec = 0;
> 	write_sequnlock_irqrestore(&xtime_lock, flags);
>+	jiffies += sleep_length * HZ;
> 	return 0;
> }
The patch is useless. The sysdev suspend/resume isn't invoked by swsusp,
as Bjorn has mentioned before.
http://marc.theaimsgroup.com/?l=linux-kernel&m=109753613422952&w=2

Thanks,
Shaohua


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

^ permalink raw reply	[flat|nested] 5+ messages in thread
* RE: save/restore sysdev - re:2.6.9 S4: clock not updated after resume
@ 2004-11-04  7:08 Li, Shaohua
       [not found] ` <16A54BF5D6E14E4D916CE26C9AD30575796CEB-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Li, Shaohua @ 2004-11-04  7:08 UTC (permalink / raw)
  To: Pavel Machek; +Cc: ML ACPI-devel

>
>> The patch is useless. The sysdev suspend/resume isn't invoked by
swsusp,
>> as Bjorn has mentioned before.
>> http://marc.theaimsgroup.com/?l=linux-kernel&m=109753613422952&w=2
>
>This patch should add sysdev suspend/resume. Can you verify it helps
>for you?
Sorry for being so late to reply. Yes, the patch (after fix some
compiling error) works for me. But one comment is sysdev_resume/suspend
are designed to work with IRQ disabled.

Thanks,
Shaohua


>--- clean/kernel/power/disk.c	2004-10-01 00:30:32.000000000 +0200
>+++ linux/kernel/power/disk.c	2004-10-29 11:57:26.000000000 +0200
>@@ -102,6 +116,7 @@
>
> static void finish(void)
> {
>+	sysdev_resume();
> 	device_resume();
> 	platform_finish();
> 	enable_nonboot_cpus();
>@@ -133,8 +148,12 @@
> 	free_some_memory();
>
> 	disable_nonboot_cpus();
>-	if ((error = device_suspend(PM_SUSPEND_DISK)))
>+	if ((error = device_suspend(PMSG_SUSPEND_DISK))) {
>+		printk("Some devices failed to suspend\n");
> 		goto Finish;
>+	}
>+
>+	sysdev_suspend(PMSG_SUSPEND_DISK);
>
> 	return 0;
>  Finish:
>--- clean/kernel/power/main.c	2004-10-01 00:30:32.000000000 +0200
>+++ linux/kernel/power/main.c	2004-10-29 11:56:59.000000000 +0200
>@@ -825,6 +812,7 @@
> int swsusp_write(void)
> {
> 	int error;
>+	sysdev_resume();
> 	device_resume();
> 	lock_swapdevices();
> 	error = write_suspend_image();
>
>



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click

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

end of thread, other threads:[~2004-11-17  8:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-25  6:16 save/restore sysdev - re:2.6.9 S4: clock not updated after resume Li, Shaohua
     [not found] ` <16A54BF5D6E14E4D916CE26C9AD3057563CCE1-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-10-29 10:18   ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2004-11-04  7:08 Li, Shaohua
     [not found] ` <16A54BF5D6E14E4D916CE26C9AD30575796CEB-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-11-16 12:26   ` Pavel Machek
     [not found]     ` <20041116122648.GB1013-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2004-11-17  8:19       ` Li Shaohua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox