platform_ARM_WMT_sdio.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2013 - 2017 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 <drv_types.h>
  16. #include <mach/wmt_iomux.h>
  17. #include <linux/gpio.h>
  18. extern void wmt_detect_sdio2(void);
  19. extern void force_remove_sdio2(void);
  20. int platform_wifi_power_on(void)
  21. {
  22. int err = 0;
  23. err = gpio_request(WMT_PIN_GP62_SUSGPIO1, "wifi_chip_en");
  24. if (err < 0) {
  25. printk("request gpio for rtl8188eu failed!\n");
  26. return err;
  27. }
  28. gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 0);/* pull sus_gpio1 to 0 to open vcc_wifi. */
  29. printk("power on rtl8189.\n");
  30. msleep(500);
  31. wmt_detect_sdio2();
  32. printk("[rtl8189es] %s: new card, power on.\n", __FUNCTION__);
  33. return err;
  34. }
  35. void platform_wifi_power_off(void)
  36. {
  37. force_remove_sdio2();
  38. gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 1);/* pull sus_gpio1 to 1 to close vcc_wifi. */
  39. printk("power off rtl8189.\n");
  40. gpio_free(WMT_PIN_GP62_SUSGPIO1);
  41. printk("[rtl8189es] %s: remove card, power off.\n", __FUNCTION__);
  42. }