platform_ARM_WMT_sdio.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2013 Realtek Corporation. All rights reserved.
  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. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #include <drv_types.h>
  21. #include <mach/wmt_iomux.h>
  22. #include <linux/gpio.h>
  23. extern void wmt_detect_sdio2(void);
  24. extern void force_remove_sdio2(void);
  25. int platform_wifi_power_on(void)
  26. {
  27. int err = 0;
  28. err = gpio_request(WMT_PIN_GP62_SUSGPIO1, "wifi_chip_en");
  29. if (err < 0) {
  30. printk("request gpio for rtl8188eu failed!\n");
  31. return err;
  32. }
  33. gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 0);/* pull sus_gpio1 to 0 to open vcc_wifi. */
  34. printk("power on rtl8189.\n");
  35. msleep(500);
  36. wmt_detect_sdio2();
  37. printk("[rtl8189es] %s: new card, power on.\n", __FUNCTION__);
  38. return err;
  39. }
  40. void platform_wifi_power_off(void)
  41. {
  42. force_remove_sdio2();
  43. gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 1);/* pull sus_gpio1 to 1 to close vcc_wifi. */
  44. printk("power off rtl8189.\n");
  45. gpio_free(WMT_PIN_GP62_SUSGPIO1);
  46. printk("[rtl8189es] %s: remove card, power off.\n", __FUNCTION__);
  47. }