platform_aml_s905_sdio.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2016 - 2018 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. *****************************************************************************/
  15. #include <linux/printk.h> /* pr_info(() */
  16. #include <linux/delay.h> /* msleep() */
  17. #include "platform_aml_s905_sdio.h" /* sdio_reinit() and etc */
  18. /*
  19. * Return:
  20. * 0: power on successfully
  21. * others: power on failed
  22. */
  23. int platform_wifi_power_on(void)
  24. {
  25. int ret = 0;
  26. #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
  27. ret = wifi_setup_dt();
  28. if (ret) {
  29. pr_err("%s: setup dt failed!!(%d)\n", __func__, ret);
  30. return -1;
  31. }
  32. #endif /* kernel < 3.14.0 */
  33. #if 0 /* Seems redundancy? Already done before insert driver */
  34. pr_info("######%s:\n", __func__);
  35. extern_wifi_set_enable(0);
  36. msleep(500);
  37. extern_wifi_set_enable(1);
  38. msleep(500);
  39. sdio_reinit();
  40. #endif
  41. return ret;
  42. }
  43. void platform_wifi_power_off(void)
  44. {
  45. #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
  46. wifi_teardown_dt();
  47. #endif /* kernel < 3.14.0 */
  48. }