1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
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
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: wlan_hdd_afc.h
19  *
20  * This file has the AFC osif interface with linux kernel.
21  */
22 
23 #ifndef __WLAN_HDD_AFC_H__
24 #define __WLAN_HDD_AFC_H__
25 #include <wlan_cfg80211.h>
26 #include <qca_vendor.h>
27 #include <wlan_objmgr_cmn.h>
28 #include <wlan_cfg80211_afc.h>
29 
30 #ifdef CONFIG_AFC_SUPPORT
31 
32 #define FEATURE_AFC_VENDOR_COMMANDS \
33 { \
34 	.info.vendor_id = QCA_NL80211_VENDOR_ID, \
35 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_AFC_RESPONSE, \
36 	.doit = wlan_hdd_vendor_afc_response, \
37 	vendor_command_policy(wlan_cfg80211_afc_response_policy, \
38 			      QCA_WLAN_VENDOR_ATTR_AFC_RESP_MAX) \
39 },
40 
41 #define FEATURE_AFC_VENDOR_EVENTS \
42 [QCA_NL80211_VENDOR_SUBCMD_AFC_EVENT_INDEX] = {		   \
43 	.vendor_id = QCA_NL80211_VENDOR_ID,		   \
44 	.subcmd = QCA_NL80211_VENDOR_SUBCMD_AFC_EVENT,	   \
45 },
46 
47 /**
48  * wlan_hdd_vendor_afc_response() - OSIF callback function of NL vendor AFC
49  * response command.
50  * @wiphy: Pointer to WIPHY object
51  * @wdev: Pointer to wireless device
52  * @data: Pointer to NL vendor command of AFC response
53  * @data_len: Length of NL vendor command of AFC response
54  *
55  * Return: 0 if success, otherwise error code
56  */
57 int wlan_hdd_vendor_afc_response(struct wiphy *wiphy,
58 				 struct wireless_dev *wdev,
59 				 const void *data,
60 				 int data_len);
61 
62 /**
63  * wlan_hdd_register_afc_pld_cb() - API to register AFC PLD function to pass
64  * AFC response data to target.
65  * @psoc: Pointer to PSOC object
66  *
67  * Return: None
68  */
69 void wlan_hdd_register_afc_pld_cb(struct wlan_objmgr_psoc *psoc);
70 #else
71 #define FEATURE_AFC_VENDOR_COMMANDS
72 #define FEATURE_AFC_VENDOR_EVENTS
73 
wlan_hdd_register_afc_pld_cb(struct wlan_objmgr_psoc * psoc)74 static inline void wlan_hdd_register_afc_pld_cb(struct wlan_objmgr_psoc *psoc)
75 {
76 }
77 #endif
78 #endif
79