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