blob: 87493f5e48a21feeedd76bcff55f7e72c5351313 [file] [log] [blame]
Amar Singhale4f28ee2015-10-21 14:36:56 -07001/*
Mukul Sharmaecf8e092017-12-19 22:36:31 +05302 * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
Amar Singhale4f28ee2015-10-21 14:36:56 -07003 *
Amar Singhale4f28ee2015-10-21 14:36:56 -07004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Amar Singhale4f28ee2015-10-21 14:36:56 -070019#if !defined __HDD_REGULATORY_H
20#define __HDD_REGULATORY_H
21
22/**
23 * DOC: wlan_hdd_regulatory.h
24 *
25 * HDD Regulatory prototype implementation
26 */
27
Jeff Johnson4af78662017-08-28 11:44:08 -070028struct hdd_context;
29
Amar Singhalea10a872016-08-23 15:31:45 -070030#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS)
31#define IEEE80211_CHAN_PASSIVE_SCAN IEEE80211_CHAN_NO_IR
32#define IEEE80211_CHAN_NO_IBSS IEEE80211_CHAN_NO_IR
33#endif
34
Jeff Johnson4af78662017-08-28 11:44:08 -070035int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy);
36void hdd_program_country_code(struct hdd_context *hdd_ctx);
Amar Singhal5cccafe2017-02-15 12:42:58 -080037void hdd_reset_global_reg_params(void);
Amar Singhale4f28ee2015-10-21 14:36:56 -070038
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070039/**
Kiran Kumar Lokere0508af92018-04-23 18:38:32 -070040 * hdd_send_wiphy_regd_sync_event() - sends the regulatory sync event
41 * @hdd_ctx: HDD context
42 *
43 * Return: None
44 */
45void hdd_send_wiphy_regd_sync_event(struct hdd_context *hdd_ctx);
46
47/**
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070048 * hdd_reg_set_country() - helper function for setting the regulatory country
49 * @hdd_ctx: the HDD context to set the country for
50 * @country_code: the two character country code to configure
51 *
52 * Return: zero for success, non-zero error code for failure
53 */
Jeff Johnson4af78662017-08-28 11:44:08 -070054int hdd_reg_set_country(struct hdd_context *hdd_ctx, char *country_code);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070055
56/**
57 * hdd_reg_set_band() - helper function for setting the regulatory band
58 * @hdd_ctx: the HDD context to set the band for
59 * @ui_band: the UI band to configure
60 *
61 * Return: zero for success, non-zero error code for failure
62 */
63int hdd_reg_set_band(struct net_device *dev, u8 ui_band);
64
Mukul Sharmaecf8e092017-12-19 22:36:31 +053065/**
66 * hdd_update_indoor_channel() - enable/disable indoor channel
67 * @hdd_ctx: hdd context
68 * @disable: whether to enable / disable indoor channel
69 *
70 * enable/disable indoor channel in wiphy/cds
71 *
72 * Return: void
73 */
74void hdd_update_indoor_channel(struct hdd_context *hdd_ctx,
75 bool disable);
76/**
77 * hdd_modify_indoor_channel_state_flags() - modify wiphy flags and cds state
78 * @wiphy_chan: wiphy channel number
79 * @cds_chan: cds channel structure
80 * @chan_enum: channel enum maintain in reg db
81 * @chan_num: channel index
82 * @disable: Disable/enable the flags
83 *
84 * Modify wiphy flags and cds state if channel is indoor.
85 *
86 * Return: void
87 */
88void hdd_modify_indoor_channel_state_flags(
89 struct hdd_context *hdd_ctx,
90 struct ieee80211_channel *wiphy_chan,
91 struct regulatory_channel *cds_chan,
92 enum channel_enum chan_enum, int chan_num, bool disable);
93
Amar Singhale4f28ee2015-10-21 14:36:56 -070094#endif