0001
0002
0003 #include "wcn36xx.h"
0004 #include "firmware.h"
0005
0006 #define DEFINE(s)[s] = #s
0007
0008 static const char * const wcn36xx_firmware_caps_names[] = {
0009 DEFINE(MCC),
0010 DEFINE(P2P),
0011 DEFINE(DOT11AC),
0012 DEFINE(SLM_SESSIONIZATION),
0013 DEFINE(DOT11AC_OPMODE),
0014 DEFINE(SAP32STA),
0015 DEFINE(TDLS),
0016 DEFINE(P2P_GO_NOA_DECOUPLE_INIT_SCAN),
0017 DEFINE(WLANACTIVE_OFFLOAD),
0018 DEFINE(BEACON_OFFLOAD),
0019 DEFINE(SCAN_OFFLOAD),
0020 DEFINE(ROAM_OFFLOAD),
0021 DEFINE(BCN_MISS_OFFLOAD),
0022 DEFINE(STA_POWERSAVE),
0023 DEFINE(STA_ADVANCED_PWRSAVE),
0024 DEFINE(AP_UAPSD),
0025 DEFINE(AP_DFS),
0026 DEFINE(BLOCKACK),
0027 DEFINE(PHY_ERR),
0028 DEFINE(BCN_FILTER),
0029 DEFINE(RTT),
0030 DEFINE(RATECTRL),
0031 DEFINE(WOW),
0032 DEFINE(WLAN_ROAM_SCAN_OFFLOAD),
0033 DEFINE(SPECULATIVE_PS_POLL),
0034 DEFINE(SCAN_SCH),
0035 DEFINE(IBSS_HEARTBEAT_OFFLOAD),
0036 DEFINE(WLAN_SCAN_OFFLOAD),
0037 DEFINE(WLAN_PERIODIC_TX_PTRN),
0038 DEFINE(ADVANCE_TDLS),
0039 DEFINE(BATCH_SCAN),
0040 DEFINE(FW_IN_TX_PATH),
0041 DEFINE(EXTENDED_NSOFFLOAD_SLOT),
0042 DEFINE(CH_SWITCH_V1),
0043 DEFINE(HT40_OBSS_SCAN),
0044 DEFINE(UPDATE_CHANNEL_LIST),
0045 DEFINE(WLAN_MCADDR_FLT),
0046 DEFINE(WLAN_CH144),
0047 DEFINE(NAN),
0048 DEFINE(TDLS_SCAN_COEXISTENCE),
0049 DEFINE(LINK_LAYER_STATS_MEAS),
0050 DEFINE(MU_MIMO),
0051 DEFINE(EXTENDED_SCAN),
0052 DEFINE(DYNAMIC_WMM_PS),
0053 DEFINE(MAC_SPOOFED_SCAN),
0054 DEFINE(BMU_ERROR_GENERIC_RECOVERY),
0055 DEFINE(DISA),
0056 DEFINE(FW_STATS),
0057 DEFINE(WPS_PRBRSP_TMPL),
0058 DEFINE(BCN_IE_FLT_DELTA),
0059 DEFINE(TDLS_OFF_CHANNEL),
0060 DEFINE(RTT3),
0061 DEFINE(MGMT_FRAME_LOGGING),
0062 DEFINE(ENHANCED_TXBD_COMPLETION),
0063 DEFINE(LOGGING_ENHANCEMENT),
0064 DEFINE(EXT_SCAN_ENHANCED),
0065 DEFINE(MEMORY_DUMP_SUPPORTED),
0066 DEFINE(PER_PKT_STATS_SUPPORTED),
0067 DEFINE(EXT_LL_STAT),
0068 DEFINE(WIFI_CONFIG),
0069 DEFINE(ANTENNA_DIVERSITY_SELECTION),
0070 };
0071
0072 #undef DEFINE
0073
0074 const char *wcn36xx_firmware_get_cap_name(enum wcn36xx_firmware_feat_caps x)
0075 {
0076 if (x >= ARRAY_SIZE(wcn36xx_firmware_caps_names))
0077 return "UNKNOWN";
0078 return wcn36xx_firmware_caps_names[x];
0079 }
0080
0081 void wcn36xx_firmware_set_feat_caps(u32 *bitmap,
0082 enum wcn36xx_firmware_feat_caps cap)
0083 {
0084 int arr_idx, bit_idx;
0085
0086 if (cap < 0 || cap > 127) {
0087 wcn36xx_warn("error cap idx %d\n", cap);
0088 return;
0089 }
0090
0091 arr_idx = cap / 32;
0092 bit_idx = cap % 32;
0093 bitmap[arr_idx] |= (1 << bit_idx);
0094 }
0095
0096 int wcn36xx_firmware_get_feat_caps(u32 *bitmap,
0097 enum wcn36xx_firmware_feat_caps cap)
0098 {
0099 int arr_idx, bit_idx;
0100
0101 if (cap < 0 || cap > 127) {
0102 wcn36xx_warn("error cap idx %d\n", cap);
0103 return -EINVAL;
0104 }
0105
0106 arr_idx = cap / 32;
0107 bit_idx = cap % 32;
0108
0109 return (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0;
0110 }
0111
0112 void wcn36xx_firmware_clear_feat_caps(u32 *bitmap,
0113 enum wcn36xx_firmware_feat_caps cap)
0114 {
0115 int arr_idx, bit_idx;
0116
0117 if (cap < 0 || cap > 127) {
0118 wcn36xx_warn("error cap idx %d\n", cap);
0119 return;
0120 }
0121
0122 arr_idx = cap / 32;
0123 bit_idx = cap % 32;
0124 bitmap[arr_idx] &= ~(1 << bit_idx);
0125 }