hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/dhd_custom_gpio.c
....@@ -1,15 +1,16 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
21 /*
32 * Customer code to add GPIO control during WLAN start/stop
43 *
5
- * Copyright (C) 1999-2019, Broadcom Corporation
6
- *
4
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
5
+ *
6
+ * Copyright (C) 1999-2017, Broadcom Corporation
7
+ *
78 * Unless you and Broadcom execute a separate written software license
89 * agreement governing use of this software, this software is licensed to you
910 * under the terms of the GNU General Public License version 2 (the "GPL"),
1011 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
1112 * following added to such license:
12
- *
13
+ *
1314 * As a special exception, the copyright holders of this software give you
1415 * permission to link this software with independent modules, and to copy and
1516 * distribute the resulting executable under terms of your choice, provided that
....@@ -17,7 +18,7 @@
1718 * the license of that module. An independent module is a module which is not
1819 * derived from this software. The special exception does not apply to any
1920 * modifications of the software.
20
- *
21
+ *
2122 * Notwithstanding the above, under no circumstances may you combine this
2223 * software in any way with any other Broadcom software provided under a license
2324 * other than the GPL, without Broadcom's express prior written consent.
....@@ -25,7 +26,7 @@
2526 *
2627 * <<Broadcom-WL-IPTag/Open:>>
2728 *
28
- * $Id: dhd_custom_gpio.c 586390 2015-09-15 10:34:19Z $
29
+ * $Id: dhd_custom_gpio.c 691191 2017-03-21 07:09:04Z $
2930 */
3031
3132 #include <typedefs.h>
....@@ -39,25 +40,16 @@
3940 #include <wlioctl.h>
4041 #if defined(WL_WIRELESS_EXT)
4142 #include <wl_iw.h>
42
-#endif
43
+#endif // endif
4344
4445 #define WL_ERROR(x) printf x
4546 #define WL_TRACE(x)
4647
47
-#if defined(CUSTOMER_HW2)
48
-
49
-
50
-#endif
51
-
52
-#if defined(OOB_INTR_ONLY)
48
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
5349
5450 #if defined(BCMLXSDMMC)
5551 extern int sdioh_mmc_irq(int irq);
5652 #endif /* (BCMLXSDMMC) */
57
-
58
-#if defined(CUSTOMER_HW3)
59
-#include <mach/gpio.h>
60
-#endif
6153
6254 /* Customer specific Host GPIO defintion */
6355 static int dhd_oob_gpio_num = -1;
....@@ -80,7 +72,7 @@
8072 {
8173 int host_oob_irq = 0;
8274
83
-#if defined(CUSTOMER_HW2)
75
+#if defined(CUSTOMER_HW2) || defined(BOARD_HIKEY)
8476 host_oob_irq = wifi_platform_get_irq_number(adapter, irq_flags_ptr);
8577
8678 #else
....@@ -99,16 +91,11 @@
9991 WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n",
10092 __FUNCTION__, dhd_oob_gpio_num));
10193
102
-#if defined CUSTOMER_HW3
103
- gpio_request(dhd_oob_gpio_num, "oob irq");
104
- host_oob_irq = gpio_to_irq(dhd_oob_gpio_num);
105
- gpio_direction_input(dhd_oob_gpio_num);
106
-#endif
107
-#endif
94
+#endif // endif
10895
10996 return (host_oob_irq);
11097 }
111
-#endif
98
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
11299
113100 /* Customer function to control hw specific wlan gpios */
114101 int
....@@ -131,9 +118,10 @@
131118 return -EINVAL;
132119
133120 /* Customer access to MAC address stored outside of DHD driver */
134
-#if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
121
+#if (defined(CUSTOMER_HW2) || defined(BOARD_HIKEY)) && (LINUX_VERSION_CODE >= \
122
+ KERNEL_VERSION(2, 6, 35))
135123 ret = wifi_platform_get_mac_addr(adapter, buf);
136
-#endif
124
+#endif // endif
137125
138126 #ifdef EXAMPLE_GET_MAC
139127 /* EXAMPLE code */
....@@ -146,14 +134,6 @@
146134 return ret;
147135 }
148136 #endif /* GET_CUSTOM_MAC_ENABLE */
149
-
150
-#if !defined(WL_WIRELESS_EXT)
151
-struct cntry_locales_custom {
152
- char iso_abbrev[WLC_CNTRY_BUF_SZ]; /* ISO 3166-1 country abbreviation */
153
- char custom_locale[WLC_CNTRY_BUF_SZ]; /* Custom firmware locale */
154
- int32 custom_locale_rev; /* Custom local revisin default -1 */
155
-};
156
-#endif /* WL_WIRELESS_EXT */
157137
158138 /* Customized Locale table : OPTIONAL feature */
159139 const struct cntry_locales_custom translate_custom_table[] = {
....@@ -202,10 +182,10 @@
202182 {"TR", "TR", 0},
203183 {"NO", "NO", 0},
204184 #endif /* EXMAPLE_TABLE */
205
-#if defined(CUSTOMER_HW2)
185
+#if (defined(CUSTOMER_HW2) || defined(BOARD_HIKEY))
206186 #if defined(BCM4335_CHIP)
207187 {"", "XZ", 11}, /* Universal if Country code is unknown or empty */
208
-#endif
188
+#endif // endif
209189 {"AE", "AE", 1},
210190 {"AR", "AR", 1},
211191 {"AT", "AT", 1},
....@@ -259,13 +239,8 @@
259239 {"PS", "XZ", 11}, /* Universal if Country code is PALESTINIAN TERRITORY, OCCUPIED */
260240 {"TL", "XZ", 11}, /* Universal if Country code is TIMOR-LESTE (EAST TIMOR) */
261241 {"MH", "XZ", 11}, /* Universal if Country code is MARSHALL ISLANDS */
262
-#ifdef BCM4330_CHIP
263
- {"RU", "RU", 1},
264
- {"US", "US", 5}
265
-#endif
266
-#endif
242
+#endif // endif
267243 };
268
-
269244
270245 /* Customized Locale convertor
271246 * input : ISO 3166-1 country abbreviation
....@@ -273,23 +248,25 @@
273248 */
274249 #ifdef CUSTOM_COUNTRY_CODE
275250 void get_customized_country_code(void *adapter, char *country_iso_code,
276
- wl_country_t *cspec, u32 flags)
251
+ wl_country_t *cspec, u32 flags)
277252 #else
278253 void get_customized_country_code(void *adapter, char *country_iso_code, wl_country_t *cspec)
279254 #endif /* CUSTOM_COUNTRY_CODE */
280255 {
281
-#if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
256
+#if defined(OEM_ANDROID)
257
+#if (defined(CUSTOMER_HW2) || defined(BOARD_HIKEY)) && (LINUX_VERSION_CODE >= \
258
+ KERNEL_VERSION(2, 6, 39))
282259
283260 struct cntry_locales_custom *cloc_ptr;
284261
285262 if (!cspec)
286263 return;
287264 #ifdef CUSTOM_COUNTRY_CODE
288
- cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code,
289
- flags);
265
+ cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code, flags);
290266 #else
291267 cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code);
292268 #endif /* CUSTOM_COUNTRY_CODE */
269
+
293270 if (cloc_ptr) {
294271 strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ);
295272 cspec->rev = cloc_ptr->custom_locale_rev;
....@@ -320,5 +297,8 @@
320297 cspec->rev = translate_custom_table[0].custom_locale_rev;
321298 #endif /* EXMAPLE_TABLE */
322299 return;
323
-#endif /* defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) */
300
+#endif /* (defined(CUSTOMER_HW2) || defined(BOARD_HIKEY)) &&
301
+ * (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36))
302
+ */
303
+#endif /* OEM_ANDROID */
324304 }