]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/net/wireless/mwifiex/sta_cmdresp.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[mirror_ubuntu-jammy-kernel.git] / drivers / net / wireless / mwifiex / sta_cmdresp.c
index a79ed9bd96953d180b0aa956845052e488394066..78fc352c85c4812d40bbe5e4a1f0e676aac6a0ac 100644 (file)
@@ -227,7 +227,7 @@ static int mwifiex_ret_get_log(struct mwifiex_private *priv,
                               struct mwifiex_ds_get_stats *stats)
 {
        struct host_cmd_ds_802_11_get_log *get_log =
-               (struct host_cmd_ds_802_11_get_log *) &resp->params.get_log;
+               &resp->params.get_log;
 
        if (stats) {
                stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame);
@@ -282,7 +282,7 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
        u32 i;
        int ret = 0;
 
-       tlv_buf = (u8 *) ((u8 *) rate_cfg) +
+       tlv_buf = ((u8 *)rate_cfg) +
                        sizeof(struct host_cmd_ds_tx_rate_cfg);
        tlv_buf_len = *(u16 *) (tlv_buf + sizeof(u16));
 
@@ -450,6 +450,30 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,
        return 0;
 }
 
+/*
+ * This function handles the command response of get RF Tx power.
+ */
+static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv,
+                                  struct host_cmd_ds_command *resp)
+{
+       struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp;
+       u16 action = le16_to_cpu(txp->action);
+
+       priv->tx_power_level = le16_to_cpu(txp->cur_level);
+
+       if (action == HostCmd_ACT_GEN_GET) {
+               priv->max_tx_power_level = txp->max_power;
+               priv->min_tx_power_level = txp->min_power;
+       }
+
+       dev_dbg(priv->adapter->dev,
+               "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n",
+               priv->tx_power_level, priv->max_tx_power_level,
+               priv->min_tx_power_level);
+
+       return 0;
+}
+
 /*
  * This function handles the command response of set/get MAC address.
  *
@@ -679,39 +703,33 @@ static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp,
        eeprom = data_buf;
        switch (type) {
        case HostCmd_CMD_MAC_REG_ACCESS:
-               r.mac = (struct host_cmd_ds_mac_reg_access *)
-                       &resp->params.mac_reg;
+               r.mac = &resp->params.mac_reg;
                reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset));
                reg_rw->value = r.mac->value;
                break;
        case HostCmd_CMD_BBP_REG_ACCESS:
-               r.bbp = (struct host_cmd_ds_bbp_reg_access *)
-                       &resp->params.bbp_reg;
+               r.bbp = &resp->params.bbp_reg;
                reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset));
                reg_rw->value = cpu_to_le32((u32) r.bbp->value);
                break;
 
        case HostCmd_CMD_RF_REG_ACCESS:
-               r.rf = (struct host_cmd_ds_rf_reg_access *)
-                      &resp->params.rf_reg;
+               r.rf = &resp->params.rf_reg;
                reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
                reg_rw->value = cpu_to_le32((u32) r.bbp->value);
                break;
        case HostCmd_CMD_PMIC_REG_ACCESS:
-               r.pmic = (struct host_cmd_ds_pmic_reg_access *)
-                        &resp->params.pmic_reg;
+               r.pmic = &resp->params.pmic_reg;
                reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset));
                reg_rw->value = cpu_to_le32((u32) r.pmic->value);
                break;
        case HostCmd_CMD_CAU_REG_ACCESS:
-               r.rf = (struct host_cmd_ds_rf_reg_access *)
-                      &resp->params.rf_reg;
+               r.rf = &resp->params.rf_reg;
                reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
                reg_rw->value = cpu_to_le32((u32) r.rf->value);
                break;
        case HostCmd_CMD_802_11_EEPROM_ACCESS:
-               r.eeprom = (struct host_cmd_ds_802_11_eeprom_access *)
-                          &resp->params.eeprom;
+               r.eeprom = &resp->params.eeprom;
                pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count);
                if (le16_to_cpu(eeprom->byte_count) <
                    le16_to_cpu(r.eeprom->byte_count)) {
@@ -787,7 +805,7 @@ static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv,
                                 struct mwifiex_ds_misc_subsc_evt *sub_event)
 {
        struct host_cmd_ds_802_11_subsc_evt *cmd_sub_event =
-               (struct host_cmd_ds_802_11_subsc_evt *)&resp->params.subsc_evt;
+               &resp->params.subsc_evt;
 
        /* For every subscribe event command (Get/Set/Clear), FW reports the
         * current set of subscribed events*/
@@ -847,6 +865,9 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
        case HostCmd_CMD_TXPWR_CFG:
                ret = mwifiex_ret_tx_power_cfg(priv, resp);
                break;
+       case HostCmd_CMD_RF_TX_PWR:
+               ret = mwifiex_ret_rf_tx_power(priv, resp);
+               break;
        case HostCmd_CMD_802_11_PS_MODE_ENH:
                ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf);
                break;