hif_unit_test_suspend_i.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: HIF internal unit-test related APIs for triggering WoW suspend/resume
  20. * while the application processor is still up.
  21. */
  22. #ifndef _HIF_UNIT_TEST_SUSPEND_I_H_
  23. #define _HIF_UNIT_TEST_SUSPEND_I_H_
  24. #include "qdf_status.h"
  25. #include "hif_main.h"
  26. #include "hif_unit_test_suspend.h"
  27. #ifdef WLAN_SUSPEND_RESUME_TEST
  28. struct hif_ut_suspend_context {
  29. unsigned long state;
  30. hif_ut_resume_callback resume_callback;
  31. struct work_struct resume_work;
  32. };
  33. /**
  34. * hif_ut_suspend_init() - Initialize the unit-test suspend context
  35. * @scn: the hif context to initialize
  36. *
  37. * Return: None
  38. */
  39. void hif_ut_suspend_init(struct hif_softc *scn);
  40. /**
  41. * hif_is_ut_suspended() - Tests if the given hif context is unit-test suspended
  42. * @scn: The HIF context to check
  43. *
  44. * Return: true, if unit-test suspended, otherwise false
  45. */
  46. bool hif_is_ut_suspended(struct hif_softc *scn);
  47. /**
  48. * hif_ut_fw_resume() - Initiate a firmware triggered unit-test resume
  49. * @scn: The HIF context to operate on
  50. *
  51. * This schedules the callback previously registered via a call to
  52. * hif_ut_apps_suspend for execution.
  53. *
  54. * Return: QDF_STATUS
  55. */
  56. QDF_STATUS hif_ut_fw_resume(struct hif_softc *scn);
  57. /**
  58. * hif_irq_trigger_ut_resume() - Test for given hif ctx unit-test resume needed
  59. * @scn: The HIF context to check
  60. *
  61. * Return: true, if unit-test resume procedure is needed, otherwise false
  62. */
  63. bool hif_irq_trigger_ut_resume(struct hif_softc *scn);
  64. #else /* WLAN_SUSPEND_RESUME_TEST */
  65. struct hif_ut_suspend_context {};
  66. static inline void hif_ut_suspend_init(struct hif_softc *scn) {}
  67. static inline bool hif_is_ut_suspended(struct hif_softc *scn)
  68. {
  69. return false;
  70. }
  71. static inline QDF_STATUS hif_ut_fw_resume(struct hif_softc *scn)
  72. {
  73. return QDF_STATUS_SUCCESS;
  74. }
  75. #endif /* WLAN_SUSPEND_RESUME_TEST */
  76. #endif /* _HIF_UNIT_TEST_SUSPEND_I_H_ */