bcmdhd_1_77: Import A320F (A320FLXXU2CRE3) Oreo driver
[GitHub/LineageOS/android_kernel_samsung_universal7580.git] / drivers / net / wireless / bcmdhd_1_77 / dhd_linux.h
CommitLineData
3c2a0909
S
1/*
2 * DHD Linux header file (dhd_linux exports for cfg80211 and other components)
3 *
4c205efb 4 * Copyright (C) 1999-2018, Broadcom Corporation
3c2a0909
S
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 of
16 * the license of that module. An independent module is a module which is not
17 * 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 *
4c205efb 27 * $Id: dhd_linux.h 733907 2017-11-30 12:20:38Z $
3c2a0909
S
28 */
29
30/* wifi platform functions for power, interrupt and pre-alloc, either
31 * from Android-like platform device data, or Broadcom wifi platform
32 * device data.
33 *
34 */
35#ifndef __DHD_LINUX_H__
36#define __DHD_LINUX_H__
37
38#include <linux/kernel.h>
39#include <linux/init.h>
40#include <linux/fs.h>
41#include <dngl_stats.h>
42#include <dhd.h>
43/* Linux wireless extension support */
44#if defined(WL_WIRELESS_EXT)
45#include <wl_iw.h>
46#endif /* defined(WL_WIRELESS_EXT) */
47#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND)
48#include <linux/earlysuspend.h>
49#endif /* defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND) */
50#if defined(CONFIG_WIFI_CONTROL_FUNC)
51#include <linux/wlan_plat.h>
52#endif
53
54#if !defined(CONFIG_WIFI_CONTROL_FUNC)
55#define WLAN_PLAT_NODFS_FLAG 0x01
56#define WLAN_PLAT_AP_FLAG 0x02
57struct wifi_platform_data {
58 int (*set_power)(int val);
59 int (*set_reset)(int val);
60 int (*set_carddetect)(int val);
61 void *(*mem_prealloc)(int section, unsigned long size);
62 int (*get_mac_addr)(unsigned char *buf);
63#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 58)) || defined(CUSTOM_COUNTRY_CODE)
64 void *(*get_country_code)(char *ccode, u32 flags);
65#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 58)) || defined (CUSTOM_COUNTRY_CODE) */
66 void *(*get_country_code)(char *ccode);
67#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 58)) */
68};
69#endif /* CONFIG_WIFI_CONTROL_FUNC */
70
71#define DHD_REGISTRATION_TIMEOUT 12000 /* msec : allowed time to finished dhd registration */
72
73typedef struct wifi_adapter_info {
74 const char *name;
75 uint irq_num;
76 uint intr_flags;
77 const char *fw_path;
78 const char *nv_path;
79 void *wifi_plat_data; /* wifi ctrl func, for backward compatibility */
80 uint bus_type;
81 uint bus_num;
82 uint slot_num;
83#if defined(BT_OVER_SDIO)
84 const char *btfw_path;
85#endif /* defined (BT_OVER_SDIO) */
86} wifi_adapter_info_t;
87
88typedef struct bcmdhd_wifi_platdata {
89 uint num_adapters;
90 wifi_adapter_info_t *adapters;
91} bcmdhd_wifi_platdata_t;
92
93/** Per STA params. A list of dhd_sta objects are managed in dhd_if */
94typedef struct dhd_sta {
95 cumm_ctr_t cumm_ctr; /* cummulative queue length of child flowrings */
96 uint16 flowid[NUMPRIO]; /* allocated flow ring ids (by priority) */
97 void * ifp; /* associated dhd_if */
98 struct ether_addr ea; /* stations ethernet mac address */
99 struct list_head list; /* link into dhd_if::sta_list */
100 int idx; /* index of self in dhd_pub::sta_pool[] */
101 int ifidx; /* index of interface in dhd */
102} dhd_sta_t;
103typedef dhd_sta_t dhd_sta_pool_t;
104
105int dhd_wifi_platform_register_drv(void);
106void dhd_wifi_platform_unregister_drv(void);
107wifi_adapter_info_t* dhd_wifi_platform_get_adapter(uint32 bus_type, uint32 bus_num,
108 uint32 slot_num);
109int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long msec);
110int wifi_platform_bus_enumerate(wifi_adapter_info_t *adapter, bool device_present);
111int wifi_platform_get_irq_number(wifi_adapter_info_t *adapter, unsigned long *irq_flags_ptr);
112int wifi_platform_get_mac_addr(wifi_adapter_info_t *adapter, unsigned char *buf);
113#ifdef CUSTOM_COUNTRY_CODE
114void *wifi_platform_get_country_code(wifi_adapter_info_t *adapter, char *ccode,
115 u32 flags);
116#else
117void *wifi_platform_get_country_code(wifi_adapter_info_t *adapter, char *ccode);
118#endif /* CUSTOM_COUNTRY_CODE */
119void* wifi_platform_prealloc(wifi_adapter_info_t *adapter, int section, unsigned long size);
120void* wifi_platform_get_prealloc_func_ptr(wifi_adapter_info_t *adapter);
121
122int dhd_get_fw_mode(struct dhd_info *dhdinfo);
123bool dhd_update_fw_nv_path(struct dhd_info *dhdinfo);
124
125#if defined(BT_OVER_SDIO)
126int dhd_net_bus_get(struct net_device *dev);
127int dhd_net_bus_put(struct net_device *dev);
128#endif /* BT_OVER_SDIO */
129#ifdef HOFFLOAD_MODULES
130extern void dhd_free_module_memory(struct dhd_bus *bus, struct module_metadata *hmem);
131extern void* dhd_alloc_module_memory(struct dhd_bus *bus, uint32_t size,
132 struct module_metadata *hmem);
133#endif /* HOFFLOAD_MODULES */
4c205efb 134#if defined(WLADPS) || defined(WLADPS_PRIVATE_CMD)
3c2a0909
S
135#define ADPS_ENABLE 1
136#define ADPS_DISABLE 0
137typedef struct bcm_iov_buf {
138 uint16 version;
139 uint16 len;
140 uint16 id;
141 uint16 data[1];
142} bcm_iov_buf_t;
143
144int dhd_enable_adps(dhd_pub_t *dhd, uint8 on);
4c205efb
DW
145#endif /* WLADPS || WLADPS_PRIVATE_CMD */
146#ifdef DHD_DISABLE_VHTMODE
147void dhd_disable_vhtmode(dhd_pub_t *dhd);
148#endif /* DHD_DISABLE_VHTMODE */
3c2a0909 149#endif /* __DHD_LINUX_H__ */