1 /* SPDX-License-Identifier: ISC */
2 /*
3  * Copyright (c) 2022 Broadcom Corporation
4  */
5 #ifndef FWVID_H_
6 #define FWVID_H_
7 
8 #include "firmware.h"
9 #include "cfg80211.h"
10 
11 struct brcmf_pub;
12 struct brcmf_if;
13 
14 struct brcmf_fwvid_ops {
15 	void (*feat_attach)(struct brcmf_if *ifp);
16 	int (*set_sae_password)(struct brcmf_if *ifp, struct cfg80211_crypto_settings *crypto);
17 };
18 
19 /* exported functions */
20 int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *mod,
21 				const struct brcmf_fwvid_ops *ops);
22 int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod);
23 
24 /* core driver functions */
25 int brcmf_fwvid_attach(struct brcmf_pub *drvr);
26 void brcmf_fwvid_detach(struct brcmf_pub *drvr);
27 const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr);
28 
29 static inline void brcmf_fwvid_feat_attach(struct brcmf_if *ifp)
30 {
31 	const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;
32 
33 	if (!vops->feat_attach)
34 		return;
35 
36 	vops->feat_attach(ifp);
37 }
38 
39 static inline int brcmf_fwvid_set_sae_password(struct brcmf_if *ifp,
40 					       struct cfg80211_crypto_settings *crypto)
41 {
42 	const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;
43 
44 	if (!vops || !vops->set_sae_password)
45 		return -EOPNOTSUPP;
46 
47 	return vops->set_sae_password(ifp, crypto);
48 }
49 
50 #endif /* FWVID_H_ */
51