pmc.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  17. #include "wcn36xx.h"
  18. int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
  19. struct ieee80211_vif *vif)
  20. {
  21. int ret = 0;
  22. struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
  23. /* TODO: Make sure the TX chain clean */
  24. ret = wcn36xx_smd_enter_bmps(wcn, vif);
  25. if (!ret) {
  26. wcn36xx_dbg(WCN36XX_DBG_PMC, "Entered BMPS\n");
  27. vif_priv->pw_state = WCN36XX_BMPS;
  28. } else {
  29. /*
  30. * One of the reasons why HW will not enter BMPS is because
  31. * driver is trying to enter bmps before first beacon was
  32. * received just after auth complete
  33. */
  34. wcn36xx_err("Can not enter BMPS!\n");
  35. }
  36. return ret;
  37. }
  38. int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn,
  39. struct ieee80211_vif *vif)
  40. {
  41. struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
  42. if (WCN36XX_BMPS != vif_priv->pw_state) {
  43. wcn36xx_err("Not in BMPS mode, no need to exit from BMPS mode!\n");
  44. return -EINVAL;
  45. }
  46. wcn36xx_smd_exit_bmps(wcn, vif);
  47. vif_priv->pw_state = WCN36XX_FULL_POWER;
  48. return 0;
  49. }
  50. int wcn36xx_enable_keep_alive_null_packet(struct wcn36xx *wcn,
  51. struct ieee80211_vif *vif)
  52. {
  53. wcn36xx_dbg(WCN36XX_DBG_PMC, "%s\n", __func__);
  54. return wcn36xx_smd_keep_alive_req(wcn, vif,
  55. WCN36XX_HAL_KEEP_ALIVE_NULL_PKT);
  56. }