public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Thomas Renninger <trenn@suse.de>
Cc: Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, "Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: [PATCH 0/6] ACPI: button: minor cleanups
Date: Fri, 8 May 2009 11:21:47 -0600	[thread overview]
Message-ID: <200905081121.48340.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <200905061120.52793.bjorn.helgaas@hp.com>

On Wednesday 06 May 2009 11:20:52 am Bjorn Helgaas wrote:
> On Wednesday 06 May 2009 09:13:07 am Thomas Renninger wrote:
> > Below is the outcome of the patch which fixes a fixed feature button
> > s2ram issue.
> > 
> > This does not work anymore since Bjoern's patches.
> > Comparing the with the HID of the acpi device looks ugly.
> > 
> > Shall I revive the fixed feature vs GPE button types?
> > ACPI_BUTTON_TYPE_POWERF and ACPI_BUTTON_TYPE_SLEEPF?
> 
> I don't understand exactly how I broke this.
> 
> Your patch makes us remove the fixed event handler in .suspend()
> and install it again in .resume().  In 2.6.29, we didn't touch the
> handler during suspend/resume, and my patches didn't change that
> aspect of things.
> 
> Whatever the problem is, it feels like something that should be
> handled in the Linux/ACPI code, not in the driver.
> 
> Did you identify the patch that broke things?  My guess would be
> 373cfc360ec773b, but I took a look at it (and 46ec8598fde74b, on
> which it depends), and I don't see the problem yet.

What's happening here?  If I broke something, I want to figure it
out ASAP because it sounds like a regression from 2.6.29.  Is there
a bugzilla or more detailed bug report anywhere?

Bjorn

> > Can you think of anything nicer?
> > 
> > Thanks,
> > 
> >      Thomas
> > 
> > 
> > ACPI: button: Fix fixed feature buttons for s2disk for HW modifing event registers
> > 
> > This happened on a recent HP laptop. After s2disk the fixed feature power button
> > event handler is not functional because the BIOS has modified the fixed feature
> > register(s) when resuming/rebooting after s2disk.
> > Setting up some bits there again by unregistering and re-installing the fixed
> > feature event handler fixes the problem and the button is functional again after s2disk.
> > 
> > Comment from Rafael:
> > This may be a consequence of the fact that we initialize ACPI before reading
> > the hibernation image from disk.  The spec seems to assume that won't be done. 
> > Hence, I think we should handle this.
> > 
> > 
> > Signed-off-by: Thomas Renninger <trenn@suse.de>
> > 
> > diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
> > index 9195deb..80ee2bc 100644
> > --- a/drivers/acpi/button.c
> > +++ b/drivers/acpi/button.c
> > @@ -74,6 +74,7 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids);
> >  static int acpi_button_add(struct acpi_device *device);
> >  static int acpi_button_remove(struct acpi_device *device, int type);
> >  static int acpi_button_resume(struct acpi_device *device);
> > +static int acpi_button_suspend(struct acpi_device *device, pm_message_t state);
> >  static void acpi_button_notify(struct acpi_device *device, u32 event);
> >  static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
> >  static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
> > @@ -85,6 +86,7 @@ static struct acpi_driver acpi_button_driver = {
> >  	.ops = {
> >  		.add = acpi_button_add,
> >  		.resume = acpi_button_resume,
> > +		.suspend = acpi_button_suspend,
> >  		.remove = acpi_button_remove,
> >  		.notify = acpi_button_notify,
> >  	},
> > @@ -281,8 +283,41 @@ static int acpi_button_resume(struct acpi_device *device)
> >  {
> >  	struct acpi_button *button = acpi_driver_data(device);
> >  
> > -	if (button->type == ACPI_BUTTON_TYPE_LID)
> > +	if (!button)
> > +		return -EINVAL;
> > +	switch (button->type) {
> > +	case ACPI_BUTTON_TYPE_LID:
> >  		return acpi_lid_send_state(device);
> > +	case ACPI_BUTTON_TYPE_SLEEPF:
> > +		return acpi_install_fixed_event_handler(
> > +					ACPI_EVENT_SLEEP_BUTTON,
> > +					acpi_button_notify_fixed, button);
> > +
> > +	case ACPI_BUTTON_TYPE_POWERF:
> > +		return acpi_install_fixed_event_handler(
> > +					ACPI_EVENT_POWER_BUTTON,
> > +					acpi_button_notify_fixed, button);
> > +	}
> > +	return 0;
> > +}
> > +
> > +static int acpi_button_suspend(struct acpi_device *device, pm_message_t state)
> > +{
> > +	struct acpi_button *button;
> > +	if (!device)
> > +		return -EINVAL;
> > +	button = acpi_driver_data(device);
> > +	if (!button)
> > +		return -EINVAL;
> > +	switch (button->type) {
> > +	case ACPI_BUTTON_TYPE_SLEEPF:
> > +		return acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
> > +					       acpi_button_notify_fixed);
> > +
> > +	case ACPI_BUTTON_TYPE_POWERF:
> > +		return acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
> > +					       acpi_button_notify_fixed);
> > +	}
> >  	return 0;
> >  }
> >  
> > 
> 
> 
> 



  reply	other threads:[~2009-05-08 17:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 15:39 [PATCH 0/6] ACPI: button: minor cleanups Bjorn Helgaas
2009-04-08 15:39 ` [PATCH 1/6] ACPI: button: whitespace changes Bjorn Helgaas
2009-04-08 15:39 ` [PATCH 2/6] ACPI: button: remove unnecessary null pointer checks Bjorn Helgaas
2009-04-08 15:39 ` [PATCH 3/6] ACPI: button: use Linux style for getting driver_data Bjorn Helgaas
2009-04-08 15:39 ` [PATCH 4/6] ACPI: button: cache hid/name/class pointers Bjorn Helgaas
2009-04-08 15:39 ` [PATCH 5/6] ACPI: button: remove button->device pointer Bjorn Helgaas
2009-04-08 15:40 ` [PATCH 6/6] ACPI: button: remove control method/fixed hardware distinctions Bjorn Helgaas
2009-04-18  4:19 ` [PATCH 0/6] ACPI: button: minor cleanups Len Brown
     [not found] ` <200904171339.15895.bjorn.helgaas@hp.com>
     [not found]   ` <200905061713.08057.trenn@suse.de>
2009-05-06 17:20     ` Bjorn Helgaas
2009-05-08 17:21       ` Bjorn Helgaas [this message]
2009-05-08 20:53       ` Bjorn Helgaas
2009-05-11  6:56         ` Thomas Renninger
2009-05-11 22:13           ` Bjorn Helgaas

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=200905081121.48340.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=trenn@suse.de \
    /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