xref: /freebsd/sys/contrib/dev/athk/ath12k/wow.h (revision a96550206e4bde15bf615ff2127b80404a7ec41f)
1*a9655020SBjoern A. Zeeb /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2*a9655020SBjoern A. Zeeb /*
3*a9655020SBjoern A. Zeeb  * Copyright (c) 2020 The Linux Foundation. All rights reserved.
4*a9655020SBjoern A. Zeeb  * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
5*a9655020SBjoern A. Zeeb  */
6*a9655020SBjoern A. Zeeb 
7*a9655020SBjoern A. Zeeb #ifndef ATH12K_WOW_H
8*a9655020SBjoern A. Zeeb #define ATH12K_WOW_H
9*a9655020SBjoern A. Zeeb 
10*a9655020SBjoern A. Zeeb #define ATH12K_WOW_RETRY_NUM		10
11*a9655020SBjoern A. Zeeb #define ATH12K_WOW_RETRY_WAIT_MS	200
12*a9655020SBjoern A. Zeeb #define ATH12K_WOW_PATTERNS		22
13*a9655020SBjoern A. Zeeb 
14*a9655020SBjoern A. Zeeb struct ath12k_wow {
15*a9655020SBjoern A. Zeeb 	u32 max_num_patterns;
16*a9655020SBjoern A. Zeeb 	struct completion wakeup_completed;
17*a9655020SBjoern A. Zeeb 	struct wiphy_wowlan_support wowlan_support;
18*a9655020SBjoern A. Zeeb };
19*a9655020SBjoern A. Zeeb 
20*a9655020SBjoern A. Zeeb struct ath12k_pkt_pattern {
21*a9655020SBjoern A. Zeeb 	u8 pattern[WOW_MAX_PATTERN_SIZE];
22*a9655020SBjoern A. Zeeb 	u8 bytemask[WOW_MAX_PATTERN_SIZE];
23*a9655020SBjoern A. Zeeb 	int pattern_len;
24*a9655020SBjoern A. Zeeb 	int pkt_offset;
25*a9655020SBjoern A. Zeeb };
26*a9655020SBjoern A. Zeeb 
27*a9655020SBjoern A. Zeeb struct rfc1042_hdr {
28*a9655020SBjoern A. Zeeb 	u8 llc_dsap;
29*a9655020SBjoern A. Zeeb 	u8 llc_ssap;
30*a9655020SBjoern A. Zeeb 	u8 llc_ctrl;
31*a9655020SBjoern A. Zeeb 	u8 snap_oui[3];
32*a9655020SBjoern A. Zeeb 	__be16 eth_type;
33*a9655020SBjoern A. Zeeb } __packed;
34*a9655020SBjoern A. Zeeb 
35*a9655020SBjoern A. Zeeb #ifdef CONFIG_PM
36*a9655020SBjoern A. Zeeb 
37*a9655020SBjoern A. Zeeb int ath12k_wow_init(struct ath12k *ar);
38*a9655020SBjoern A. Zeeb int ath12k_wow_op_suspend(struct ieee80211_hw *hw,
39*a9655020SBjoern A. Zeeb 			  struct cfg80211_wowlan *wowlan);
40*a9655020SBjoern A. Zeeb int ath12k_wow_op_resume(struct ieee80211_hw *hw);
41*a9655020SBjoern A. Zeeb void ath12k_wow_op_set_wakeup(struct ieee80211_hw *hw, bool enabled);
42*a9655020SBjoern A. Zeeb int ath12k_wow_enable(struct ath12k *ar);
43*a9655020SBjoern A. Zeeb int ath12k_wow_wakeup(struct ath12k *ar);
44*a9655020SBjoern A. Zeeb 
45*a9655020SBjoern A. Zeeb #else
46*a9655020SBjoern A. Zeeb 
ath12k_wow_init(struct ath12k * ar)47*a9655020SBjoern A. Zeeb static inline int ath12k_wow_init(struct ath12k *ar)
48*a9655020SBjoern A. Zeeb {
49*a9655020SBjoern A. Zeeb 	return 0;
50*a9655020SBjoern A. Zeeb }
51*a9655020SBjoern A. Zeeb 
ath12k_wow_enable(struct ath12k * ar)52*a9655020SBjoern A. Zeeb static inline int ath12k_wow_enable(struct ath12k *ar)
53*a9655020SBjoern A. Zeeb {
54*a9655020SBjoern A. Zeeb 	return 0;
55*a9655020SBjoern A. Zeeb }
56*a9655020SBjoern A. Zeeb 
ath12k_wow_wakeup(struct ath12k * ar)57*a9655020SBjoern A. Zeeb static inline int ath12k_wow_wakeup(struct ath12k *ar)
58*a9655020SBjoern A. Zeeb {
59*a9655020SBjoern A. Zeeb 	return 0;
60*a9655020SBjoern A. Zeeb }
61*a9655020SBjoern A. Zeeb #endif /* CONFIG_PM */
62*a9655020SBjoern A. Zeeb #endif /* ATH12K_WOW_H */
63