mirror of
https://github.com/torvalds/linux.git
synced 2026-04-22 08:44:02 -04:00
The firmware interface also defines events generated by firmware on the device. As the get/set primitives the events are likely to diverge between the vendors so this commit adds support for per-vendor handling. The number of events may differ so we let the vendor-specific code allocate the struct brcmf_fweh_info which contains array of event handlers. The existing event enumeration will be used by the higher layers and thus are common definitions. The vendor-specific code can provide a mapping table for converting the common definition to the vendor-specific firmware event definition and vice-versa. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://msgid.link/20240106103835.269149-4-arend.vanspriel@broadcom.com
60 lines
1.4 KiB
C
60 lines
1.4 KiB
C
/* SPDX-License-Identifier: ISC */
|
|
/*
|
|
* Copyright (c) 2022 Broadcom Corporation
|
|
*/
|
|
#ifndef FWVID_H_
|
|
#define FWVID_H_
|
|
|
|
#include "firmware.h"
|
|
#include "cfg80211.h"
|
|
|
|
struct brcmf_pub;
|
|
struct brcmf_if;
|
|
|
|
struct brcmf_fwvid_ops {
|
|
void (*feat_attach)(struct brcmf_if *ifp);
|
|
int (*set_sae_password)(struct brcmf_if *ifp, struct cfg80211_crypto_settings *crypto);
|
|
int (*alloc_fweh_info)(struct brcmf_pub *drvr);
|
|
};
|
|
|
|
/* exported functions */
|
|
int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *mod,
|
|
const struct brcmf_fwvid_ops *ops);
|
|
int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod);
|
|
|
|
/* core driver functions */
|
|
int brcmf_fwvid_attach(struct brcmf_pub *drvr);
|
|
void brcmf_fwvid_detach(struct brcmf_pub *drvr);
|
|
const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr);
|
|
|
|
static inline void brcmf_fwvid_feat_attach(struct brcmf_if *ifp)
|
|
{
|
|
const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;
|
|
|
|
if (!vops->feat_attach)
|
|
return;
|
|
|
|
vops->feat_attach(ifp);
|
|
}
|
|
|
|
static inline int brcmf_fwvid_set_sae_password(struct brcmf_if *ifp,
|
|
struct cfg80211_crypto_settings *crypto)
|
|
{
|
|
const struct brcmf_fwvid_ops *vops = ifp->drvr->vops;
|
|
|
|
if (!vops || !vops->set_sae_password)
|
|
return -EOPNOTSUPP;
|
|
|
|
return vops->set_sae_password(ifp, crypto);
|
|
}
|
|
|
|
static inline int brcmf_fwvid_alloc_fweh_info(struct brcmf_pub *drvr)
|
|
{
|
|
if (!drvr->vops)
|
|
return -EIO;
|
|
|
|
return drvr->vops->alloc_fweh_info(drvr);
|
|
}
|
|
|
|
#endif /* FWVID_H_ */
|