Merge tag 'v3.10.55' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-mt8127 / include / mach / mtk_ccci_helper.h
1 #ifndef __MTK_CCCI_HELPER_H
2 #define __MTK_CCCI_HELPER_H
3
4
5
6 //-------------md sys configure------------------------//
7 #define MAX_MD_NUM (1)
8 #define MD_SYS1 (0)
9 #define MD_SYS2 (1)
10 #define CURR_MD_ID (0)
11 #define MD1_EN (1<<0)
12 #define MD2_EN (1<<1)
13
14
15 //-------------other configure-------------------------//
16 #define MAX_KERN_API (20)
17 #define MAX_SLEEP_API (20)
18 #define MAX_FILTER_MEMBER (4)
19
20
21 //-------------error code define-----------------------//
22 #define E_NO_EXIST (-1)
23 #define E_PARAM (-2)
24
25
26 //-------------META MD setting define------------------//
27 #define MD1_SETTING_ACTIVE (1<<0)
28 #define MD2_SETTING_ACTIVE (1<<1)
29
30 #define MD_2G_FLAG (1<<0)
31 #define MD_WG_FLAG (1<<1)
32 #define MD_TG_FLAG (1<<2)
33 #define MD_LTE_FLAG (1<<3)
34
35
36 //-------------enum define---------------------------//
37 /*modem image version definitions*/
38 typedef enum{
39 AP_IMG_INVALID = 0,
40 AP_IMG_2G,
41 AP_IMG_3G
42 }AP_IMG_TYPE;
43
44
45 typedef enum {
46 ID_GET_MD_WAKEUP_SRC = 0,
47 ID_CCCI_DORMANCY = 1,
48 ID_LOCK_MD_SLEEP = 2,
49 ID_ACK_MD_SLEEP = 3,
50 ID_SSW_SWITCH_MODE = 4,
51 ID_SET_MD_TX_LEVEL = 5,
52 ID_GET_TXPOWER = 6, // For thermal
53 ID_IPO_H_RESTORE_CB = 7,
54 ID_FORCE_MD_ASSERT = 8,
55 }KERN_FUNC_ID;
56
57 // System channel, AP -->(/ <-->) MD message start from 0x100
58 enum {
59 MD_DORMANT_NOTIFY = 0x100,
60 MD_SLP_REQUEST = 0x101,
61 MD_TX_POWER = 0x102,
62 MD_RF_TEMPERATURE = 0x103,
63 MD_RF_TEMPERATURE_3G = 0x104,
64 MD_GET_BATTERY_INFO = 0x105,
65 MD_SIM_TYPE = 0x107, //for regional phone boot animation
66 };
67
68 typedef enum {
69 RSM_ID_RESUME_WDT_IRQ = 0,
70 RSM_ID_MD_LOCK_DORMANT = 1,
71 RSM_ID_WAKE_UP_MD = 2,
72 RSM_ID_MAX
73 }RESUME_ID;
74
75 typedef enum {
76 SLP_ID_MD_FAST_DROMANT = 0,
77 SLP_ID_MD_UNLOCK_DORMANT = 1,
78 SLP_ID_MAX
79 }SLEEP_ID;
80
81 typedef enum {
82 ID_GET_FDD_THERMAL_DATA = 0,
83 ID_GET_TDD_THERMAL_DATA,
84 }SYS_CB_ID;
85
86
87 typedef enum {
88 md_type_invalid = 0,
89 modem_2g = 1,
90 modem_3g,
91 modem_wg,
92 modem_tg,
93 }modem_type_t;
94
95 //-------------structure define------------------------//
96 typedef int (*ccci_kern_cb_func_t)(int, char *, unsigned int);
97 typedef struct{
98 KERN_FUNC_ID id;
99 ccci_kern_cb_func_t func;
100 }ccci_kern_func_info;
101
102
103 typedef int (*ccci_sys_cb_func_t)(int, int);
104 typedef struct{
105 SYS_CB_ID id;
106 ccci_sys_cb_func_t func;
107 }ccci_sys_cb_func_info_t;
108
109
110 typedef size_t (*ccci_filter_cb_func_t)(char *, size_t);
111 typedef struct _cmd_op_map{
112 char cmd[8];
113 int cmd_len;
114 ccci_filter_cb_func_t store;
115 ccci_filter_cb_func_t show;
116 }cmd_op_map_t;
117
118
119
120 //-----------------export function declaration----------------------------//
121 AP_IMG_TYPE get_ap_img_ver(void);
122 int get_td_eint_info(int md_id, char * eint_name, unsigned int len);
123 int get_md_gpio_info(int md_id, char *gpio_name, unsigned int len);
124 int get_md_gpio_val(int md_id, unsigned int num);
125 int get_md_adc_info(int md_id, char *adc_name, unsigned int len);
126 int get_md_adc_val(int md_id, unsigned int num);
127 int get_dram_type_clk(int *clk, int *type);
128 int get_eint_attr(char *name, unsigned int name_len, unsigned int type, char * result, unsigned int *len);
129 int get_bat_info(unsigned int para);
130
131
132 unsigned int get_nr_modem(void);
133 unsigned int *get_modem_size_list(void);
134 int parse_ccci_dfo_setting(void *dfo_data, int num);
135 int parse_meta_md_setting(unsigned char args[]);
136
137 unsigned int get_md_mem_start_addr(int md_id);
138 unsigned int get_md_share_mem_start_addr(int md_id);
139 unsigned int get_smem_base_addr(int md_id);
140 unsigned int get_modem_is_enabled(int md_id);
141 unsigned int get_resv_mem_size_for_md(int md_id);
142 unsigned int get_resv_share_mem_size_for_md(int md_id);
143 void get_md_post_fix(int md_id, char buf[], char buf_ex[]);
144 unsigned int get_modem_support(int md_id);
145 unsigned int set_modem_support(int md_id, int md_type);
146
147
148 int register_filter_func(char cmd[], ccci_filter_cb_func_t store, ccci_filter_cb_func_t show);
149
150 int register_ccci_kern_func(unsigned int id, ccci_kern_cb_func_t func);
151 int register_ccci_kern_func_by_md_id(int md_id, unsigned int id, ccci_kern_cb_func_t func);
152 int exec_ccci_kern_func(unsigned int id, char *buf, unsigned int len);
153 int exec_ccci_kern_func_by_md_id(int md_id, unsigned int id, char *buf, unsigned int len);
154
155 void register_suspend_notify(int md_id, unsigned int id, void (*func)(int));
156 void register_resume_notify(int md_id, unsigned int id, void (*func)(int));
157
158 int register_sys_msg_notify_func(int md_id, int (*func)(int, unsigned int, unsigned int));
159 int notify_md_by_sys_msg(int md_id, unsigned int msg, unsigned int data);
160
161 int register_ccci_sys_call_back(int md_id, unsigned int id, ccci_sys_cb_func_t func);
162 void exec_ccci_sys_call_back(int md_id, int cb_id, int data);
163
164 void ccci_helper_exit(void);
165 void ccci_md_mem_reserve(void);
166 #endif