public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: Dmitry Torokhov <dtor_core@ameritech.net>
Cc: Vojtech Pavlik <vojtech@suse.cz>,
	Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.0-test6: APM unable to suspend (the 2.6.0-test2 saga continues)
Date: Wed, 31 Dec 2003 13:40:33 +0100	[thread overview]
Message-ID: <20031231124032.GA367@ucw.cz> (raw)
In-Reply-To: <200312302045.38501.dtor_core@ameritech.net>

On Tue, Dec 30, 2003 at 08:45:35PM -0500, Dmitry Torokhov wrote:
> On Tuesday 30 December 2003 06:00 pm, Vojtech Pavlik wrote:
> > On Tue, Dec 30, 2003 at 07:53:03PM +0000, Russell King wrote:
> > > So it looks like i8042 could do with hooking some power management
> > > to disable this timer before suspend and resume it afterwards.
> > >
> > > Vojtech?
> >
> > Agreed. There should already be some in -mm kernels, and I'll make sure
> > the timer is deleted before suspend. Thanks for finding this.
> 
> What about something like the patch below? (Now, I don't suspend my notebook
> so it has not been tested, just compiled.)
> 
> Dmitry
> 

I like it, see comments.

> +/*
> + * Do not add extra 'i8042.' prefix to all parameters if compiled into the kernel
> + */
> +#undef MODULE_PARAM_PREFIX
> +#define MODULE_PARAM_PREFIX /* empty */
> +
>  static unsigned int i8042_noaux;
>  module_param(i8042_noaux, bool, 0);

Well, I think it might be cleaner to just drop the i8042_ prefix and go
with the "i8042." prefix if that's the 2.6 way. It'll annoy a couple
people, but's it's the way to go in the future.

> -	i8042_ctr = i8042_initial_ctr;
> -
> -	if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR))
> -		printk(KERN_WARNING "i8042.c: Can't restore CTR.\n");
> +static int i8042_controller_suspend(void)
> +{
> +	del_timer_sync(&i8042_timer);
> +	i8042_controller_reset();
>  
> +	return 0;
>  }

Ok here we remove the timer.

> +/*
> + * Restart timer (for autorepeats)
> + */ 
> +	mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);
>  

Note it's not for autorepeats. It's for problems with characters stuck
in the controller (like if the mouse sends a byte and the interface is
not enabled, blocking the controller indefinitely), we poll the
controller now and then making sure no characters are forgotten there.

> - * Resume handler for the new PM scheme (driver model)
> + * Suspend/resume handlers for the new PM scheme (driver model)
>   */
> +static int i8042_suspend(struct sys_device *dev, u32 state)
> +{
> +	return i8042_controller_suspend();
> +}
> +
>  static int i8042_resume(struct sys_device *dev)
>  {
>  	return i8042_controller_resume();
>  }
>  
>  static struct sysdev_class kbc_sysclass = {
> -       set_kset_name("i8042"),
> -       .resume = i8042_resume,
> +	set_kset_name("i8042"),
> +	.suspend = i8042_suspend,
> +	.resume = i8042_resume,
>  };

Good.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

  reply	other threads:[~2003-12-31 12:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-05 16:10 2.6.0-test6: APM unable to suspend (the 2.6.0-test2 saga continues) Russell King
2003-12-28 17:46 ` Russell King
2003-12-28 18:25   ` Russell King
2003-12-28 20:49     ` Linus Torvalds
2003-12-30 11:43       ` Russell King
2003-12-30 16:50         ` Russell King
2003-12-30 18:17           ` Russell King
2003-12-30 18:47             ` Linus Torvalds
2003-12-30 19:40               ` Russell King
2003-12-30 19:53                 ` Russell King
2003-12-30 23:00                   ` Vojtech Pavlik
2003-12-31  1:45                     ` Dmitry Torokhov
2003-12-31 12:40                       ` Vojtech Pavlik [this message]
2004-01-03  3:43                         ` Rusty Russell
2004-01-03 18:28             ` Pavel Machek

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=20031231124032.GA367@ucw.cz \
    --to=vojtech@suse.cz \
    --cc=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox