| .. | .. |
|---|
| 3 | 3 | #include <osl.h> |
|---|
| 4 | 4 | #include <dhd_linux.h> |
|---|
| 5 | 5 | #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 |
|---|
| 6 | 12 | #ifdef CUSTOMER_HW_ROCKCHIP |
|---|
| 7 | 13 | #include <linux/rfkill-wlan.h> |
|---|
| 8 | 14 | #endif |
|---|
| .. | .. |
|---|
| 34 | 40 | |
|---|
| 35 | 41 | #ifdef BCMDHD_DTS |
|---|
| 36 | 42 | /* This is sample code in dts file. |
|---|
| 37 | | -bcmdhd { |
|---|
| 43 | +bcmdhd_wlan { |
|---|
| 38 | 44 | compatible = "android,bcmdhd_wlan"; |
|---|
| 39 | 45 | gpio_wl_reg_on = <&gpio GPIOH_4 GPIO_ACTIVE_HIGH>; |
|---|
| 40 | 46 | gpio_wl_host_wake = <&gpio GPIOZ_15 GPIO_ACTIVE_HIGH>; |
|---|
| .. | .. |
|---|
| 159 | 165 | err = sdhci_force_presence_change(&sdmmc_channel, 0); |
|---|
| 160 | 166 | #endif /* CUSTOMER_HW_PLATFORM */ |
|---|
| 161 | 167 | #ifdef CUSTOMER_HW_ROCKCHIP |
|---|
| 162 | | - rockchip_wifi_set_carddetect(0); |
|---|
| 168 | + rockchip_wifi_set_carddetect(0); |
|---|
| 163 | 169 | #endif |
|---|
| 164 | 170 | #elif defined(BCMPCIE) |
|---|
| 165 | 171 | printf("======== Card detection to remove PCIE card! ========\n"); |
|---|
| .. | .. |
|---|
| 277 | 283 | struct device_node *root_node = NULL; |
|---|
| 278 | 284 | #endif |
|---|
| 279 | 285 | int err = 0; |
|---|
| 280 | | - int gpio_wl_reg_on; |
|---|
| 286 | + int gpio_wl_reg_on = -1; |
|---|
| 281 | 287 | #ifdef CUSTOMER_OOB |
|---|
| 282 | | - int gpio_wl_host_wake; |
|---|
| 288 | + int gpio_wl_host_wake = -1; |
|---|
| 283 | 289 | int host_oob_irq = -1; |
|---|
| 284 | 290 | uint host_oob_irq_flags = 0; |
|---|
| 285 | 291 | #ifdef CUSTOMER_HW_ROCKCHIP |
|---|
| .. | .. |
|---|
| 293 | 299 | * WL_REG_ON and WL_HOST_WAKE. |
|---|
| 294 | 300 | */ |
|---|
| 295 | 301 | #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 |
|---|
| 296 | 311 | strcpy(wlan_node, DHD_DT_COMPAT_ENTRY); |
|---|
| 297 | | - printf("======== Get GPIO from DTS(%s) ========\n", wlan_node); |
|---|
| 298 | 312 | root_node = of_find_compatible_node(NULL, NULL, wlan_node); |
|---|
| 313 | +#endif |
|---|
| 314 | + printf("======== Get GPIO from DTS(%s) ========\n", wlan_node); |
|---|
| 299 | 315 | if (root_node) { |
|---|
| 300 | 316 | gpio_wl_reg_on = of_get_named_gpio(root_node, GPIO_WL_REG_ON_PROPNAME, 0); |
|---|
| 301 | 317 | #ifdef CUSTOMER_OOB |
|---|