int iwm_store_rxiq_calib_result(struct iwm_priv *iwm) { struct iwm_calib_rxiq *rxiq; u8 *eeprom_rxiq = iwm_eeprom_access(iwm, IWM_EEPROM_CALIB_RXIQ); int grplen = sizeof(struct iwm_calib_rxiq_group); rxiq = kzalloc(sizeof(struct iwm_calib_rxiq), GFP_KERNEL); if (!rxiq) { IWM_ERR(iwm, "Couldn't alloc memory for RX IQ\n"); return -ENOMEM; } eeprom_rxiq = iwm_eeprom_access(iwm, IWM_EEPROM_CALIB_RXIQ); if (IS_ERR(eeprom_rxiq)) { IWM_ERR(iwm, "Couldn't access EEPROM RX IQ entry\n"); return PTR_ERR(eeprom_rxiq); } iwm->calib_res[SHILOH_PHY_CALIBRATE_RX_IQ_CMD].buf = (u8 *)rxiq; iwm->calib_res[SHILOH_PHY_CALIBRATE_RX_IQ_CMD].size = sizeof(*rxiq); rxiq->hdr.opcode = SHILOH_PHY_CALIBRATE_RX_IQ_CMD; rxiq->hdr.first_grp = 0; rxiq->hdr.grp_num = 1; rxiq->hdr.all_data_valid = 1; memcpy(&rxiq->group[0], eeprom_rxiq, 4 * grplen); memcpy(&rxiq->group[4], eeprom_rxiq + 6 * grplen, grplen); return 0; }
int iwm_eeprom_fat_channels(struct iwm_priv *iwm) { struct wiphy *wiphy = iwm_to_wiphy(iwm); struct ieee80211_supported_band *band; u16 *channels, i; channels = (u16 *)iwm_eeprom_access(iwm, IWM_EEPROM_FAT_CHANNELS_CAP); if (IS_ERR(channels)) return PTR_ERR(channels); band = wiphy->bands[IEEE80211_BAND_2GHZ]; band->ht_cap.ht_supported = true; for (i = 0; i < IWM_EEPROM_FAT_CHANNELS_24; i++) if (!(channels[i] & IWM_EEPROM_FAT_CHANNEL_ENABLED)) band->ht_cap.ht_supported = false; band = wiphy->bands[IEEE80211_BAND_5GHZ]; band->ht_cap.ht_supported = true; for (i = IWM_EEPROM_FAT_CHANNELS_24; i < IWM_EEPROM_FAT_CHANNELS; i++) if (!(channels[i] & IWM_EEPROM_FAT_CHANNEL_ENABLED)) band->ht_cap.ht_supported = false; return 0; }
u32 iwm_eeprom_wireless_mode(struct iwm_priv *iwm) { u16 sku_cap; u32 wireless_mode = 0; sku_cap = *((u16 *)iwm_eeprom_access(iwm, IWM_EEPROM_SKU_CAP)); if (sku_cap & IWM_EEPROM_SKU_CAP_BAND_24GHZ) wireless_mode |= WIRELESS_MODE_11G; if (sku_cap & IWM_EEPROM_SKU_CAP_BAND_52GHZ) wireless_mode |= WIRELESS_MODE_11A; if (sku_cap & IWM_EEPROM_SKU_CAP_11N_ENABLE) wireless_mode |= WIRELESS_MODE_11N; return wireless_mode; }