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