• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * include/linux/amlogic/pm.h
3  *
4  * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  */
17 
18 #ifndef __AML_PM_H__
19 #define __AML_PM_H__
20 #include <linux/notifier.h>
21 
22 /* wake up reason*/
23 #define	UDEFINED_WAKEUP	0
24 #define	CHARGING_WAKEUP	1
25 #define	REMOTE_WAKEUP		2
26 #define	RTC_WAKEUP			3
27 #define	BT_WAKEUP			4
28 #define	WIFI_WAKEUP			5
29 #define	POWER_KEY_WAKEUP	6
30 #define	AUTO_WAKEUP			7
31 #define	CEC_WAKEUP			8
32 #define	REMOTE_CUS_WAKEUP		9
33 #define ETH_PHY_WAKEUP      10
34 extern unsigned int get_resume_method(void);
35 extern unsigned int is_pm_freeze_mode(void);
36 #ifdef CONFIG_AMLOGIC_ADC_KEYPADS
37 bool meson_adc_is_alive_freeze(void);
38 #endif
39 
40 #ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
41 enum {
42 	EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50,
43 	EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100,
44 	EARLY_SUSPEND_LEVEL_DISABLE_FB = 150,
45 };
46 
47 struct early_suspend {
48 	struct list_head link;
49 	int level;
50 	void (*suspend)(struct early_suspend *h);
51 	void (*resume)(struct early_suspend *h);
52 	void *param;
53 };
54 extern void register_early_suspend(struct early_suspend *handler);
55 extern void unregister_early_suspend(struct early_suspend *handler);
56 extern unsigned int lgcy_early_suspend_init(void);
57 extern unsigned int is_pm_freeze_mode(void);
58 
59 
60 #endif //CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
61 
62 #ifdef CONFIG_AMLOGIC_M8B_SUSPEND
63 /*l2c virtual addr*/
64 #define IO_PL310_BASE 0xfe000000
65 
66 /*IR, power key, low power,
67  *adapter plug in/out and so on,
68  *are all use this flag.
69  */
70 #define FLAG_WAKEUP_PWRKEY		0x1234abcd
71 #define FLAG_WAKEUP_ALARM		0x12345678
72 #define FLAG_WAKEUP_WIFI		0x12340001
73 #define FLAG_WAKEUP_BT			0x12340002
74 #define FLAG_WAKEUP_PWROFF		0x12340003
75 
76 /*AOBUS*/
77 #define AO_RTI_STATUS_REG2 0x0008
78 #define AO_RTC_ADDR0 0x0740
79 #define AO_RTC_ADDR1 0x0744
80 #define AO_RTC_ADDR2 0x0748
81 #define AO_RTC_ADDR3 0x074c
82 #define AO_UART_STATUS 0x04cc
83 #define AO_UART_REG5   0x04d4
84 
85 /*CBUS*/
86 #define HHI_SYS_PLL_CNTL  0x10c0
87 #define HHI_MPEG_CLK_CNTL 0x105d
88 
89 #endif //CONFIG_AMLOGIC_M8B_SUSPEND
90 #ifdef CONFIG_PM_SLEEP_DEBUG
91 extern bool pm_print_times_enabled;
92 #else
93 #define pm_print_times_enabled	(false)
94 #endif
95 ktime_t callback_debug_start(void);
96 void callback_debug_report(ktime_t calltime, void *callback);
97 #endif //__AML_PM_H__
98