hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c
....@@ -3,6 +3,12 @@
33 #include <osl.h>
44 #include <dhd_linux.h>
55 #include <linux/gpio.h>
6
+#ifdef BCMDHD_DTS
7
+#include <linux/of_gpio.h>
8
+#endif
9
+#ifdef BCMDHD_PLATDEV
10
+#include <linux/platform_device.h>
11
+#endif
612 #ifdef CUSTOMER_HW_ROCKCHIP
713 #include <linux/rfkill-wlan.h>
814 #endif
....@@ -34,7 +40,7 @@
3440
3541 #ifdef BCMDHD_DTS
3642 /* This is sample code in dts file.
37
-bcmdhd {
43
+bcmdhd_wlan {
3844 compatible = "android,bcmdhd_wlan";
3945 gpio_wl_reg_on = <&gpio GPIOH_4 GPIO_ACTIVE_HIGH>;
4046 gpio_wl_host_wake = <&gpio GPIOZ_15 GPIO_ACTIVE_HIGH>;
....@@ -159,7 +165,7 @@
159165 err = sdhci_force_presence_change(&sdmmc_channel, 0);
160166 #endif /* CUSTOMER_HW_PLATFORM */
161167 #ifdef CUSTOMER_HW_ROCKCHIP
162
- rockchip_wifi_set_carddetect(0);
168
+ rockchip_wifi_set_carddetect(0);
163169 #endif
164170 #elif defined(BCMPCIE)
165171 printf("======== Card detection to remove PCIE card! ========\n");
....@@ -277,9 +283,9 @@
277283 struct device_node *root_node = NULL;
278284 #endif
279285 int err = 0;
280
- int gpio_wl_reg_on;
286
+ int gpio_wl_reg_on = -1;
281287 #ifdef CUSTOMER_OOB
282
- int gpio_wl_host_wake;
288
+ int gpio_wl_host_wake = -1;
283289 int host_oob_irq = -1;
284290 uint host_oob_irq_flags = 0;
285291 #ifdef CUSTOMER_HW_ROCKCHIP
....@@ -293,9 +299,19 @@
293299 * WL_REG_ON and WL_HOST_WAKE.
294300 */
295301 #ifdef BCMDHD_DTS
302
+#ifdef BCMDHD_PLATDEV
303
+ if (adapter->pdev) {
304
+ root_node = adapter->pdev->dev.of_node;
305
+ strcpy(wlan_node, root_node->name);
306
+ } else {
307
+ printf("%s: adapter->pdev is NULL\n", __FUNCTION__);
308
+ return -1;
309
+ }
310
+#else
296311 strcpy(wlan_node, DHD_DT_COMPAT_ENTRY);
297
- printf("======== Get GPIO from DTS(%s) ========\n", wlan_node);
298312 root_node = of_find_compatible_node(NULL, NULL, wlan_node);
313
+#endif
314
+ printf("======== Get GPIO from DTS(%s) ========\n", wlan_node);
299315 if (root_node) {
300316 gpio_wl_reg_on = of_get_named_gpio(root_node, GPIO_WL_REG_ON_PROPNAME, 0);
301317 #ifdef CUSTOMER_OOB