1 /*
2  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: qdf_ipa.c
22  *
23  * This source file contains linux specific definitions for QDF IPA APIs
24  */
25 
26 /* Include Files */
27 #include <qdf_ipa.h>
28 #include <qdf_module.h>
29 
__qdf_to_ipa_wlan_event(int qdf_ipa_event)30 static uint8_t __qdf_to_ipa_wlan_event(int qdf_ipa_event)
31 {
32 	uint8_t ipa_event;
33 
34 	switch (qdf_ipa_event) {
35 	case QDF_IPA_CLIENT_CONNECT:
36 		ipa_event = WLAN_CLIENT_CONNECT;
37 		break;
38 	case QDF_IPA_CLIENT_DISCONNECT:
39 		ipa_event = WLAN_CLIENT_DISCONNECT;
40 		break;
41 	case QDF_IPA_AP_CONNECT:
42 		ipa_event = WLAN_AP_CONNECT;
43 		break;
44 	case QDF_IPA_AP_DISCONNECT:
45 		ipa_event = WLAN_AP_DISCONNECT;
46 		break;
47 	case QDF_IPA_STA_CONNECT:
48 		ipa_event = WLAN_STA_CONNECT;
49 		break;
50 	case QDF_IPA_STA_DISCONNECT:
51 		ipa_event = WLAN_STA_DISCONNECT;
52 		break;
53 	case QDF_IPA_CLIENT_CONNECT_EX:
54 		ipa_event = WLAN_CLIENT_CONNECT_EX;
55 		break;
56 	case QDF_SWITCH_TO_SCC:
57 		ipa_event = WLAN_SWITCH_TO_SCC;
58 		break;
59 	case QDF_SWITCH_TO_MCC:
60 		ipa_event = WLAN_SWITCH_TO_MCC;
61 		break;
62 	case QDF_WDI_ENABLE:
63 		ipa_event = WLAN_WDI_ENABLE;
64 		break;
65 	case QDF_WDI_DISABLE:
66 		ipa_event = WLAN_WDI_DISABLE;
67 		break;
68 	case QDF_FWR_SSR_BEFORE_SHUTDOWN:
69 		ipa_event = WLAN_FWR_SSR_BEFORE_SHUTDOWN;
70 		break;
71 	case QDF_IPA_WLAN_EVENT_MAX:
72 	default:
73 		ipa_event = IPA_WLAN_EVENT_MAX;
74 		break;
75 	}
76 
77 	return ipa_event;
78 }
79 
__qdf_ipa_set_meta_msg_type(__qdf_ipa_msg_meta_t * meta,int type)80 void __qdf_ipa_set_meta_msg_type(__qdf_ipa_msg_meta_t *meta, int type)
81 {
82 	meta->msg_type = __qdf_to_ipa_wlan_event(type);
83 }
84 
85 qdf_export_symbol(__qdf_ipa_set_meta_msg_type);
86