.. | .. |
---|
1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 1 | /* |
---|
3 | 2 | * Linux platform device for DHD WLAN adapter |
---|
4 | 3 | * |
---|
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 | + * |
---|
7 | 8 | * Unless you and Broadcom execute a separate written software license |
---|
8 | 9 | * agreement governing use of this software, this software is licensed to you |
---|
9 | 10 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
---|
10 | 11 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
---|
11 | 12 | * following added to such license: |
---|
12 | | - * |
---|
| 13 | + * |
---|
13 | 14 | * As a special exception, the copyright holders of this software give you |
---|
14 | 15 | * permission to link this software with independent modules, and to copy and |
---|
15 | 16 | * distribute the resulting executable under terms of your choice, provided that |
---|
.. | .. |
---|
17 | 18 | * the license of that module. An independent module is a module which is not |
---|
18 | 19 | * derived from this software. The special exception does not apply to any |
---|
19 | 20 | * modifications of the software. |
---|
20 | | - * |
---|
| 21 | + * |
---|
21 | 22 | * Notwithstanding the above, under no circumstances may you combine this |
---|
22 | 23 | * software in any way with any other Broadcom software provided under a license |
---|
23 | 24 | * other than the GPL, without Broadcom's express prior written consent. |
---|
.. | .. |
---|
25 | 26 | * |
---|
26 | 27 | * <<Broadcom-WL-IPTag/Open:>> |
---|
27 | 28 | * |
---|
28 | | - * $Id: dhd_linux_platdev.c 401742 2013-05-13 15:03:21Z $ |
---|
| 29 | + * $Id: dhd_linux_platdev.c 697969 2017-05-05 16:36:11Z $ |
---|
29 | 30 | */ |
---|
30 | 31 | #include <typedefs.h> |
---|
31 | 32 | #include <linux/kernel.h> |
---|
.. | .. |
---|
39 | 40 | #include <dhd.h> |
---|
40 | 41 | #include <dhd_bus.h> |
---|
41 | 42 | #include <dhd_linux.h> |
---|
| 43 | +#if defined(OEM_ANDROID) |
---|
42 | 44 | #include <wl_android.h> |
---|
| 45 | +#endif // endif |
---|
43 | 46 | #if defined(CONFIG_WIFI_CONTROL_FUNC) |
---|
44 | 47 | #include <linux/wlan_plat.h> |
---|
45 | | -#endif |
---|
46 | | -#ifdef BCMDBUS |
---|
47 | | -#include <dbus.h> |
---|
48 | | -#endif |
---|
| 48 | +#endif // endif |
---|
49 | 49 | #ifdef CONFIG_DTS |
---|
50 | 50 | #include<linux/regulator/consumer.h> |
---|
51 | 51 | #include<linux/of_gpio.h> |
---|
52 | 52 | #endif /* CONFIG_DTS */ |
---|
53 | | - |
---|
54 | | - |
---|
55 | 53 | #define WIFI_PLAT_NAME "bcmdhd_wlan" |
---|
56 | 54 | #define WIFI_PLAT_NAME2 "bcm4329_wlan" |
---|
57 | 55 | #define WIFI_PLAT_EXT "bcmdhd_wifi_platform" |
---|
58 | 56 | |
---|
| 57 | +#ifdef USE_CUSTOM_MSM_PCIE |
---|
| 58 | +#include <linux/msm_pcie.h> |
---|
| 59 | +#endif /* USE_CUSTOM_MSM_PCIE */ |
---|
| 60 | + |
---|
| 61 | +#ifdef DHD_WIFI_SHUTDOWN |
---|
| 62 | +extern void wifi_plat_dev_drv_shutdown(struct platform_device *pdev); |
---|
| 63 | +#endif // endif |
---|
| 64 | + |
---|
59 | 65 | #ifdef CONFIG_DTS |
---|
60 | 66 | struct regulator *wifi_regulator = NULL; |
---|
61 | 67 | #endif /* CONFIG_DTS */ |
---|
| 68 | + |
---|
| 69 | + |
---|
| 70 | +#ifdef DHD_CUSTOM_PLAT_DATA |
---|
| 71 | +extern int dhd_wlan_init_plat_data(void); |
---|
| 72 | +extern int dhd_wlan_deinit_plat_data(void); |
---|
| 73 | +#endif /* DHD_CUSTOM_PLAT_DATA */ |
---|
62 | 74 | |
---|
63 | 75 | bool cfg_multichip = FALSE; |
---|
64 | 76 | bcmdhd_wifi_platdata_t *dhd_wifi_platdata = NULL; |
---|
.. | .. |
---|
67 | 79 | #if !defined(CONFIG_DTS) |
---|
68 | 80 | #if defined(DHD_OF_SUPPORT) |
---|
69 | 81 | static bool dts_enabled = TRUE; |
---|
70 | | -extern int dhd_wlan_init_plat_data(void); |
---|
71 | 82 | extern struct resource dhd_wlan_resources; |
---|
72 | 83 | extern struct wifi_platform_data dhd_wlan_control; |
---|
73 | 84 | #else |
---|
74 | 85 | static bool dts_enabled = FALSE; |
---|
| 86 | +#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) |
---|
| 87 | +#pragma GCC diagnostic push |
---|
| 88 | +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" |
---|
| 89 | +#endif // endif |
---|
75 | 90 | struct resource dhd_wlan_resources = {0}; |
---|
76 | 91 | struct wifi_platform_data dhd_wlan_control = {0}; |
---|
| 92 | +#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) |
---|
| 93 | +#pragma GCC diagnostic pop |
---|
| 94 | +#endif // endif |
---|
77 | 95 | #endif /* CONFIG_OF && !defined(CONFIG_ARCH_MSM) */ |
---|
78 | 96 | #endif /* !defind(CONFIG_DTS) */ |
---|
79 | 97 | |
---|
80 | 98 | static int dhd_wifi_platform_load(void); |
---|
81 | 99 | |
---|
82 | | -extern void* wl_cfg80211_get_dhdp(void); |
---|
| 100 | +extern void* wl_cfg80211_get_dhdp(struct net_device *dev); |
---|
| 101 | + |
---|
| 102 | +#if defined(BOARD_HIKEY) || defined(USE_CUSTOM_MSM_PCIE) |
---|
| 103 | +extern int dhd_wlan_init(void); |
---|
| 104 | +extern int dhd_wlan_deinit(void); |
---|
| 105 | +extern void post_power_operation(int on); |
---|
| 106 | +#endif /* defined(BOARD_HIKEY) || defined(USE_CUSTOM_MSM_PCIE) */ |
---|
83 | 107 | |
---|
84 | 108 | #ifdef ENABLE_4335BT_WAR |
---|
85 | 109 | extern int bcm_bt_lock(int cookie); |
---|
.. | .. |
---|
166 | 190 | |
---|
167 | 191 | if (!adapter || !adapter->wifi_plat_data) |
---|
168 | 192 | return -EINVAL; |
---|
| 193 | + |
---|
169 | 194 | plat_data = adapter->wifi_plat_data; |
---|
170 | 195 | |
---|
171 | | - DHD_ERROR(("%s = %d\n", __FUNCTION__, on)); |
---|
| 196 | + DHD_ERROR(("%s = %d, delay: %lu msec\n", __FUNCTION__, on, msec)); |
---|
172 | 197 | if (plat_data->set_power) { |
---|
173 | 198 | #ifdef ENABLE_4335BT_WAR |
---|
174 | 199 | if (on) { |
---|
.. | .. |
---|
189 | 214 | if (msec && !err) |
---|
190 | 215 | OSL_SLEEP(msec); |
---|
191 | 216 | |
---|
192 | | - if (on && !err) |
---|
| 217 | + if (on && !err) { |
---|
193 | 218 | is_power_on = TRUE; |
---|
194 | | - else |
---|
| 219 | +#ifdef USE_CUSTOM_POST_PWR_OPER |
---|
| 220 | + post_power_operation(on); |
---|
| 221 | +#endif /* USE_CUSTOM_MSM_PCIE */ |
---|
| 222 | + } else { |
---|
195 | 223 | is_power_on = FALSE; |
---|
| 224 | + } |
---|
196 | 225 | |
---|
197 | 226 | #endif /* CONFIG_DTS */ |
---|
198 | 227 | |
---|
199 | 228 | return err; |
---|
200 | 229 | } |
---|
201 | 230 | |
---|
202 | | -#if defined(CUSTOMER_IMX) |
---|
| 231 | +#if defined(PLATFORM_IMX) |
---|
203 | 232 | extern void wifi_card_detect(bool); |
---|
204 | 233 | int wifi_platform_bus_enumerate(wifi_adapter_info_t *adapter, bool device_present) |
---|
205 | 234 | { |
---|
.. | .. |
---|
229 | 258 | int err = 0; |
---|
230 | 259 | struct wifi_platform_data *plat_data; |
---|
231 | 260 | |
---|
| 261 | +#ifdef CONFIG_DTS |
---|
| 262 | + if (wifi_regulator) |
---|
| 263 | + return err; |
---|
| 264 | +#endif /* CONFIG_DTS */ |
---|
| 265 | + |
---|
232 | 266 | if (!adapter || !adapter->wifi_plat_data) |
---|
233 | 267 | return -EINVAL; |
---|
234 | 268 | plat_data = adapter->wifi_plat_data; |
---|
.. | .. |
---|
240 | 274 | return err; |
---|
241 | 275 | |
---|
242 | 276 | } |
---|
243 | | -#endif /* CUSTOMER_IMX */ |
---|
| 277 | +#endif /* PLATFORM_IMX */ |
---|
244 | 278 | |
---|
245 | 279 | int wifi_platform_get_mac_addr(wifi_adapter_info_t *adapter, unsigned char *buf) |
---|
246 | 280 | { |
---|
.. | .. |
---|
255 | 289 | } |
---|
256 | 290 | return -EOPNOTSUPP; |
---|
257 | 291 | } |
---|
258 | | -#ifdef CUSTOM_COUNTRY_CODE |
---|
| 292 | +#ifdef CUSTOM_COUNTRY_CODE |
---|
259 | 293 | void *wifi_platform_get_country_code(wifi_adapter_info_t *adapter, char *ccode, u32 flags) |
---|
260 | 294 | #else |
---|
261 | 295 | void *wifi_platform_get_country_code(wifi_adapter_info_t *adapter, char *ccode) |
---|
.. | .. |
---|
274 | 308 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 58)) |
---|
275 | 309 | return plat_data->get_country_code(ccode, WLAN_PLAT_NODFS_FLAG); |
---|
276 | 310 | #else |
---|
277 | | -#ifdef CUSTOM_COUNTRY_CODE |
---|
| 311 | +#ifdef CUSTOM_COUNTRY_CODE |
---|
278 | 312 | return plat_data->get_country_code(ccode, flags); |
---|
279 | 313 | #else |
---|
280 | 314 | return plat_data->get_country_code(ccode); |
---|
.. | .. |
---|
308 | 342 | if (resource) { |
---|
309 | 343 | adapter->irq_num = resource->start; |
---|
310 | 344 | adapter->intr_flags = resource->flags & IRQF_TRIGGER_MASK; |
---|
| 345 | +#ifdef DHD_ISR_NO_SUSPEND |
---|
| 346 | + adapter->intr_flags |= IRQF_NO_SUSPEND; |
---|
| 347 | +#endif // endif |
---|
311 | 348 | } |
---|
312 | 349 | |
---|
313 | 350 | #ifdef CONFIG_DTS |
---|
.. | .. |
---|
317 | 354 | return -1; |
---|
318 | 355 | } |
---|
319 | 356 | |
---|
| 357 | +#if defined(OOB_INTR_ONLY) || defined(BCMPCIE_OOB_HOST_WAKE) |
---|
320 | 358 | /* This is to get the irq for the OOB */ |
---|
321 | 359 | gpio = of_get_gpio(pdev->dev.of_node, 0); |
---|
322 | 360 | |
---|
323 | 361 | if (gpio < 0) { |
---|
324 | | - DHD_ERROR(("%s gpio information is incorrect\n", __FUNCTION__)); |
---|
325 | | - return -1; |
---|
| 362 | + DHD_ERROR(("%s OOB GPIO information is incorrect Or Not available\n", |
---|
| 363 | + __FUNCTION__)); |
---|
| 364 | + goto end; |
---|
326 | 365 | } |
---|
327 | 366 | irq = gpio_to_irq(gpio); |
---|
328 | 367 | if (irq < 0) { |
---|
.. | .. |
---|
334 | 373 | /* need to change the flags according to our requirement */ |
---|
335 | 374 | adapter->intr_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | |
---|
336 | 375 | IORESOURCE_IRQ_SHAREABLE; |
---|
| 376 | +end: |
---|
| 377 | +#endif /* defined(OOB_INTR_ONLY) || defined(BCMPCIE_OOB_HOST_WAKE) */ |
---|
337 | 378 | #endif /* CONFIG_DTS */ |
---|
338 | 379 | |
---|
339 | 380 | wifi_plat_dev_probe_ret = dhd_wifi_platform_load(); |
---|
.. | .. |
---|
398 | 439 | .remove = wifi_plat_dev_drv_remove, |
---|
399 | 440 | .suspend = wifi_plat_dev_drv_suspend, |
---|
400 | 441 | .resume = wifi_plat_dev_drv_resume, |
---|
| 442 | +#ifdef DHD_WIFI_SHUTDOWN |
---|
| 443 | + .shutdown = wifi_plat_dev_drv_shutdown, |
---|
| 444 | +#endif // endif |
---|
401 | 445 | .driver = { |
---|
402 | 446 | .name = WIFI_PLAT_NAME, |
---|
403 | 447 | #ifdef CONFIG_DTS |
---|
.. | .. |
---|
411 | 455 | .remove = wifi_plat_dev_drv_remove, |
---|
412 | 456 | .suspend = wifi_plat_dev_drv_suspend, |
---|
413 | 457 | .resume = wifi_plat_dev_drv_resume, |
---|
| 458 | +#ifdef DHD_WIFI_SHUTDOWN |
---|
| 459 | + .shutdown = wifi_plat_dev_drv_shutdown, |
---|
| 460 | +#endif // endif |
---|
414 | 461 | .driver = { |
---|
415 | 462 | .name = WIFI_PLAT_NAME2, |
---|
416 | 463 | } |
---|
417 | 464 | }; |
---|
418 | | - |
---|
419 | | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)) |
---|
| 465 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)) |
---|
420 | 466 | static int wifi_platdev_match(struct device *dev, const void *data) |
---|
421 | 467 | #else |
---|
422 | 468 | static int wifi_platdev_match(struct device *dev, void *data) |
---|
423 | | -#endif |
---|
| 469 | +#endif /* LINUX_VERSION_CODE */ |
---|
424 | 470 | { |
---|
425 | | - char *name = (char*)data; |
---|
426 | | - struct platform_device *pdev = to_platform_device(dev); |
---|
| 471 | + const char *name = (const char*)data; |
---|
| 472 | +#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) |
---|
| 473 | +#pragma GCC diagnostic push |
---|
| 474 | +#pragma GCC diagnostic ignored "-Wcast-qual" |
---|
| 475 | +#endif // endif |
---|
| 476 | + const struct platform_device *pdev = to_platform_device(dev); |
---|
| 477 | +#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) |
---|
| 478 | +#pragma GCC diagnostic pop |
---|
| 479 | +#endif // endif |
---|
427 | 480 | |
---|
428 | 481 | if (strcmp(pdev->name, name) == 0) { |
---|
429 | 482 | DHD_ERROR(("found wifi platform device %s\n", name)); |
---|
.. | .. |
---|
441 | 494 | |
---|
442 | 495 | dev1 = bus_find_device(&platform_bus_type, NULL, WIFI_PLAT_NAME, wifi_platdev_match); |
---|
443 | 496 | dev2 = bus_find_device(&platform_bus_type, NULL, WIFI_PLAT_NAME2, wifi_platdev_match); |
---|
| 497 | + |
---|
| 498 | +#if defined(BOARD_HIKEY_MODULAR) || defined(USE_CUSTOM_MSM_PCIE) |
---|
| 499 | + dhd_wlan_init(); |
---|
| 500 | +#endif /* defined(BOARD_HIKEY_MODULAR) || defined(USE_CUSTOM_MSM_PCIE) */ |
---|
444 | 501 | |
---|
445 | 502 | #if !defined(CONFIG_DTS) |
---|
446 | 503 | if (!dts_enabled) { |
---|
.. | .. |
---|
486 | 543 | return err; |
---|
487 | 544 | } |
---|
488 | 545 | } |
---|
489 | | - |
---|
490 | 546 | #if !defined(CONFIG_DTS) |
---|
491 | 547 | if (dts_enabled) { |
---|
492 | 548 | struct resource *resource; |
---|
493 | | - |
---|
494 | | - wifi_plat_dev_probe_ret = dhd_wlan_init_plat_data(); |
---|
495 | | - if (wifi_plat_dev_probe_ret) |
---|
| 549 | +#ifdef DHD_CUSTOM_PLAT_DATA |
---|
| 550 | + wifi_plat_dev_probe_ret = dhd_wlan_init_plat_data(); |
---|
| 551 | + if (wifi_plat_dev_probe_ret) { |
---|
496 | 552 | return wifi_plat_dev_probe_ret; |
---|
497 | | - |
---|
| 553 | + } |
---|
| 554 | +#endif /* DHD_CUSTOM_PLAT_DATA */ |
---|
498 | 555 | adapter->wifi_plat_data = (void *)&dhd_wlan_control; |
---|
499 | 556 | resource = &dhd_wlan_resources; |
---|
500 | 557 | adapter->irq_num = resource->start; |
---|
501 | 558 | adapter->intr_flags = resource->flags & IRQF_TRIGGER_MASK; |
---|
| 559 | +#ifdef DHD_ISR_NO_SUSPEND |
---|
| 560 | + adapter->intr_flags |= IRQF_NO_SUSPEND; |
---|
| 561 | +#endif // endif |
---|
502 | 562 | wifi_plat_dev_probe_ret = dhd_wifi_platform_load(); |
---|
503 | 563 | } |
---|
504 | 564 | #endif /* !defined(CONFIG_DTS) */ |
---|
505 | | - |
---|
506 | 565 | |
---|
507 | 566 | #ifdef CONFIG_DTS |
---|
508 | 567 | wifi_plat_dev_probe_ret = platform_driver_register(&wifi_platform_dev_driver); |
---|
.. | .. |
---|
527 | 586 | return; |
---|
528 | 587 | |
---|
529 | 588 | DHD_ERROR(("unregister wifi platform drivers\n")); |
---|
| 589 | + |
---|
530 | 590 | if (dev1) |
---|
531 | 591 | platform_driver_unregister(&wifi_platform_dev_driver); |
---|
532 | 592 | if (dev2) |
---|
.. | .. |
---|
539 | 599 | wifi_platform_bus_enumerate(adapter, FALSE); |
---|
540 | 600 | } |
---|
541 | 601 | } |
---|
| 602 | +#ifdef BOARD_HIKEY_MODULAR |
---|
| 603 | + dhd_wlan_deinit(); |
---|
| 604 | +#endif /* BOARD_HIKEY_MODULAR */ |
---|
| 605 | +#ifdef DHD_CUSTOM_PLAT_DATA |
---|
| 606 | + dhd_wlan_deinit_plat_data(); |
---|
| 607 | +#endif /* DHD_CUSTOM_PLAT_DATA */ |
---|
| 608 | + |
---|
542 | 609 | #endif /* !defined(CONFIG_DTS) */ |
---|
543 | 610 | |
---|
544 | 611 | kfree(dhd_wifi_platdata->adapters); |
---|
.. | .. |
---|
699 | 766 | } |
---|
700 | 767 | #endif /* BCMPCIE */ |
---|
701 | 768 | |
---|
702 | | - |
---|
703 | 769 | void dhd_wifi_platform_unregister_drv(void) |
---|
704 | 770 | { |
---|
705 | 771 | if (cfg_multichip) |
---|
.. | .. |
---|
711 | 777 | extern int dhd_watchdog_prio; |
---|
712 | 778 | extern int dhd_dpc_prio; |
---|
713 | 779 | extern uint dhd_deferred_tx; |
---|
714 | | -#if defined(BCMLXSDMMC) |
---|
| 780 | +#if defined(OEM_ANDROID) && defined(BCMLXSDMMC) |
---|
715 | 781 | extern struct semaphore dhd_registration_sem; |
---|
716 | | -#endif |
---|
| 782 | +#endif /* defined(OEM_ANDROID) && defined(BCMLXSDMMC) */ |
---|
717 | 783 | |
---|
718 | 784 | #ifdef BCMSDIO |
---|
719 | 785 | static int dhd_wifi_platform_load_sdio(void) |
---|
.. | .. |
---|
724 | 790 | |
---|
725 | 791 | BCM_REFERENCE(i); |
---|
726 | 792 | BCM_REFERENCE(adapter); |
---|
| 793 | + |
---|
727 | 794 | /* Sanity check on the module parameters |
---|
728 | 795 | * - Both watchdog and DPC as tasklets are ok |
---|
729 | 796 | * - If both watchdog and DPC are threads, TX must be deferred |
---|
.. | .. |
---|
732 | 799 | !(dhd_watchdog_prio >= 0 && dhd_dpc_prio >= 0 && dhd_deferred_tx)) |
---|
733 | 800 | return -EINVAL; |
---|
734 | 801 | |
---|
735 | | -#if defined(BCMLXSDMMC) |
---|
| 802 | +#if defined(OEM_ANDROID) && defined(BCMLXSDMMC) |
---|
736 | 803 | sema_init(&dhd_registration_sem, 0); |
---|
737 | | -#endif |
---|
| 804 | +#endif // endif |
---|
738 | 805 | |
---|
739 | 806 | if (dhd_wifi_platdata == NULL) { |
---|
740 | 807 | DHD_ERROR(("DHD wifi platform data is required for Android build\n")); |
---|
741 | | - DHD_ERROR(("DHD registeing bus directly\n")); |
---|
| 808 | + DHD_ERROR(("DHD registering bus directly\n")); |
---|
742 | 809 | /* x86 bring-up PC needs no power-up operations */ |
---|
743 | 810 | err = dhd_bus_register(); |
---|
744 | 811 | return err; |
---|
745 | 812 | } |
---|
746 | 813 | |
---|
747 | | -#if defined(BCMLXSDMMC) |
---|
| 814 | +#if defined(OEM_ANDROID) && defined(BCMLXSDMMC) |
---|
748 | 815 | /* power up all adapters */ |
---|
749 | 816 | for (i = 0; i < dhd_wifi_platdata->num_adapters; i++) { |
---|
750 | 817 | bool chip_up = FALSE; |
---|
.. | .. |
---|
769 | 836 | } |
---|
770 | 837 | err = wifi_platform_set_power(adapter, TRUE, WIFI_TURNON_DELAY); |
---|
771 | 838 | if (err) { |
---|
| 839 | + DHD_ERROR(("%s: wifi pwr on error ! \n", __FUNCTION__)); |
---|
| 840 | + dhd_bus_unreg_sdio_notify(); |
---|
772 | 841 | /* WL_REG_ON state unknown, Power off forcely */ |
---|
773 | 842 | wifi_platform_set_power(adapter, FALSE, WIFI_TURNOFF_DELAY); |
---|
774 | 843 | continue; |
---|
775 | 844 | } else { |
---|
776 | 845 | wifi_platform_bus_enumerate(adapter, TRUE); |
---|
777 | | - err = 0; |
---|
778 | 846 | } |
---|
779 | 847 | |
---|
780 | 848 | if (down_timeout(&dhd_chipup_sem, msecs_to_jiffies(POWERUP_WAIT_MS)) == 0) { |
---|
.. | .. |
---|
824 | 892 | wifi_platform_set_power(adapter, FALSE, WIFI_TURNOFF_DELAY); |
---|
825 | 893 | wifi_platform_bus_enumerate(adapter, FALSE); |
---|
826 | 894 | } |
---|
827 | | -#endif |
---|
| 895 | +#endif /* defined(OEM_ANDROID) && defined(BCMLXSDMMC) */ |
---|
828 | 896 | |
---|
829 | 897 | return err; |
---|
830 | 898 | } |
---|
.. | .. |
---|
835 | 903 | } |
---|
836 | 904 | #endif /* BCMSDIO */ |
---|
837 | 905 | |
---|
838 | | -#ifdef BCMDBUS |
---|
839 | | -/* User-specified vid/pid */ |
---|
840 | | -int dhd_vid = 0xa5c; |
---|
841 | | -int dhd_pid = 0x48f; |
---|
842 | | -module_param(dhd_vid, int, 0); |
---|
843 | | -module_param(dhd_pid, int, 0); |
---|
844 | | -void *dhd_dbus_probe_cb(void *arg, const char *desc, uint32 bustype, uint32 hdrlen); |
---|
845 | | -void dhd_dbus_disconnect_cb(void *arg); |
---|
846 | | - |
---|
847 | | -static int dhd_wifi_platform_load_usb(void) |
---|
848 | | -{ |
---|
849 | | - int err = 0; |
---|
850 | | - |
---|
851 | | - if (dhd_vid < 0 || dhd_vid > 0xffff) { |
---|
852 | | - DHD_ERROR(("%s: invalid dhd_vid 0x%x\n", __FUNCTION__, dhd_vid)); |
---|
853 | | - return -EINVAL; |
---|
854 | | - } |
---|
855 | | - if (dhd_pid < 0 || dhd_pid > 0xffff) { |
---|
856 | | - DHD_ERROR(("%s: invalid dhd_pid 0x%x\n", __FUNCTION__, dhd_pid)); |
---|
857 | | - return -EINVAL; |
---|
858 | | - } |
---|
859 | | - |
---|
860 | | - err = dbus_register(dhd_vid, dhd_pid, dhd_dbus_probe_cb, dhd_dbus_disconnect_cb, |
---|
861 | | - NULL, NULL, NULL); |
---|
862 | | - |
---|
863 | | - /* Device not detected */ |
---|
864 | | - if (err == DBUS_ERR_NODEVICE) |
---|
865 | | - err = DBUS_OK; |
---|
866 | | - |
---|
867 | | - return err; |
---|
868 | | -} |
---|
869 | | -#else /* BCMDBUS */ |
---|
870 | 906 | static int dhd_wifi_platform_load_usb(void) |
---|
871 | 907 | { |
---|
872 | 908 | return 0; |
---|
873 | 909 | } |
---|
874 | | -#endif /* BCMDBUS */ |
---|
875 | 910 | |
---|
876 | 911 | static int dhd_wifi_platform_load() |
---|
877 | 912 | { |
---|
878 | 913 | int err = 0; |
---|
879 | 914 | |
---|
| 915 | +#if defined(OEM_ANDROID) |
---|
880 | 916 | wl_android_init(); |
---|
| 917 | +#endif /* OEM_ANDROID */ |
---|
881 | 918 | |
---|
882 | 919 | if ((err = dhd_wifi_platform_load_usb())) |
---|
883 | 920 | goto end; |
---|
.. | .. |
---|
887 | 924 | err = dhd_wifi_platform_load_pcie(); |
---|
888 | 925 | |
---|
889 | 926 | end: |
---|
| 927 | +#if defined(OEM_ANDROID) |
---|
890 | 928 | if (err) |
---|
891 | 929 | wl_android_exit(); |
---|
892 | 930 | else |
---|
893 | 931 | wl_android_post_init(); |
---|
| 932 | +#endif /* OEM_ANDROID */ |
---|
894 | 933 | |
---|
895 | 934 | return err; |
---|
896 | 935 | } |
---|