xref: /openbmc/linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h (revision 46eeaa11bdd1bc9e077bdf741d32ca7235d263c6)
1d6a5c562SArend van Spriel /* SPDX-License-Identifier: ISC */
2d6a5c562SArend van Spriel /*
3d6a5c562SArend van Spriel  * Copyright (c) 2022 Broadcom Corporation
4d6a5c562SArend van Spriel  */
5d6a5c562SArend van Spriel #ifndef FWVID_H_
6d6a5c562SArend van Spriel #define FWVID_H_
7d6a5c562SArend van Spriel 
8d6a5c562SArend van Spriel #include "firmware.h"
98d59a64cSHector Martin #include "cfg80211.h"
10d6a5c562SArend van Spriel 
11d6a5c562SArend van Spriel struct brcmf_pub;
1247b56329SArend van Spriel struct brcmf_if;
13d6a5c562SArend van Spriel 
14d6a5c562SArend van Spriel struct brcmf_fwvid_ops {
1547b56329SArend van Spriel 	void (*feat_attach)(struct brcmf_if *ifp);
168d59a64cSHector Martin 	int (*set_sae_password)(struct brcmf_if *ifp, struct cfg80211_crypto_settings *crypto);
17d6a5c562SArend van Spriel };
18d6a5c562SArend van Spriel 
19d6a5c562SArend van Spriel /* exported functions */
20d6a5c562SArend van Spriel int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *mod,
21d6a5c562SArend van Spriel 				const struct brcmf_fwvid_ops *ops);
22d6a5c562SArend van Spriel int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod);
23d6a5c562SArend van Spriel 
24d6a5c562SArend van Spriel /* core driver functions */
25*0436d691SHector Martin int brcmf_fwvid_attach(struct brcmf_pub *drvr);
26*0436d691SHector Martin void brcmf_fwvid_detach(struct brcmf_pub *drvr);
277205f9f2SArend van Spriel const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr);
28d6a5c562SArend van Spriel 
brcmf_fwvid_feat_attach(struct brcmf_if * ifp)2947b56329SArend van Spriel static inline void brcmf_fwvid_feat_attach(struct brcmf_if *ifp)
3047b56329SArend van Spriel {
3147b56329SArend van Spriel 	const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;
3247b56329SArend van Spriel 
3347b56329SArend van Spriel 	if (!vops->feat_attach)
3447b56329SArend van Spriel 		return;
3547b56329SArend van Spriel 
3647b56329SArend van Spriel 	vops->feat_attach(ifp);
3747b56329SArend van Spriel }
3847b56329SArend van Spriel 
brcmf_fwvid_set_sae_password(struct brcmf_if * ifp,struct cfg80211_crypto_settings * crypto)398d59a64cSHector Martin static inline int brcmf_fwvid_set_sae_password(struct brcmf_if *ifp,
408d59a64cSHector Martin 					       struct cfg80211_crypto_settings *crypto)
418d59a64cSHector Martin {
428d59a64cSHector Martin 	const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;
438d59a64cSHector Martin 
448d59a64cSHector Martin 	if (!vops || !vops->set_sae_password)
458d59a64cSHector Martin 		return -EOPNOTSUPP;
468d59a64cSHector Martin 
478d59a64cSHector Martin 	return vops->set_sae_password(ifp, crypto);
488d59a64cSHector Martin }
498d59a64cSHector Martin 
50d6a5c562SArend van Spriel #endif /* FWVID_H_ */
51