1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3 *
4 * Copyright(c) 2007 - 2017 Realtek Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 *****************************************************************************/
16
17 #ifndef __RTW_ANDROID_H__
18 #define __RTW_ANDROID_H__
19
20 enum ANDROID_WIFI_CMD {
21 ANDROID_WIFI_CMD_START,
22 ANDROID_WIFI_CMD_STOP,
23 ANDROID_WIFI_CMD_SCAN_ACTIVE,
24 ANDROID_WIFI_CMD_SCAN_PASSIVE,
25 ANDROID_WIFI_CMD_RSSI,
26 ANDROID_WIFI_CMD_LINKSPEED,
27 ANDROID_WIFI_CMD_RXFILTER_START,
28 ANDROID_WIFI_CMD_RXFILTER_STOP,
29 ANDROID_WIFI_CMD_RXFILTER_ADD,
30 ANDROID_WIFI_CMD_RXFILTER_REMOVE,
31 ANDROID_WIFI_CMD_BTCOEXSCAN_START,
32 ANDROID_WIFI_CMD_BTCOEXSCAN_STOP,
33 ANDROID_WIFI_CMD_BTCOEXMODE,
34 ANDROID_WIFI_CMD_SETSUSPENDMODE,
35 ANDROID_WIFI_CMD_SETSUSPENDOPT,
36 ANDROID_WIFI_CMD_P2P_DEV_ADDR,
37 ANDROID_WIFI_CMD_SETFWPATH,
38 ANDROID_WIFI_CMD_SETBAND,
39 ANDROID_WIFI_CMD_GETBAND,
40 ANDROID_WIFI_CMD_COUNTRY,
41 ANDROID_WIFI_CMD_P2P_SET_NOA,
42 ANDROID_WIFI_CMD_P2P_GET_NOA,
43 ANDROID_WIFI_CMD_P2P_SET_PS,
44 ANDROID_WIFI_CMD_SET_AP_WPS_P2P_IE,
45
46 ANDROID_WIFI_CMD_MIRACAST,
47
48 #ifdef CONFIG_PNO_SUPPORT
49 ANDROID_WIFI_CMD_PNOSSIDCLR_SET,
50 ANDROID_WIFI_CMD_PNOSETUP_SET,
51 ANDROID_WIFI_CMD_PNOENABLE_SET,
52 ANDROID_WIFI_CMD_PNODEBUG_SET,
53 #endif
54
55 ANDROID_WIFI_CMD_MACADDR,
56
57 ANDROID_WIFI_CMD_BLOCK_SCAN,
58 ANDROID_WIFI_CMD_BLOCK,
59
60 ANDROID_WIFI_CMD_WFD_ENABLE,
61 ANDROID_WIFI_CMD_WFD_DISABLE,
62
63 ANDROID_WIFI_CMD_WFD_SET_TCPPORT,
64 ANDROID_WIFI_CMD_WFD_SET_MAX_TPUT,
65 ANDROID_WIFI_CMD_WFD_SET_DEVTYPE,
66 ANDROID_WIFI_CMD_CHANGE_DTIM,
67 ANDROID_WIFI_CMD_HOSTAPD_SET_MACADDR_ACL,
68 ANDROID_WIFI_CMD_HOSTAPD_ACL_ADD_STA,
69 ANDROID_WIFI_CMD_HOSTAPD_ACL_REMOVE_STA,
70 #if defined(CONFIG_GTK_OL) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0))
71 ANDROID_WIFI_CMD_GTK_REKEY_OFFLOAD,
72 #endif /* CONFIG_GTK_OL */
73 ANDROID_WIFI_CMD_P2P_DISABLE,
74 ANDROID_WIFI_CMD_SET_AEK,
75 ANDROID_WIFI_CMD_EXT_AUTH_STATUS,
76 ANDROID_WIFI_CMD_DRIVERVERSION,
77 ANDROID_WIFI_CMD_MAX
78 };
79
80 int rtw_android_cmdstr_to_num(char *cmdstr);
81 int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd);
82
83 #if defined(CONFIG_PNO_SUPPORT) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
84 int rtw_android_pno_enable(struct net_device *net, int pno_enable);
85 int rtw_android_cfg80211_pno_setup(struct net_device *net,
86 struct cfg80211_ssid *ssid, int n_ssids, int interval);
87 #endif
88
89 #if defined(RTW_ENABLE_WIFI_CONTROL_FUNC)
90 int rtw_android_wifictrl_func_add(void);
91 void rtw_android_wifictrl_func_del(void);
92 void *wl_android_prealloc(int section, unsigned long size);
93
94 int wifi_get_irq_number(unsigned long *irq_flags_ptr);
95 int wifi_set_power(int on, unsigned long msec);
96 int wifi_get_mac_addr(unsigned char *buf);
97 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
98 void *wifi_get_country_code(char *ccode, u32 flags);
99 #else /* Linux kernel < 3.18 */
100 void *wifi_get_country_code(char *ccode);
101 #endif /* Linux kernel < 3.18 */
102 #else
rtw_android_wifictrl_func_add(void)103 static inline int rtw_android_wifictrl_func_add(void)
104 {
105 return 0;
106 }
rtw_android_wifictrl_func_del(void)107 static inline void rtw_android_wifictrl_func_del(void) {}
108 #endif /* defined(RTW_ENABLE_WIFI_CONTROL_FUNC) */
109
110 #ifdef CONFIG_GPIO_WAKEUP
111 #ifdef CONFIG_PLATFORM_INTEL_BYT
112 int wifi_configure_gpio(void);
113 #endif /* CONFIG_PLATFORM_INTEL_BYT */
114 void wifi_free_gpio(unsigned int gpio);
115 #endif /* CONFIG_GPIO_WAKEUP */
116
117
118 #endif /* __RTW_ANDROID_H__ */
119