Merge tag 'v3.10.56' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / kernel / power / power.h
index 7d4b7ffb3c1d4371f19e81fe83c67ea88ac83759..4c21e724161356d4993c3c70a31e5aa0b15366b2 100644 (file)
@@ -35,8 +35,12 @@ static inline char *check_image_kernel(struct swsusp_info *info)
        return arch_hibernation_header_restore(info) ?
                        "architecture specific data" : NULL;
 }
+#else
+extern char *check_image_kernel(struct swsusp_info *info);
 #endif /* CONFIG_ARCH_HIBERNATION_HEADER */
+extern int init_header(struct swsusp_info *info);
 
+extern char resume_file[256];
 /*
  * Keep some memory free so that I/O operations can succeed without paging
  * [Might this be more than 4 MB?]
@@ -55,6 +59,7 @@ extern bool freezer_test_done;
 extern int hibernation_snapshot(int platform_mode);
 extern int hibernation_restore(int platform_mode);
 extern int hibernation_platform_enter(void);
+extern void platform_recover(int platform_mode);
 
 #else /* !CONFIG_HIBERNATION */
 
@@ -74,6 +79,8 @@ static struct kobj_attribute _name##_attr = { \
        .store  = _name##_store,                \
 }
 
+extern struct pbe *restore_pblist;
+
 /* Preferred image size in bytes (default 500 MB) */
 extern unsigned long image_size;
 /* Size of memory reserved for drivers (default SPARE_PAGES x PAGE_SIZE) */
@@ -175,17 +182,20 @@ extern void swsusp_show_speed(struct timeval *, struct timeval *,
                                unsigned int, char *);
 
 #ifdef CONFIG_SUSPEND
+struct pm_sleep_state {
+       const char *label;
+       suspend_state_t state;
+};
+
 /* kernel/power/suspend.c */
-extern const char *const pm_states[];
+extern struct pm_sleep_state pm_states[];
 
-extern bool valid_state(suspend_state_t state);
 extern int suspend_devices_and_enter(suspend_state_t state);
 #else /* !CONFIG_SUSPEND */
 static inline int suspend_devices_and_enter(suspend_state_t state)
 {
        return -ENOSYS;
 }
-static inline bool valid_state(suspend_state_t state) { return false; }
 #endif /* !CONFIG_SUSPEND */
 
 #ifdef CONFIG_PM_TEST_SUSPEND
@@ -268,6 +278,90 @@ static inline void suspend_thaw_processes(void)
 }
 #endif
 
+extern struct page *saveable_page(struct zone *z, unsigned long p);
+#ifdef CONFIG_HIGHMEM
+extern struct page *saveable_highmem_page(struct zone *z, unsigned long p);
+#else
+static
+inline struct page *saveable_highmem_page(struct zone *z, unsigned long p)
+{
+       return NULL;
+}
+#endif
+
+#define PBES_PER_PAGE (PAGE_SIZE / sizeof(struct pbe))
+extern struct list_head nosave_regions;
+
+/**
+ *     This structure represents a range of page frames the contents of which
+ *     should not be saved during the suspend.
+ */
+
+struct nosave_region {
+       struct list_head list;
+       unsigned long start_pfn;
+       unsigned long end_pfn;
+};
+
+#define BM_END_OF_MAP  (~0UL)
+
+#define BM_BITS_PER_BLOCK      (PAGE_SIZE * BITS_PER_BYTE)
+
+struct bm_block {
+       struct list_head hook;          /* hook into a list of bitmap blocks */
+       unsigned long start_pfn;        /* pfn represented by the first bit */
+       unsigned long end_pfn;  /* pfn represented by the last bit plus 1 */
+       unsigned long *data;    /* bitmap representing pages */
+};
+
+/* struct bm_position is used for browsing memory bitmaps */
+
+struct bm_position {
+       struct bm_block *block;
+       int bit;
+};
+
+struct memory_bitmap {
+       struct list_head blocks;        /* list of bitmap blocks */
+       struct linked_page *p_list;     /* list of pages used to store zone
+                                        * bitmap objects and bitmap block
+                                        * objects
+                                        */
+       struct bm_position *states;     /* most recently used bit position */
+       int num_states;                 /* when iterating over a bitmap and
+                                        * number of states we support.
+                                        */
+};
+
+extern int memory_bm_create(struct memory_bitmap *bm, gfp_t gfp_mask,
+               int safe_needed);
+extern int memory_bm_create_index(struct memory_bitmap *bm, gfp_t gfp_mask,
+               int safe_needed, int index);
+extern void memory_bm_free(struct memory_bitmap *bm, int clear_nosave_free);
+extern void memory_bm_set_bit(struct memory_bitmap *bm, unsigned long pfn);
+extern void memory_bm_clear_bit(struct memory_bitmap *bm, unsigned long pfn);
+extern void memory_bm_clear_bit_index(struct memory_bitmap *bm, unsigned long pfn, int index);
+extern int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn);
+extern int memory_bm_test_bit_index(struct memory_bitmap *bm, unsigned long pfn, int index);
+extern unsigned long memory_bm_next_pfn(struct memory_bitmap *bm);
+extern unsigned long memory_bm_next_pfn_index(struct memory_bitmap *bm,
+               int index);
+extern void memory_bm_position_reset(struct memory_bitmap *bm);
+extern void memory_bm_clear(struct memory_bitmap *bm);
+extern void memory_bm_copy(struct memory_bitmap *source,
+               struct memory_bitmap *dest);
+extern void memory_bm_dup(struct memory_bitmap *source,
+               struct memory_bitmap *dest);
+extern int memory_bm_set_iterators(struct memory_bitmap *bm, int number);
+
+#ifdef CONFIG_TOI
+struct toi_module_ops;
+extern int memory_bm_read(struct memory_bitmap *bm, int (*rw_chunk)
+       (int rw, struct toi_module_ops *owner, char *buffer, int buffer_size));
+extern int memory_bm_write(struct memory_bitmap *bm, int (*rw_chunk)
+       (int rw, struct toi_module_ops *owner, char *buffer, int buffer_size));
+#endif
+
 #ifdef CONFIG_PM_AUTOSLEEP
 
 /* kernel/power/autosleep.c */
@@ -286,6 +380,15 @@ static inline suspend_state_t pm_autosleep_state(void) { return PM_SUSPEND_ON; }
 
 #endif /* !CONFIG_PM_AUTOSLEEP */
 
+#ifdef CONFIG_EARLYSUSPEND
+/* kernel/power/earlysuspend.c */
+void request_suspend_state(suspend_state_t state);
+suspend_state_t get_suspend_state(void);
+//[MTK]
+extern void suspend_syssync_enqueue(void) ;
+extern void suspend_check_sys_sync_done(void);
+#endif
+
 #ifdef CONFIG_PM_WAKELOCKS
 
 /* kernel/power/wakelock.c */