public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] Add extra PM_EVENT_* codes for use by subsystems
@ 2008-02-29 17:27 Alan Stern
  2008-03-01 11:47 ` Pavel Machek
  2008-03-02 12:57 ` Rafael J. Wysocki
  0 siblings, 2 replies; 5+ messages in thread
From: Alan Stern @ 2008-02-29 17:27 UTC (permalink / raw)
  To: Pavel Machek, Rafael J. Wysocki; +Cc: Linux-pm mailing list

Is there any objection to adding extra PM_EVENT_* codes?  Although they
won't ever be issued by the PM core, they will come in handy for
internal uses in power-aware subsystems (like USB).

Alan Stern


Index: usb-2.6/include/linux/pm.h
===================================================================
--- usb-2.6.orig/include/linux/pm.h
+++ usb-2.6/include/linux/pm.h
@@ -164,21 +164,40 @@ typedef struct pm_message {
  * well as during system sleep states like PM_SUSPEND_STANDBY.  They may
  * be able to use wakeup events to exit from runtime low-power states,
  * or from system low-power states such as standby or suspend-to-RAM.
+ *
+ * The PM core will never issue the PMSG_ codes for USER_SUSPEND,
+ * USER_RESUME, REMOTE_WAKEUP, AUTOSUSPEND, or AUTORESUME.  They are
+ * provided for internal use by power-aware subsystems.
  */
 
-#define PM_EVENT_ON 0
-#define PM_EVENT_FREEZE 1
-#define PM_EVENT_SUSPEND 2
-#define PM_EVENT_HIBERNATE 4
-#define PM_EVENT_PRETHAW 8
+#define PM_EVENT_ON		0x0000
+#define PM_EVENT_FREEZE		0x0001
+#define PM_EVENT_SUSPEND	0x0002
+#define PM_EVENT_HIBERNATE	0x0004
+#define PM_EVENT_PRETHAW	0x0008
+#define PM_EVENT_USER_SUSPEND	0x0010
+#define PM_EVENT_USER_RESUME	0x0020
+#define PM_EVENT_REMOTE_WAKEUP	0x0040
+#define PM_EVENT_AUTOSUSPEND	0x0080
+#define PM_EVENT_AUTORESUME	0x0100
 
 #define PM_EVENT_SLEEP	(PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
 
+#define PMSG_ON		((struct pm_message){ .event = PM_EVENT_ON, })
 #define PMSG_FREEZE	((struct pm_message){ .event = PM_EVENT_FREEZE, })
 #define PMSG_PRETHAW	((struct pm_message){ .event = PM_EVENT_PRETHAW, })
 #define PMSG_SUSPEND	((struct pm_message){ .event = PM_EVENT_SUSPEND, })
 #define PMSG_HIBERNATE	((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
-#define PMSG_ON		((struct pm_message){ .event = PM_EVENT_ON, })
+#define PMSG_USER_SUSPEND	((struct pm_message) \
+					{ .event = PM_EVENT_USER_SUSPEND, })
+#define PMSG_USER_RESUME	((struct pm_message) \
+					{ .event = PM_EVENT_USER_RESUME, })
+#define PMSG_REMOTE_WAKEUP	((struct pm_message) \
+					{ .event = PM_EVENT_REMOTE_WAKEUP, })
+#define PMSG_AUTOSUSPSEND	((struct pm_message) \
+					{ .event = PM_EVENT_AUTOSUSPSEND, })
+#define PMSG_AUTORESUME		((struct pm_message) \
+					{ .event = PM_EVENT_AUTORESUME, })
 
 struct dev_pm_info {
 	pm_message_t		power_state;

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

* Re: [RFC] Add extra PM_EVENT_* codes for use by subsystems
  2008-02-29 17:27 [RFC] Add extra PM_EVENT_* codes for use by subsystems Alan Stern
@ 2008-03-01 11:47 ` Pavel Machek
  2008-03-02 12:57 ` Rafael J. Wysocki
  1 sibling, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2008-03-01 11:47 UTC (permalink / raw)
  To: Alan Stern; +Cc: Linux-pm mailing list

Hi!

> Is there any objection to adding extra PM_EVENT_* codes?  Although they
> won't ever be issued by the PM core, they will come in handy for
> internal uses in power-aware subsystems (like USB).

I guess we cando that.

> Alan Stern
> 
> 
> Index: usb-2.6/include/linux/pm.h
> ===================================================================
> --- usb-2.6.orig/include/linux/pm.h
> +++ usb-2.6/include/linux/pm.h
> @@ -164,21 +164,40 @@ typedef struct pm_message {
>   * well as during system sleep states like PM_SUSPEND_STANDBY.  They may
>   * be able to use wakeup events to exit from runtime low-power states,
>   * or from system low-power states such as standby or suspend-to-RAM.
> + *
> + * The PM core will never issue the PMSG_ codes for USER_SUSPEND,
> + * USER_RESUME, REMOTE_WAKEUP, AUTOSUSPEND, or AUTORESUME.  They are
> + * provided for internal use by power-aware subsystems.
>   */
>  
> -#define PM_EVENT_ON 0
> -#define PM_EVENT_FREEZE 1
> -#define PM_EVENT_SUSPEND 2
> -#define PM_EVENT_HIBERNATE 4
> -#define PM_EVENT_PRETHAW 8
> +#define PM_EVENT_ON		0x0000
> +#define PM_EVENT_FREEZE		0x0001
> +#define PM_EVENT_SUSPEND	0x0002
> +#define PM_EVENT_HIBERNATE	0x0004
> +#define PM_EVENT_PRETHAW	0x0008

I'd move that "not used by core" note here.

> +#define PM_EVENT_USER_SUSPEND	0x0010
> +#define PM_EVENT_USER_RESUME	0x0020
> +#define PM_EVENT_REMOTE_WAKEUP	0x0040
> +#define PM_EVENT_AUTOSUSPEND	0x0080
> +#define PM_EVENT_AUTORESUME	0x0100
>  
>  #define PM_EVENT_SLEEP	(PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [RFC] Add extra PM_EVENT_* codes for use by subsystems
  2008-02-29 17:27 [RFC] Add extra PM_EVENT_* codes for use by subsystems Alan Stern
  2008-03-01 11:47 ` Pavel Machek
@ 2008-03-02 12:57 ` Rafael J. Wysocki
  2008-03-02 15:18   ` Alan Stern
  1 sibling, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2008-03-02 12:57 UTC (permalink / raw)
  To: Alan Stern; +Cc: Linux-pm mailing list, Alexey Starikovskiy

On Friday, 29 of February 2008, Alan Stern wrote:
> Is there any objection to adding extra PM_EVENT_* codes?  Although they
> won't ever be issued by the PM core, they will come in handy for
> internal uses in power-aware subsystems (like USB).

Well, this is in a (slight) conflict with the hibernation/suspend callbacks
rework that I'm working on with Alex.  I'll send the first patch in a few
minutes for comments.

Thanks,
Rafael


> Index: usb-2.6/include/linux/pm.h
> ===================================================================
> --- usb-2.6.orig/include/linux/pm.h
> +++ usb-2.6/include/linux/pm.h
> @@ -164,21 +164,40 @@ typedef struct pm_message {
>   * well as during system sleep states like PM_SUSPEND_STANDBY.  They may
>   * be able to use wakeup events to exit from runtime low-power states,
>   * or from system low-power states such as standby or suspend-to-RAM.
> + *
> + * The PM core will never issue the PMSG_ codes for USER_SUSPEND,
> + * USER_RESUME, REMOTE_WAKEUP, AUTOSUSPEND, or AUTORESUME.  They are
> + * provided for internal use by power-aware subsystems.
>   */
>  
> -#define PM_EVENT_ON 0
> -#define PM_EVENT_FREEZE 1
> -#define PM_EVENT_SUSPEND 2
> -#define PM_EVENT_HIBERNATE 4
> -#define PM_EVENT_PRETHAW 8
> +#define PM_EVENT_ON		0x0000
> +#define PM_EVENT_FREEZE		0x0001
> +#define PM_EVENT_SUSPEND	0x0002
> +#define PM_EVENT_HIBERNATE	0x0004
> +#define PM_EVENT_PRETHAW	0x0008
> +#define PM_EVENT_USER_SUSPEND	0x0010
> +#define PM_EVENT_USER_RESUME	0x0020
> +#define PM_EVENT_REMOTE_WAKEUP	0x0040
> +#define PM_EVENT_AUTOSUSPEND	0x0080
> +#define PM_EVENT_AUTORESUME	0x0100
>  
>  #define PM_EVENT_SLEEP	(PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
>  
> +#define PMSG_ON		((struct pm_message){ .event = PM_EVENT_ON, })
>  #define PMSG_FREEZE	((struct pm_message){ .event = PM_EVENT_FREEZE, })
>  #define PMSG_PRETHAW	((struct pm_message){ .event = PM_EVENT_PRETHAW, })
>  #define PMSG_SUSPEND	((struct pm_message){ .event = PM_EVENT_SUSPEND, })
>  #define PMSG_HIBERNATE	((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
> -#define PMSG_ON		((struct pm_message){ .event = PM_EVENT_ON, })
> +#define PMSG_USER_SUSPEND	((struct pm_message) \
> +					{ .event = PM_EVENT_USER_SUSPEND, })
> +#define PMSG_USER_RESUME	((struct pm_message) \
> +					{ .event = PM_EVENT_USER_RESUME, })
> +#define PMSG_REMOTE_WAKEUP	((struct pm_message) \
> +					{ .event = PM_EVENT_REMOTE_WAKEUP, })
> +#define PMSG_AUTOSUSPSEND	((struct pm_message) \
> +					{ .event = PM_EVENT_AUTOSUSPSEND, })
> +#define PMSG_AUTORESUME		((struct pm_message) \
> +					{ .event = PM_EVENT_AUTORESUME, })
>  
>  struct dev_pm_info {
>  	pm_message_t		power_state;
> 
> 
> 



-- 
"Premature optimization is the root of all evil." - Donald Knuth

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

* Re: [RFC] Add extra PM_EVENT_* codes for use by subsystems
  2008-03-02 12:57 ` Rafael J. Wysocki
@ 2008-03-02 15:18   ` Alan Stern
  2008-03-02 18:16     ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Stern @ 2008-03-02 15:18 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux-pm mailing list, Alexey Starikovskiy

On Sun, 2 Mar 2008, Rafael J. Wysocki wrote:

> On Friday, 29 of February 2008, Alan Stern wrote:
> > Is there any objection to adding extra PM_EVENT_* codes?  Although they
> > won't ever be issued by the PM core, they will come in handy for
> > internal uses in power-aware subsystems (like USB).
> 
> Well, this is in a (slight) conflict with the hibernation/suspend callbacks
> rework that I'm working on with Alex.  I'll send the first patch in a few
> minutes for comments.

If you want to add my new codes to yours, that would be fine.  Or I 
could wait until after your new callbacks are merged before submitting 
the new event codes.  Whatever you think is best.

Alan Stern

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

* Re: [RFC] Add extra PM_EVENT_* codes for use by subsystems
  2008-03-02 15:18   ` Alan Stern
@ 2008-03-02 18:16     ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2008-03-02 18:16 UTC (permalink / raw)
  To: Alan Stern; +Cc: Linux-pm mailing list, Alexey Starikovskiy

On Sunday, 2 of March 2008, Alan Stern wrote:
> On Sun, 2 Mar 2008, Rafael J. Wysocki wrote:
> 
> > On Friday, 29 of February 2008, Alan Stern wrote:
> > > Is there any objection to adding extra PM_EVENT_* codes?  Although they
> > > won't ever be issued by the PM core, they will come in handy for
> > > internal uses in power-aware subsystems (like USB).
> > 
> > Well, this is in a (slight) conflict with the hibernation/suspend callbacks
> > rework that I'm working on with Alex.  I'll send the first patch in a few
> > minutes for comments.
> 
> If you want to add my new codes to yours, that would be fine.  Or I 
> could wait until after your new callbacks are merged before submitting 
> the new event codes.  Whatever you think is best.

That should be two different patches, I think.

If you could wait for the new callbacks, that would be better from my
standpoint (we may decide to add some more callbacks and therefore
some more PM_EVENT_* codes, for example).

Thanks,
Rafael

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

end of thread, other threads:[~2008-03-02 18:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-29 17:27 [RFC] Add extra PM_EVENT_* codes for use by subsystems Alan Stern
2008-03-01 11:47 ` Pavel Machek
2008-03-02 12:57 ` Rafael J. Wysocki
2008-03-02 15:18   ` Alan Stern
2008-03-02 18:16     ` Rafael J. Wysocki

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