• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Common function shared by Linux WEXT, cfg80211 and p2p drivers
3  *
4  * Copyright (C) 1999-2019, Broadcom.
5  *
6  *      Unless you and Broadcom execute a separate written software license
7  * agreement governing use of this software, this software is licensed to you
8  * under the terms of the GNU General Public License version 2 (the "GPL"),
9  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10  * following added to such license:
11  *
12  *      As a special exception, the copyright holders of this software give you
13  * permission to link this software with independent modules, and to copy and
14  * distribute the resulting executable under terms of your choice, provided that
15  * you also meet, for each linked independent module, the terms and conditions
16  * of the license of that module.  An independent module is a module which is
17  * not derived from this software.  The special exception does not apply to any
18  * modifications of the software.
19  *
20  *      Notwithstanding the above, under no circumstances may you combine this
21  * software in any way with any other Broadcom software provided under a license
22  * other than the GPL, without Broadcom's express prior written consent.
23  *
24  *
25  * <<Broadcom-WL-IPTag/Open:>>
26  *
27  * $Id: wldev_common.h 813004 2019-04-03 07:16:21Z $
28  */
29 #ifndef __WLDEV_COMMON_H__
30 #define __WLDEV_COMMON_H__
31 
32 #include <wlioctl.h>
33 
34 /* wl_dev_ioctl - get/set IOCTLs, will call net_device's do_ioctl (or
35  *  netdev_ops->ndo_do_ioctl in new kernels)
36  *  @dev: the net_device handle
37  */
38 s32 wldev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len, u32 set);
39 
40 s32 wldev_ioctl_get(struct net_device *dev, u32 cmd, void *arg, u32 len);
41 
42 s32 wldev_ioctl_set(struct net_device *dev, u32 cmd, const void *arg, u32 len);
43 
44 /** Retrieve named IOVARs, this function calls wl_dev_ioctl with
45  *  WLC_GET_VAR IOCTL code
46  */
47 s32 wldev_iovar_getbuf(struct net_device *dev, s8 *iovar_name,
48                        const void *param, s32 paramlen, void *buf, s32 buflen,
49                        struct mutex *buf_sync);
50 
51 /** Set named IOVARs, this function calls wl_dev_ioctl with
52  *  WLC_SET_VAR IOCTL code
53  */
54 s32 wldev_iovar_setbuf(struct net_device *dev, s8 *iovar_name,
55                        const void *param, s32 paramlen, void *buf, s32 buflen,
56                        struct mutex *buf_sync);
57 
58 s32 wldev_iovar_setint(struct net_device *dev, s8 *iovar, s32 val);
59 
60 s32 wldev_iovar_getint(struct net_device *dev, s8 *iovar, s32 *pval);
61 
62 /** The following function can be implemented if there is a need for bsscfg
63  *  indexed IOVARs
64  */
65 
66 s32 wldev_mkiovar_bsscfg(const s8 *iovar_name, const s8 *param, s32 paramlen,
67                          s8 *iovar_buf, s32 buflen, s32 bssidx);
68 
69 /** Retrieve named and bsscfg indexed IOVARs, this function calls wl_dev_ioctl
70  * with WLC_GET_VAR IOCTL code
71  */
72 s32 wldev_iovar_getbuf_bsscfg(struct net_device *dev, s8 *iovar_name,
73                               void *param, s32 paramlen, void *buf, s32 buflen,
74                               s32 bsscfg_idx, struct mutex *buf_sync);
75 
76 /** Set named and bsscfg indexed IOVARs, this function calls wl_dev_ioctl with
77  *  WLC_SET_VAR IOCTL code
78  */
79 s32 wldev_iovar_setbuf_bsscfg(struct net_device *dev, const s8 *iovar_name,
80                               const void *param, s32 paramlen, void *buf,
81                               s32 buflen, s32 bsscfg_idx,
82                               struct mutex *buf_sync);
83 
84 s32 wldev_iovar_getint_bsscfg(struct net_device *dev, s8 *iovar, s32 *pval,
85                               s32 bssidx);
86 
87 s32 wldev_iovar_setint_bsscfg(struct net_device *dev, s8 *iovar, s32 val,
88                               s32 bssidx);
89 
90 extern int dhd_net_set_fw_path(struct net_device *dev, char *fw);
91 extern int dhd_net_bus_suspend(struct net_device *dev);
92 extern int dhd_net_bus_resume(struct net_device *dev, uint8 stage);
93 extern int dhd_net_wifi_platform_set_power(struct net_device *dev, bool on,
94                                            unsigned long delay_msec);
95 extern void dhd_get_customized_country_code(struct net_device *dev,
96                                             char *country_iso_code,
97                                             wl_country_t *cspec);
98 extern void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec,
99                                 bool notify);
100 extern bool dhd_force_country_change(struct net_device *dev);
101 extern void dhd_bus_band_set(struct net_device *dev, uint band);
102 extern int wldev_set_country(struct net_device *dev, char *country_code,
103                              bool notify, bool user_enforced, int revinfo);
104 extern int net_os_wake_lock(struct net_device *dev);
105 extern int net_os_wake_unlock(struct net_device *dev);
106 extern int net_os_wake_lock_timeout(struct net_device *dev);
107 extern int net_os_wake_lock_timeout_enable(struct net_device *dev, int val);
108 extern int net_os_set_dtim_skip(struct net_device *dev, int val);
109 extern int net_os_set_suspend_disable(struct net_device *dev, int val);
110 extern int net_os_set_suspend(struct net_device *dev, int val, int force);
111 extern int net_os_set_suspend_bcn_li_dtim(struct net_device *dev, int val);
112 extern int net_os_set_max_dtim_enable(struct net_device *dev, int val);
113 #ifdef DISABLE_DTIM_IN_SUSPEND
114 extern int net_os_set_disable_dtim_in_suspend(struct net_device *dev, int val);
115 #endif /* DISABLE_DTIM_IN_SUSPEND */
116 extern int wl_parse_ssid_list_tlv(char **list_str, wlc_ssid_ext_t *ssid,
117                                   int max, int *bytes_left);
118 
119 /* Get the link speed from dongle, speed is in kpbs */
120 int wldev_get_link_speed(struct net_device *dev, int *plink_speed);
121 
122 int wldev_get_rssi(struct net_device *dev, scb_val_t *prssi);
123 
124 int wldev_get_ssid(struct net_device *dev, wlc_ssid_t *pssid);
125 
126 int wldev_get_band(struct net_device *dev, uint *pband);
127 int wldev_get_mode(struct net_device *dev, uint8 *pband, uint8 caplen);
128 int wldev_get_datarate(struct net_device *dev, int *datarate);
129 int wldev_set_band(struct net_device *dev, uint band);
130 
131 #endif /* __WLDEV_COMMON_H__ */
132