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 int (*alloc_fweh_info)(struct brcmf_pub *drvr); 18 }; 19 20 /* exported functions */ 21 int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *mod, 22 const struct brcmf_fwvid_ops *ops); 23 int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod); 24 25 /* core driver functions */ 26 int brcmf_fwvid_attach(struct brcmf_pub *drvr); 27 void brcmf_fwvid_detach(struct brcmf_pub *drvr); 28 const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr); 29 brcmf_fwvid_feat_attach(struct brcmf_if * ifp)30static inline void brcmf_fwvid_feat_attach(struct brcmf_if *ifp) 31 { 32 const struct brcmf_fwvid_ops *vops = ifp->drvr->vops; 33 34 if (!vops->feat_attach) 35 return; 36 37 vops->feat_attach(ifp); 38 } 39 brcmf_fwvid_set_sae_password(struct brcmf_if * ifp,struct cfg80211_crypto_settings * crypto)40static inline int brcmf_fwvid_set_sae_password(struct brcmf_if *ifp, 41 struct cfg80211_crypto_settings *crypto) 42 { 43 const struct brcmf_fwvid_ops *vops = ifp->drvr->vops; 44 45 if (!vops || !vops->set_sae_password) 46 return -EOPNOTSUPP; 47 48 return vops->set_sae_password(ifp, crypto); 49 } 50 brcmf_fwvid_alloc_fweh_info(struct brcmf_pub * drvr)51static inline int brcmf_fwvid_alloc_fweh_info(struct brcmf_pub *drvr) 52 { 53 if (!drvr->vops) 54 return -EIO; 55 56 return drvr->vops->alloc_fweh_info(drvr); 57 } 58 59 #endif /* FWVID_H_ */ 60