Merge tag 'v3.10.55' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-mt8127 / include / mach / mtk_eemcs_helper.h
1 #ifndef __MTK_EEMCS_HELPER_H
2 #define __MTK_EEMCS_HELPER_H
3
4 #define MD_SYS5 (4) // MD SYS counts from 1, but internal index counts from 0
5 #define MD5_EN (1<<4)
6 #define MD_EXT1 MD_SYS5 // the first external MD's ID
7 #define MAX_EXT_MD_NUM (1) // external MD uses ID 5, 6, 7, 8
8
9 #define CURR_EXT_MD_ID (0)
10
11 /* remove to avoid redeclaration
12 #define MD1_SETTING_ACTIVE (1<<0)
13 #define MD2_SETTING_ACTIVE (1<<1)
14 */
15 #define MD5_SETTING_ACTIVE (1<<4)
16
17 /* remove to avoid redeclaration
18 #define MD_2G_FLAG (1<<0)
19 #define MD_WG_FLAG (1<<1)
20 #define MD_TG_FLAG (1<<2)
21 #define MD_LTE_FLAG (1<<3)
22 */
23 #define MD_LWG_FLAG ((1<<3)|(1<<1)|(1<<0))
24 #define MD_LTG_FLAG ((1<<3)|(1<<2)|(1<<0))
25
26
27 //-------------other configure-------------------------//
28 #define MAX_KERN_API (20)
29 #define MAX_SLEEP_API (20)
30
31 //-------------error code define-----------------------//
32 #define E_NO_EXIST (-1)
33 #define E_PARAM (-2)
34
35 typedef enum {
36 EEMCS_ID_GET_MD_WAKEUP_SRC = 0,
37 EEMCS_ID_CCCI_DORMANCY = 1,
38 EEMCS_ID_LOCK_MD_SLEEP = 2,
39 EEMCS_ID_ACK_MD_SLEEP = 3,
40 EEMCS_ID_SSW_SWITCH_MODE = 4,
41 EEMCS_ID_SET_MD_TX_LEVEL = 5,
42 EEMCS_ID_GET_TXPOWER = 6, // For thermal
43 EEMCS_ID_IPO_H_RESTORE_CB = 7,
44 }EEMCS_KERN_FUNC_ID;
45
46 enum {
47 EXT_MD_DORMANT_NOTIFY = 0x100,
48 EXT_MD_SLP_REQUEST = 0x101,
49 EXT_MD_TX_POWER = 0x102,
50 EXT_MD_RF_TEMPERATURE = 0x103,
51 EXT_MD_RF_TEMPERATURE_3G = 0x104,
52 EXT_MD_GET_BATTERY_INFO = 0x105,
53 EXT_MD_SIM_TYPE = 0x107,
54 };
55
56 typedef enum {
57 EEMCS_RSM_ID_RESUME_WDT_IRQ = 0,
58 EEMCS_RSM_ID_MD_LOCK_DORMANT = 1,
59 EEMCS_RSM_ID_WAKE_UP_MD = 2,
60 EEMCS_RSM_ID_MAX
61 }EEMCS_RESUME_ID;
62
63 typedef enum {
64 EEMCS_SLP_ID_MD_FAST_DROMANT = 0,
65 EEMCS_SLP_ID_MD_UNLOCK_DORMANT = 1,
66 EEMCS_SLP_ID_MAX
67 }EEMCS_SLEEP_ID;
68
69 typedef enum {
70 EEMCS_ID_GET_FDD_THERMAL_DATA = 0,
71 EEMCS_ID_GET_TDD_THERMAL_DATA,
72 }EEMCS_SYS_CB_ID;
73
74
75 typedef enum {
76 modem_invalid = 0,
77 /* remove to avoid redeclaration
78 modem_2g = 1,
79 modem_3g,
80 modem_wg,
81 modem_tg,
82 */
83 modem_lwg=5,
84 modem_ltg,
85 }ext_modem_type_t;
86
87
88 //-------------structure define------------------------//
89 typedef int (*eemcs_kern_cb_func_t)(int, char *, unsigned int);
90 typedef struct{
91 EEMCS_KERN_FUNC_ID id;
92 eemcs_kern_cb_func_t func;
93 }eemcs_kern_func_info;
94
95 typedef int (*eemcs_sys_cb_func_t)(int, int);
96 typedef struct{
97 EEMCS_SYS_CB_ID id;
98 eemcs_sys_cb_func_t func;
99 }eemcs_sys_cb_func_info_t;
100
101
102 //-----------------export function declaration----------------------------//
103 int parse_eemcs_dfo_setting(void *dfo_data, int num);
104 int parse_ext_meta_md_setting(unsigned char args[]);
105 void get_ext_md_post_fix(int md_id, char buf[], char buf_ex[]);
106 unsigned int get_ext_modem_is_enabled(int md_id);
107 unsigned int get_ext_modem_support(int md_id);
108 unsigned int set_ext_modem_support(int md_id, int md_type);
109 void get_ap_platform_ver(char * ver);
110 unsigned int get_nr_ext_modem(void);
111 unsigned int *get_ext_modem_size_list(void);
112 unsigned int get_ext_md_mem_start_addr(int md_id);
113 unsigned int get_ext_md_mem_size(int md_id);
114 int clear_md_region_protection(int md_id);
115 void eemcs_memory_reserve(void);
116
117 int eemcs_register_ccci_kern_func(unsigned int id, eemcs_kern_cb_func_t func);
118 int eemcs_register_ccci_kern_func_by_md_id(int md_id, unsigned int id, eemcs_kern_cb_func_t func);
119 int eemcs_exec_ccci_kern_func(unsigned int id, char *buf, unsigned int len);
120 int eemcs_exec_ccci_kern_func_by_md_id(int md_id, unsigned int id, char *buf, unsigned int len);
121
122 void eemcs_register_suspend_notify(int md_id, unsigned int id, void (*func)(int));
123 void eemcs_register_resume_notify(int md_id, unsigned int id, void (*func)(int));
124
125 int eemcs_register_sys_msg_notify_func(int md_id, int (*func)(int, unsigned int, unsigned int));
126 int eemcs_notify_md_by_sys_msg(int md_id, unsigned int msg, unsigned int data);
127
128 int eemcs_register_ccci_sys_call_back(int md_id, unsigned int id, eemcs_sys_cb_func_t func);
129 void eemcs_exec_ccci_sys_call_back(int md_id, int cb_id, int data);
130
131 int eemcs_get_bat_info(unsigned int para);
132
133 #endif