1 /*
2  * Copyright (c) 2016 Broadcom
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 ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 #ifndef _BRCMF_PNO_H
17 #define _BRCMF_PNO_H
18 
19 #define BRCMF_PNO_SCAN_COMPLETE			1
20 #define BRCMF_PNO_MAX_PFN_COUNT			16
21 #define BRCMF_PNO_SCHED_SCAN_MIN_PERIOD	10
22 #define BRCMF_PNO_SCHED_SCAN_MAX_PERIOD	508
23 
24 /* forward declaration */
25 struct brcmf_pno_info;
26 
27 /**
28  * brcmf_pno_start_sched_scan - initiate scheduled scan on device.
29  *
30  * @ifp: interface object used.
31  * @req: configuration parameters for scheduled scan.
32  */
33 int brcmf_pno_start_sched_scan(struct brcmf_if *ifp,
34 			       struct cfg80211_sched_scan_request *req);
35 
36 /**
37  * brcmf_pno_stop_sched_scan - terminate scheduled scan on device.
38  *
39  * @ifp: interface object used.
40  * @reqid: unique identifier of scan to be stopped.
41  */
42 int brcmf_pno_stop_sched_scan(struct brcmf_if *ifp, u64 reqid);
43 
44 /**
45  * brcmf_pno_wiphy_params - fill scheduled scan parameters in wiphy instance.
46  *
47  * @wiphy: wiphy instance to be used.
48  * @gscan: indicates whether the device has support for g-scan feature.
49  */
50 void brcmf_pno_wiphy_params(struct wiphy *wiphy, bool gscan);
51 
52 /**
53  * brcmf_pno_attach - allocate and attach module information.
54  *
55  * @cfg: cfg80211 context used.
56  */
57 int brcmf_pno_attach(struct brcmf_cfg80211_info *cfg);
58 
59 /**
60  * brcmf_pno_detach - detach and free module information.
61  *
62  * @cfg: cfg80211 context used.
63  */
64 void brcmf_pno_detach(struct brcmf_cfg80211_info *cfg);
65 
66 /**
67  * brcmf_pno_find_reqid_by_bucket - find request id for given bucket index.
68  *
69  * @pi: pno instance used.
70  * @bucket: index of firmware bucket.
71  */
72 u64 brcmf_pno_find_reqid_by_bucket(struct brcmf_pno_info *pi, u32 bucket);
73 
74 /**
75  * brcmf_pno_get_bucket_map - determine bucket map for given netinfo.
76  *
77  * @pi: pno instance used.
78  * @netinfo: netinfo to compare with bucket configuration.
79  */
80 u32 brcmf_pno_get_bucket_map(struct brcmf_pno_info *pi,
81 			     struct brcmf_pno_net_info_le *netinfo);
82 
83 #endif /* _BRCMF_PNO_H */
84