qcacmn: Add API to send set TPC power command

Add new API to handle the logic of sending the WMI command,
WMI_SET_TPC_POWER_CMDID. Create the struct to hold this new
transmit power information.

Change-Id: Ibc7c6109176577f56d149baf87022de557e84445
CRs-fixed: 2841781
This commit is contained in:
Lincoln Tran 2020-12-09 18:00:20 -08:00 • committed by snandini
commit fb82cffd3a
4 changed files with 98 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -4246,4 +4246,16 @@ QDF_STATUS wmi_extract_pdev_csa_switch_count_status(
void *evt_buf,
struct pdev_csa_switch_count_status *param);
/**
* wmi_unified_send_set_tpc_power_cmd() - send set transmit power info
* @wmi_handle: wmi handle
* @vdev_id: vdev id
* @param: regulatory TPC info
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
QDF_STATUS wmi_unified_send_set_tpc_power_cmd(wmi_unified_t wmi_handle,
uint8_t vdev_id,
struct reg_tpc_power_info *param);
#endif /* _WMI_UNIFIED_API_H_ */

View file

@ -2479,6 +2479,10 @@ QDF_STATUS (*send_cp_stats_cmd)(wmi_unified_t wmi_handle,
QDF_STATUS (*extract_cp_stats_more_pending)(wmi_unified_t wmi_handle,
void *evt_buf,
uint32_t *more_flag);
QDF_STATUS (*send_set_tpc_power_cmd)(wmi_unified_t wmi_handle,
uint8_t vdev_id,
struct reg_tpc_power_info *param);
};
/* Forward declartion for psoc*/

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -3351,3 +3351,15 @@ QDF_STATUS wmi_extract_pdev_csa_switch_count_status(
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_send_set_tpc_power_cmd(wmi_unified_t wmi_handle,
uint8_t vdev_id,
struct reg_tpc_power_info *param)
{
if (wmi_handle->ops->send_set_tpc_power_cmd)
return wmi_handle->ops->send_set_tpc_power_cmd(wmi_handle,
vdev_id,
param);
return QDF_STATUS_E_FAILURE;
}

View file

@ -14400,6 +14400,72 @@ static QDF_STATUS extract_pdev_csa_switch_count_status_tlv(
return QDF_STATUS_SUCCESS;
}
/**
* send_set_tpc_power_cmd_tlv() - Sends the set TPC power level to FW
* @wmi_handle: wmi handle
* @param: Pointer to hold TX power info
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
static QDF_STATUS send_set_tpc_power_cmd_tlv(wmi_unified_t wmi_handle,
uint8_t vdev_id,
struct reg_tpc_power_info *param)
{
wmi_buf_t buf;
wmi_vdev_set_tpc_power_fixed_param *tpc_power_info_param;
wmi_vdev_ch_power_info *ch_power_info;
uint8_t *buf_ptr;
uint16_t idx;
uint32_t len;
QDF_STATUS ret;
len = sizeof(wmi_vdev_set_tpc_power_fixed_param) + WMI_TLV_HDR_SIZE;
len += (sizeof(wmi_vdev_ch_power_info) * param->num_pwr_levels);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf)
return QDF_STATUS_E_NOMEM;
buf_ptr = (uint8_t *)wmi_buf_data(buf);
tpc_power_info_param = (wmi_vdev_set_tpc_power_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&tpc_power_info_param->tlv_header,
WMITLV_TAG_STRUC_wmi_vdev_set_tpc_power_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_set_tpc_power_fixed_param));
tpc_power_info_param->vdev_id = vdev_id;
tpc_power_info_param->psd_power = param->is_psd_power;
tpc_power_info_param->eirp_power = param->eirp_power;
tpc_power_info_param->power_type_6ghz = param->power_type_6g;
buf_ptr += sizeof(wmi_vdev_set_tpc_power_fixed_param);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
param->num_pwr_levels * sizeof(wmi_vdev_ch_power_info));
buf_ptr += WMI_TLV_HDR_SIZE;
ch_power_info = (wmi_vdev_ch_power_info *)buf_ptr;
for (idx = 0; idx < param->num_pwr_levels; ++idx) {
WMITLV_SET_HDR(&ch_power_info[idx].tlv_header,
WMITLV_TAG_STRUC_wmi_vdev_ch_power_info,
WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_ch_power_info));
ch_power_info[idx].chan_cfreq =
param->chan_power_info[idx].chan_cfreq;
ch_power_info[idx].tx_power =
param->chan_power_info[idx].tx_power;
buf_ptr += sizeof(wmi_vdev_ch_power_info);
}
wmi_mtrace(WMI_VDEV_SET_TPC_POWER_CMDID, vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_VDEV_SET_TPC_POWER_CMDID);
if (QDF_IS_STATUS_ERROR(ret))
wmi_buf_free(buf);
return ret;
}
struct wmi_ops tlv_ops = {
.send_vdev_create_cmd = send_vdev_create_cmd_tlv,
.send_vdev_delete_cmd = send_vdev_delete_cmd_tlv,
@ -14759,7 +14825,8 @@ struct wmi_ops tlv_ops = {
.extract_cp_stats_more_pending =
extract_cp_stats_more_pending_tlv,
.extract_pdev_csa_switch_count_status =
extract_pdev_csa_switch_count_status_tlv,
extract_pdev_csa_switch_count_status_tlv,
.send_set_tpc_power_cmd = send_set_tpc_power_cmd_tlv,
};
/**