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