From: "Jordan Crouse" <jordan.crouse@amd.com>
To: Marcelo Tosatti <marcelo@kvack.org>
Cc: David Brownell <david-b@pacbell.net>,
linux-acpi@vger.kernel.org, linux-pm@lists.linux-foundation.org,
devel@laptop.org
Subject: Re: add powerbutton and lid platform devices
Date: Mon, 9 Jul 2007 09:05:45 -0600 [thread overview]
Message-ID: <20070709150545.GD31533@cosmic.amd.com> (raw)
In-Reply-To: <20070708221027.GA4964@dmt>
On 08/07/07 18:10 -0400, Marcelo Tosatti wrote:
> Jordan,
>
> This allows configuration of powerbutton/lid events... Are the
> gpio_gpio_{clear,set} calls correct for enabling/disabling LID
> events?
>
> What else do we want to support?
The obvious ones would be RTC (but you already covered that), and SCI.
But this is an excellent start.
> --- olpc-pm.c.orig 2007-07-08 17:09:07.000000000 -0400
> +++ olpc-pm.c 2007-07-08 18:07:03.000000000 -0400
> @@ -54,6 +54,18 @@
>
> static int gpio_wake_events = 0;
> static int ebook_state = -1;
> +static u16 olpc_wakeup_mask = 0;
> +
> +struct platform_device olpc_powerbutton_dev = {
> + .name = "powerbutton",
> + .id = 0,
> +};
> +
> +struct platform_device olpc_lid_dev = {
> + .name = "lid",
> + .id = 0,
> +};
> +
> static void __init init_ebook_state(void)
> {
> @@ -250,6 +262,16 @@
> /* Save the MFGPT MSRs */
> rdmsrl(MFGPT_IRQ_MSR, mfgpt_irq_msr);
> rdmsrl(MFGPT_NR_MSR, mfgpt_nr_msr);
> +
> + if (device_may_wakeup(&olpc_powerbutton_dev.dev))
> + olpc_wakeup_mask |= CS5536_PM_PWRBTN;
> + else
> + olpc_wakeup_mask &= ~(CS5536_PM_PWRBTN);
> +
> + if (device_may_wakeup(&olpc_lid_dev.dev))
> + geode_gpio_clear(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
> + else
> + geode_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
> }
As was already mentioned before, the clear and set clauses should be
reversed.
You'll also need to get rid of
outl(1 << 31, acpi_base + PM_GPE0_EN);
in olpc_pm_enter() since that would have the undesired effect of eliminating
the LID completely from the list of wakeup sources. We should leave the
value of GPE0_EN the same through the lifetime of the system,
and control the individual events through the event enable bit(s) as you
have done above.
> static int olpc_pm_enter(suspend_state_t pm_state)
> @@ -275,8 +297,6 @@
> return 0;
> }
>
> -static u16 olpc_wakeup_mask = CS5536_PM_PWRBTN;
> -
> int asmlinkage olpc_do_sleep(u8 sleep_state)
> {
> void *pgd_addr = __va(read_cr3());
> @@ -596,15 +616,20 @@
> .resource = rtc_platform_resource,
> };
>
> -static int __init olpc_rtc_init(void)
> +static int __init olpc_platform_init(void)
> {
> (void)platform_device_register(&olpc_rtc_device);
> -
> device_init_wakeup(&olpc_rtc_device.dev, 1);
>
> + (void)platform_device_register(&olpc_powerbutton_dev);
> + device_init_wakeup(&olpc_powerbutton_dev.dev, 1);
> +
> + (void)platform_device_register(&olpc_lid_dev);
> + device_init_wakeup(&olpc_lid_dev.dev, 1);
> +
> return 0;
> }
I agree that the default setting for the power button should be to
wake up, but I don't know about the lid. Imagine a scenario where somebody
manually puts the machine to sleep and then shuts the lid. You wouldn't want
the machine to turn back on when you lifted it. Lid behavior is so policy
driven, I think we should leave it off by default, and let the power manager
decide what to do.
> -arch_initcall(olpc_rtc_init);
> +arch_initcall(olpc_platform_init);
> #endif /* CONFIG_RTC_DRV_CMOS */
>
> static void olpc_pm_exit(void)
>
>
--
Jordan Crouse
Systems Software Development Engineer
Advanced Micro Devices, Inc.
next prev parent reply other threads:[~2007-07-09 15:04 UTC|newest]
Thread overview: 126+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-30 23:57 Power Mangement Interfaces Jordan Crouse
2007-03-31 0:18 ` Johannes Berg
2007-03-31 0:21 ` Johannes Berg
2007-03-31 4:33 ` [linux-pm] " Gopi P.M.
2007-03-31 15:20 ` Jordan Crouse
2007-03-31 16:12 ` David Brownell
2007-03-31 15:16 ` Jordan Crouse
2007-04-02 7:38 ` [linux-pm] " Pavel Machek
2007-03-31 16:57 ` David Brownell
2007-04-04 16:15 ` Johannes Berg
2007-04-04 18:44 ` David Brownell
2007-04-04 21:49 ` Johannes Berg
2007-04-05 5:05 ` David Brownell
2007-04-05 8:02 ` Johannes Berg
2007-04-05 8:32 ` Zhang Rui
2007-03-31 16:52 ` David Brownell
2007-03-31 18:16 ` Jordan Crouse
2007-03-31 18:57 ` David Brownell
2007-04-01 1:01 ` Jordan Crouse
2007-04-01 3:01 ` David Brownell
2007-04-01 3:01 ` David Brownell
2007-04-01 16:56 ` Jordan Crouse
2007-04-01 16:56 ` Jordan Crouse
2007-04-02 0:28 ` David Brownell
2007-04-02 16:55 ` Jordan Crouse
2007-04-02 17:53 ` David Brownell
2007-04-02 17:53 ` David Brownell
2007-07-08 3:46 ` rtc-cmos not supporting RTC_AIE? Marcelo Tosatti
2007-07-08 5:26 ` David Brownell
2007-07-08 19:03 ` Marcelo Tosatti
2007-07-08 19:17 ` David Brownell
2007-07-08 19:17 ` David Brownell
2007-07-08 19:31 ` Richard Hughes
2007-07-08 19:31 ` Richard Hughes
2007-07-08 20:15 ` Hibernate after alarm wakes from STR David Brownell
2007-07-08 22:31 ` Marcelo Tosatti
2007-07-09 2:44 ` David Brownell
2007-07-09 8:34 ` Richard Hughes
2007-07-09 8:34 ` Richard Hughes
2007-07-09 15:40 ` Marcelo Tosatti
2007-07-09 15:40 ` Marcelo Tosatti
2007-07-09 16:26 ` David Brownell
2007-07-10 2:45 ` [linux-pm] " Nigel Cunningham
2007-07-10 16:51 ` David Brownell
2007-07-10 16:51 ` [linux-pm] " David Brownell
2007-07-10 22:16 ` Nigel Cunningham
2007-07-10 22:16 ` [linux-pm] " Nigel Cunningham
2007-07-11 0:45 ` Matthew Garrett
2007-07-11 0:53 ` Nigel Cunningham
2007-07-11 1:23 ` Matthew Garrett
2007-07-11 1:23 ` [linux-pm] " Matthew Garrett
2007-07-11 1:39 ` Nigel Cunningham
2007-07-11 1:39 ` [linux-pm] " Nigel Cunningham
2007-07-11 1:59 ` Matthew Garrett
2007-07-11 3:14 ` Nigel Cunningham
2007-07-11 3:14 ` [linux-pm] " Nigel Cunningham
2007-07-11 10:09 ` Rafael J. Wysocki
2007-07-11 10:09 ` [linux-pm] " Rafael J. Wysocki
2007-07-11 10:14 ` Nigel Cunningham
2007-07-11 10:14 ` [linux-pm] " Nigel Cunningham
2007-07-11 10:31 ` Rafael J. Wysocki
2007-07-11 10:31 ` Rafael J. Wysocki
2007-07-11 1:59 ` Matthew Garrett
2007-07-11 0:53 ` Nigel Cunningham
2007-07-11 0:45 ` Matthew Garrett
2007-07-11 16:04 ` David Brownell
2007-07-11 16:04 ` [linux-pm] " David Brownell
2007-07-11 22:48 ` Nigel Cunningham
2007-07-11 22:48 ` Nigel Cunningham
2007-07-10 2:45 ` Nigel Cunningham
2007-07-09 16:26 ` David Brownell
2007-07-09 2:44 ` David Brownell
2007-07-08 22:31 ` Marcelo Tosatti
2007-07-08 20:15 ` David Brownell
2007-07-08 19:03 ` rtc-cmos not supporting RTC_AIE? Marcelo Tosatti
2007-07-08 5:26 ` David Brownell
2007-07-08 3:46 ` Marcelo Tosatti
2007-07-08 3:49 ` [PATCH] rtc-cmos: use cmos_rtc_board_info to determine wake_on callback Marcelo Tosatti
2007-07-08 5:06 ` David Brownell
2007-07-08 5:06 ` David Brownell
2007-07-08 3:49 ` Marcelo Tosatti
2007-07-08 3:55 ` [PATCH] OLPC rtc-cmos support Marcelo Tosatti
2007-07-08 3:55 ` Marcelo Tosatti
2007-07-08 5:13 ` David Brownell
2007-07-08 18:40 ` Marcelo Tosatti
2007-07-08 18:40 ` Marcelo Tosatti
2007-07-08 19:10 ` David Brownell
2007-07-08 19:10 ` David Brownell
2007-07-08 20:17 ` Marcelo Tosatti
2007-07-08 20:47 ` David Brownell
2007-07-08 20:47 ` David Brownell
2007-07-08 20:17 ` Marcelo Tosatti
2007-07-08 5:13 ` David Brownell
2007-04-02 16:55 ` Power Mangement Interfaces Jordan Crouse
2007-06-19 17:00 ` Marcelo Tosatti
2007-06-19 17:00 ` Marcelo Tosatti
2007-06-19 19:17 ` Jens Axboe
2007-06-19 19:17 ` Jens Axboe
2007-06-19 19:41 ` Woodruff, Richard
2007-06-21 1:30 ` David Brownell
2007-07-08 22:10 ` [PATCH] add powerbutton and lid platform devices Marcelo Tosatti
2007-07-09 15:05 ` Jordan Crouse [this message]
2007-07-09 16:30 ` David Brownell
2007-07-09 16:30 ` David Brownell
2007-07-09 16:36 ` Jordan Crouse
2007-07-09 16:36 ` Jordan Crouse
2007-07-16 8:51 ` Richard Hughes
2007-07-16 8:51 ` Richard Hughes
2007-07-16 17:11 ` C. Scott Ananian
2007-07-16 17:11 ` C. Scott Ananian
2007-07-09 15:05 ` Jordan Crouse
2007-07-08 22:10 ` [PATCH] " Marcelo Tosatti
2007-06-21 1:30 ` Power Mangement Interfaces David Brownell
2007-04-02 0:28 ` David Brownell
2007-04-02 10:23 ` Zhang Rui
2007-04-02 18:24 ` David Brownell
2007-04-02 19:40 ` Matthew Garrett
2007-04-02 21:31 ` David Brownell
2007-04-02 21:31 ` David Brownell
2007-04-02 19:40 ` Matthew Garrett
2007-04-05 8:20 ` Zhang Rui
2007-04-05 8:20 ` Zhang Rui
2007-04-02 18:24 ` David Brownell
2007-04-02 10:07 ` Zhang Rui
2007-03-31 19:14 ` Jim Gettys
2007-04-02 9:36 ` Zhang Rui
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=20070709150545.GD31533@cosmic.amd.com \
--to=jordan.crouse@amd.com \
--cc=david-b@pacbell.net \
--cc=devel@laptop.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=marcelo@kvack.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 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.