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 /** 20 * DOC: HIF internal unit-test related APIs for triggering WoW suspend/resume 21 * while the application processor is still up. 22 */ 23 24 #ifndef _HIF_UNIT_TEST_SUSPEND_I_H_ 25 #define _HIF_UNIT_TEST_SUSPEND_I_H_ 26 27 #include "qdf_status.h" 28 #include "hif_main.h" 29 #include "hif_unit_test_suspend.h" 30 31 #ifdef WLAN_SUSPEND_RESUME_TEST 32 33 struct hif_ut_suspend_context { 34 unsigned long state; 35 hif_ut_resume_callback resume_callback; 36 struct work_struct resume_work; 37 }; 38 39 /** 40 * hif_ut_suspend_init() - Initialize the unit-test suspend context 41 * @scn: the hif context to initialize 42 * 43 * Return: None 44 */ 45 void hif_ut_suspend_init(struct hif_softc *scn); 46 47 /** 48 * hif_is_ut_suspended() - Tests if the given hif context is unit-test suspended 49 * @scn: The HIF context to check 50 * 51 * Return: true, if unit-test suspended, otherwise false 52 */ 53 bool hif_is_ut_suspended(struct hif_softc *scn); 54 55 /** 56 * hif_ut_fw_resume() - Initiate a firmware triggered unit-test resume 57 * @scn: The HIF context to operate on 58 * 59 * This schedules the callback previously registered via a call to 60 * hif_ut_apps_suspend for execution. 61 * 62 * Return: QDF_STATUS 63 */ 64 QDF_STATUS hif_ut_fw_resume(struct hif_softc *scn); 65 66 /** 67 * hif_irq_trigger_ut_resume() - Test for given hif ctx unit-test resume needed 68 * @scn: The HIF context to check 69 * 70 * Return: true, if unit-test resume procedure is needed, otherwise false 71 */ 72 bool hif_irq_trigger_ut_resume(struct hif_softc *scn); 73 74 #else /* WLAN_SUSPEND_RESUME_TEST */ 75 76 struct hif_ut_suspend_context {}; 77 78 static inline void hif_ut_suspend_init(struct hif_softc *scn) {} 79 80 static inline bool hif_is_ut_suspended(struct hif_softc *scn) 81 { 82 return false; 83 } 84 85 static inline QDF_STATUS hif_ut_fw_resume(struct hif_softc *scn) 86 { 87 return QDF_STATUS_SUCCESS; 88 } 89 #endif /* WLAN_SUSPEND_RESUME_TEST */ 90 91 #endif /* _HIF_UNIT_TEST_SUSPEND_I_H_ */ 92