android_kernel_google_msm/include/linux/partialresume.h
Iliyan Malchev 4e0c8780cc power: add partial-resume framework
Partial resume refers to the concept of not waking up userspace when the kernel
comes out of suspend for certain types of events that we wish to discard.  An
example is a network packet that can be disacarded in the kernel, or spurious
wakeup event that we wish to ignore.  Partial resume allows drivers to register
callbacks, one one hand, and provides hooks into the PM's suspend/resume
mechanism, on the other.

When a device resumes from suspend, the core suspend/resume code invokes
partialresume to check to see if the set of wakeup interrupts all have
matching handlers. If this is not the case, the PM subsystem can continue to
resume as before.  If all of the wakeup sources have matching handlers, then
those are invoked in turn (and can block), and if all of them reach consensus
that the reason for the wakeup can be ignored, they say so to the PM subsystem,
which goes right back into suspend.  This latter support is implemented in a
separate change.

Signed-off-by: Iliyan Malchev <malchev@google.com>
Change-Id: Id50940bb22a550b413412264508d259f7121d442
2017-10-15 17:05:08 +03:00

55 lines
1.5 KiB
C

/* include/linux/partialresume.h
*
* Copyright (C) 2015 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _LINUX_PARTIALRESUME_H
#define _LINUX_PARTIALRESUME_H
#ifdef CONFIG_PARTIALRESUME
#include <linux/list.h>
struct partial_resume_stats {
unsigned total;
unsigned total_yes;
};
struct partial_resume {
struct list_head next_handler;
struct list_head next_match;
int irq;
struct partial_resume_stats stats;
void *private;
bool (*partial_resume)(struct partial_resume *);
};
int register_partial_resume(struct partial_resume *handler);
void unregister_partial_resume(struct partial_resume *handler);
bool suspend_again_match(const struct list_head *irqs,
const struct list_head *unfinished);
bool suspend_again_consensus(void);
#else /* !CONFIG_PARTIALRESUME */
struct partial_resume;
static inline int register_partial_resume(struct partial_resume *handler) { return 0; }
static inline void unregister_partial_resume(struct partial_resume *handler) {}
static inline bool suspend_again_match(const struct list_head *irqs) { return false; }
static inline bool suspend_again_consensus(void) { return false; }
#endif
#endif