Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 1 | /* |
Mukul Sharma | ecf8e09 | 2017-12-19 22:36:31 +0530 | [diff] [blame] | 2 | * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 3 | * |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 4 | * 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 Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 19 | #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 Johnson | 4af7866 | 2017-08-28 11:44:08 -0700 | [diff] [blame] | 28 | struct hdd_context; |
| 29 | |
Amar Singhal | ea10a87 | 2016-08-23 15:31:45 -0700 | [diff] [blame] | 30 | #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 Johnson | 4af7866 | 2017-08-28 11:44:08 -0700 | [diff] [blame] | 35 | int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy); |
| 36 | void hdd_program_country_code(struct hdd_context *hdd_ctx); |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 37 | void hdd_reset_global_reg_params(void); |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 38 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 39 | /** |
Kiran Kumar Lokere | 0508af9 | 2018-04-23 18:38:32 -0700 | [diff] [blame] | 40 | * hdd_send_wiphy_regd_sync_event() - sends the regulatory sync event |
| 41 | * @hdd_ctx: HDD context |
| 42 | * |
| 43 | * Return: None |
| 44 | */ |
| 45 | void hdd_send_wiphy_regd_sync_event(struct hdd_context *hdd_ctx); |
| 46 | |
| 47 | /** |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 48 | * 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 Johnson | 4af7866 | 2017-08-28 11:44:08 -0700 | [diff] [blame] | 54 | int hdd_reg_set_country(struct hdd_context *hdd_ctx, char *country_code); |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 55 | |
| 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 | */ |
| 63 | int hdd_reg_set_band(struct net_device *dev, u8 ui_band); |
| 64 | |
Mukul Sharma | ecf8e09 | 2017-12-19 22:36:31 +0530 | [diff] [blame] | 65 | /** |
| 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 | */ |
| 74 | void 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 | */ |
| 88 | void 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 Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 94 | #endif |