// SPDX-License-Identifier: GPL-2.0 #include "core.h" #include "utils.h" #include "host_rpu_sys_if.h" #include "img_host_rpu_umac_iface.h" #ifdef ENABLE_OTP RETENTION_MEM_SECTION_UNINITIALIZED extern struct rpu_otp_params otp_params; #endif RETENTION_MEM_SECTION_UNINITIALIZED struct wifi_dev *wifi; extern unsigned int vht_support; int img_params_init(void) { unsigned int i = 0; /*2.4GHz and 5 GHz PD and TX-PWR calibration params*/ char rf_params[RF_PARAMS_SIZE * 2]; strncpy(rf_params, DEF_RF_PARAMS, (RF_PARAMS_SIZE * 2)); /* Initialize WLAN params */ memset(&wifi->params, 0, sizeof(struct wifi_params)); /* TODO: Make this a struct */ memset(wifi->params.rf_params, 0xFF, sizeof(wifi->params.rf_params)); conv_str_to_byte(wifi->params.rf_params, rf_params, RF_PARAMS_SIZE); wifi->params.is_associated = 0; #ifdef ENABLE_OTP if(otp_params.prodctrl_disable5ghz == 0x50FA50FA){ wifi->params.dot11a_support = 0; }else{ wifi->params.dot11a_support = 1; } #else wifi->params.dot11a_support = 1; #endif wifi->params.dot11g_support = 1; wifi->params.num_vifs = 2; /* Check, if required add it */ wifi->params.tx_fixed_mcs_indx = 7; wifi->params.tx_fixed_rate = -1; wifi->params.num_spatial_streams = min(MAX_TX_STREAMS, MAX_RX_STREAMS); wifi->params.uccp_num_spatial_streams = min(MAX_TX_STREAMS, MAX_RX_STREAMS); wifi->params.antenna_sel = 1; wifi->params.uccp_num_spatial_streams = 0x02; /* num_streams_vpd */ /* Defaults optimized for all IMG clients */ wifi->params.mgd_mode_tx_fixed_mcs_indx = -1; wifi->params.mgd_mode_mcast_fixed_data_rate = -1; wifi->params.mgd_mode_tx_fixed_rate = -1; wifi->params.mgd_mode_mcast_fixed_nss = 1; wifi->params.mgd_mode_mcast_fixed_bcc_or_ldpc = 1; wifi->params.mgd_mode_mcast_fixed_stbc_enabled = 1; wifi->params.chnl_bw = WLAN_20MHZ_OPERATION; //wifi->params.vht_beamform_enable = VHT_BEAMFORM_DISABLE; wifi->params.vht_beamform_enable = 0; wifi->params.vht_beamform_period = 1000; /* ms */ wifi->params.vht_beamform_support = 0; wifi->params.max_tx_streams = MAX_TX_STREAMS; wifi->params.max_rx_streams = MAX_RX_STREAMS; wifi->params.max_data_size = 8 * 1024; wifi->params.max_tx_cmds = MAX_SUBFRAMES_IN_AMPDU_HT; if (vht_support) { wifi->params.max_tx_cmds = MAX_SUBFRAMES_IN_AMPDU_VHT; } wifi->params.disable_power_save = 0; wifi->params.disable_sm_power_save = 1; wifi->params.rate_protection_type = 0; wifi->params.prod_mode_rate_preamble_type = 1; /* LONG */ wifi->params.prod_mode_stbc_enabled = 0; wifi->params.prod_mode_bcc_or_ldpc = 0; wifi->params.payload_length = 4000; wifi->params.scan_type = ACTIVE; wifi->params.hw_scan_status = HW_SCAN_STATUS_NONE; return 0; } int proc_init(struct proc_dir_entry ***main_dir_entry) { int err = 0; wifi = kzalloc(sizeof(struct wifi_dev), 0xFFFF); if (!wifi) { err = -ENOMEM; goto out; } img_params_init(); out: return err; } void proc_exit(void) { kfree(wifi); }