Skip to content

Commit

Permalink
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/jikos/apm into pm-apm-next

Pull APM update for 3.14-rc1 from Jiri Kosina.

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/apm:
  apm-emulation: add hibernation APM events to support suspend2disk
  • Loading branch information
Rafael J. Wysocki committed Jan 11, 2014
2 parents 13de22c + 1582043 commit 6a1c64c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/char/apm-emulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,17 @@ static int apm_suspend_notifier(struct notifier_block *nb,
{
struct apm_user *as;
int err;
unsigned long apm_event;

/* short-cut emergency suspends */
if (atomic_read(&userspace_notification_inhibit))
return NOTIFY_DONE;

switch (event) {
case PM_SUSPEND_PREPARE:
case PM_HIBERNATION_PREPARE:
apm_event = (event == PM_SUSPEND_PREPARE) ?
APM_USER_SUSPEND : APM_USER_HIBERNATION;
/*
* Queue an event to all "writer" users that we want
* to suspend and need their ack.
Expand All @@ -550,7 +554,7 @@ static int apm_suspend_notifier(struct notifier_block *nb,
as->writer && as->suser) {
as->suspend_state = SUSPEND_PENDING;
atomic_inc(&suspend_acks_pending);
queue_add_event(&as->queue, APM_USER_SUSPEND);
queue_add_event(&as->queue, apm_event);
}
}

Expand Down Expand Up @@ -601,11 +605,14 @@ static int apm_suspend_notifier(struct notifier_block *nb,
return notifier_from_errno(err);

case PM_POST_SUSPEND:
case PM_POST_HIBERNATION:
apm_event = (event == PM_POST_SUSPEND) ?
APM_NORMAL_RESUME : APM_HIBERNATION_RESUME;
/*
* Anyone on the APM queues will think we're still suspended.
* Send a message so everyone knows we're now awake again.
*/
queue_event(APM_NORMAL_RESUME);
queue_event(apm_event);

/*
* Finally, wake up anyone who is sleeping on the suspend.
Expand Down
2 changes: 2 additions & 0 deletions include/uapi/linux/apm_bios.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ struct apm_bios_info {
#define APM_USER_SUSPEND 0x000a
#define APM_STANDBY_RESUME 0x000b
#define APM_CAPABILITY_CHANGE 0x000c
#define APM_USER_HIBERNATION 0x000d
#define APM_HIBERNATION_RESUME 0x000e

/*
* Error codes
Expand Down

0 comments on commit 6a1c64c

Please sign in to comment.