1 /* 2 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 /** 18 * DOC: wifi_pos_utils_pub.h 19 * This file declares public utils of wifi positioning component 20 */ 21 #ifndef _WIFI_POS_UTILS_PUB_H_ 22 #define _WIFI_POS_UTILS_PUB_H_ 23 24 /* Include files */ 25 #include "qdf_types.h" 26 #include "qdf_status.h" 27 #include "qdf_trace.h" 28 #include <wlan_cmn.h> 29 #include <reg_services_public_struct.h> 30 31 #define WIFIPOS_RESERVE_BYTES 100 32 #define OEM_TARGET_SIGNATURE_LEN 8 33 #define OEM_TARGET_SIGNATURE "QUALCOMM" 34 35 #define OEM_CAP_MAX_NUM_CHANNELS 128 36 37 #define WIFI_POS_RSP_V1_FLAT_MEMORY 0x00000001 38 #define WIFI_POS_RSP_V2_NL 0x00000002 39 40 /** 41 * enum wifi_pos_cmd_ids 42 * @WIFI_POS_CMD_REGISTRATION: app registration 43 * @WIFI_POS_CMD_GET_CAPS: get driver capabilities 44 * @WIFI_POS_CMD_GET_CH_INFO: get channel info 45 * @WIFI_POS_CMD_OEM_DATA: oem data req/rsp 46 * @WIFI_POS_CMD_MAX: Max cld80211 vendor sub cmds 47 */ 48 49 enum wifi_pos_cmd_ids { 50 WIFI_POS_CMD_INVALID = 0, 51 WIFI_POS_CMD_REGISTRATION = 1, 52 WIFI_POS_CMD_SET_CAPS = 2, 53 WIFI_POS_CMD_GET_CAPS = 3, 54 WIFI_POS_CMD_GET_CH_INFO = 4, 55 WIFI_POS_CMD_OEM_DATA = 5, 56 WIFI_POS_CMD_ERROR = 6, 57 WIFI_POS_PEER_STATUS_IND = 7, 58 /* keep last */ 59 WIFI_POS_CMD__AFTER_LAST, 60 WIFI_POS_CMD_MAX = 61 WIFI_POS_CMD__AFTER_LAST - 1 62 }; 63 64 65 /** 66 * struct wifi_pos_driver_version - Driver version identifier (w.x.y.z) 67 * @major: Version ID major number 68 * @minor: Version ID minor number 69 * @patch: Version ID patch number 70 * @build: Version ID build number 71 */ 72 struct qdf_packed wifi_pos_driver_version { 73 uint8_t major; 74 uint8_t minor; 75 uint8_t patch; 76 uint8_t build; 77 }; 78 79 /** 80 * struct wifi_pos_channel_power 81 * @ch_power: channel_power structure object 82 * @band_center_freq1: Center frequency1 83 * @phy_mode: Phymode 84 * @is_dfs_chan: Is DFS channel 85 */ 86 struct wifi_pos_channel_power { 87 struct channel_power ch_power; 88 uint32_t band_center_freq1; 89 uint32_t phy_mode; 90 bool is_dfs_chan; 91 }; 92 93 /** 94 * struct wifi_pos_channel_list 95 * @valid_channels: no of valid channels 96 * @chan_info: channel info 97 */ 98 struct qdf_packed wifi_pos_channel_list { 99 uint16_t num_channels; 100 struct wifi_pos_channel_power chan_info[NUM_CHANNELS]; 101 }; 102 103 /** 104 * struct wifi_pos_driver_caps - OEM Data Capabilities 105 * @oem_target_signature: Signature of chipset vendor 106 * @oem_target_type: Chip type 107 * @oem_fw_version: Firmware version 108 * @driver_version: Host software version 109 * @allowed_dwell_time_min: Channel dwell time - allowed minimum 110 * @allowed_dwell_time_max: Channel dwell time - allowed maximum 111 * @curr_dwell_time_min: Channel dwell time - current minimim 112 * @curr_dwell_time_max: Channel dwell time - current maximum 113 * @supported_bands: Supported bands, 2.4G or 5G Hz 114 * @num_channels: Num of channels IDs to follow 115 * @channel_list: List of channel IDs 116 */ 117 struct qdf_packed wifi_pos_driver_caps { 118 uint8_t oem_target_signature[OEM_TARGET_SIGNATURE_LEN]; 119 uint32_t oem_target_type; 120 uint32_t oem_fw_version; 121 struct wifi_pos_driver_version driver_version; 122 uint16_t allowed_dwell_time_min; 123 uint16_t allowed_dwell_time_max; 124 uint16_t curr_dwell_time_min; 125 uint16_t curr_dwell_time_max; 126 uint16_t supported_bands; 127 uint16_t num_channels; 128 uint8_t channel_list[OEM_CAP_MAX_NUM_CHANNELS]; 129 }; 130 131 /** 132 * struct wifi_pos_user_defined_caps - OEM capability to be exchanged between 133 * host and userspace 134 * @ftm_rr: FTM range report capability bit 135 * @lci_capability: LCI capability bit 136 * @reserved1: reserved 137 * @reserved2: reserved 138 */ 139 struct wifi_pos_user_defined_caps { 140 uint32_t ftm_rr:1; 141 uint32_t lci_capability:1; 142 uint32_t reserved1:30; 143 uint32_t reserved2; 144 }; 145 146 /** 147 * struct wifi_pos_oem_get_cap_rsp - capabilities set by userspace and target. 148 * @driver_cap: target capabilities 149 * @user_defined_cap: capabilities set by userspace via set request 150 */ 151 struct qdf_packed wifi_pos_oem_get_cap_rsp { 152 struct wifi_pos_driver_caps driver_cap; 153 struct wifi_pos_user_defined_caps user_defined_cap; 154 }; 155 #endif 156