Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c6c55b7 authored by Dundi Raviteja's avatar Dundi Raviteja Committed by nshrivas
Browse files

qcacmn: Add support to send WMI_COEX_CONFIG_CMDID

Add support to send WMI command WMI_COEX_CONFIG_CMDID
for three antenna BTC.

Change-Id: Ic8f5d71a099ccc567cd9c181f845d74bd7061aa7
CRs-Fixed: 2298654
parent 1f478b46
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1453,6 +1453,16 @@ QDF_STATUS wmi_unified_send_sar_limit_cmd(void *wmi_hdl,
 */
QDF_STATUS wmi_unified_get_sar_limit_cmd(void *wmi_hdl);

/**
 * wmi_unified_send_coex_config_cmd() - send coex config command to firmware
 * @wmi_hdl: wmi handle
 * @params: coex config params
 *
 * Return: QDF_STATUS_SUCCESS on success or error code on failure
 */
QDF_STATUS wmi_unified_send_coex_config_cmd(void *wmi_hdl,
					    struct coex_config_params *params);

/**
 * wmi_unified_extract_sar_limit_event() - extract SAR limits from FW event
 * @wmi_hdl: wmi handle
+34 −0
Original line number Diff line number Diff line
@@ -7285,6 +7285,40 @@ struct sar_limit_event {
			sar_limit_row[MAX_SAR_LIMIT_ROWS_SUPPORTED];
};

/**
 * enum coex_config_type - For identifying coex config type params
 * COEX_CONFIG_TX_POWER: To set wlan total tx power when bt coex
 * COEX_CONFIG_HANDOVER_RSSI: To set WLAN RSSI (dBm units)
 * COEX_CONFIG_BTC_MODE: To set BTC mode
 * COEX_CONFIG_ANTENNA_ISOLATION: To set solation between BT and WLAN antenna
 * COEX_CONFIG_BT_LOW_RSSI_THRESHOLD: To set BT low rssi threshold (dbm units)
 * COEX_CONFIG_BT_INTERFERENCE_LEVEL: To set BT interference level (dbm units)
 */
enum coex_config_type {
	COEX_CONFIG_TX_POWER = 0x01,
	COEX_CONFIG_HANDOVER_RSSI = 0x02,
	COEX_CONFIG_BTC_MODE = 0x03,
	COEX_CONFIG_ANTENNA_ISOLATION = 0x04,
	COEX_CONFIG_BT_LOW_RSSI_THRESHOLD = 0x05,
	COEX_CONFIG_BT_INTERFERENCE_LEVEL = 0x06
};

#define MAX_COEX_CONFIG_TYPE_ARGS 6
/**
 * struct coex_config_params - COEX config params
 * @vdev_id: Virtual device Id
 * @config_type: Type of config type from enum coex_config_type
 * @config_value: config type values for enum coex_config_type,
 *                only config type COEX_CONFIG_BT_INTERFERENCE_LEVEL
 *                will use all arguments remaining will use only
 *                0th argument.
 */
struct coex_config_params {
	uint32_t vdev_id;
	enum coex_config_type config_type;
	uint32_t config_value[MAX_COEX_CONFIG_TYPE_ARGS];
};

/**
 * enum rcpi_measurement_type - for identifying type of rcpi measurement
 * @RCPI_MEASUREMENT_TYPE_AVG_MGMT: avg rcpi of mgmt frames
+3 −0
Original line number Diff line number Diff line
@@ -1208,6 +1208,9 @@ QDF_STATUS (*send_sar_limit_cmd)(wmi_unified_t wmi_handle,

QDF_STATUS (*get_sar_limit_cmd)(wmi_unified_t wmi_handle);

QDF_STATUS (*send_coex_config_cmd)(wmi_unified_t wmi_handle,
				   struct coex_config_params *params);

QDF_STATUS (*extract_sar_limit_event)(wmi_unified_t wmi_handle,
				      uint8_t *evt_buf,
				      struct sar_limit_event *event);
+11 −0
Original line number Diff line number Diff line
@@ -6406,6 +6406,17 @@ QDF_STATUS wmi_unified_get_sar_limit_cmd(void *wmi_hdl)
	return QDF_STATUS_E_FAILURE;
}

QDF_STATUS wmi_unified_send_coex_config_cmd(void *wmi_hdl,
					    struct coex_config_params *params)
{
	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;

	if (wmi_handle->ops->send_coex_config_cmd)
		return wmi_handle->ops->send_coex_config_cmd(wmi_handle,
							     params);
	return QDF_STATUS_E_FAILURE;
}

QDF_STATUS wmi_unified_extract_sar_limit_event(void *wmi_hdl,
					       uint8_t *evt_buf,
					       struct sar_limit_event *event)
+72 −0
Original line number Diff line number Diff line
@@ -3932,6 +3932,77 @@ QDF_STATUS send_setup_install_key_cmd_tlv(wmi_unified_t wmi_handle,
	return status;
}

/**
 * send_coex_config_cmd_tlv() - send coex config command to firmware
 * @wmi_handle: wmi handle
 * @params: coex config params
 *
 * Return: QDF_STATUS_SUCCESS for success or error code
 */
static QDF_STATUS send_coex_config_cmd_tlv(wmi_unified_t wmi_handle,
					   struct coex_config_params *params)
{
	WMI_COEX_CONFIG_CMD_fixed_param *cmd;
	wmi_buf_t buf;
	uint32_t len = sizeof(*cmd);
	WMI_COEX_CONFIG_TYPE config_type;
	QDF_STATUS status;

	buf = wmi_buf_alloc(wmi_handle, len);
	if (!buf) {
		WMI_LOGE("Failed to allocate buffer to coex config params");
		return QDF_STATUS_E_NOMEM;
	}

	cmd = (WMI_COEX_CONFIG_CMD_fixed_param *)wmi_buf_data(buf);
	WMITLV_SET_HDR(&cmd->tlv_header,
		       WMITLV_TAG_STRUC_WMI_COEX_CONFIG_CMD_fixed_param,
		       WMITLV_GET_STRUCT_TLVLEN(
		       WMI_COEX_CONFIG_CMD_fixed_param));

	cmd->vdev_id = params->vdev_id;
	cmd->config_arg1 = params->config_value[0];

	switch (params->config_type) {
	case COEX_CONFIG_TX_POWER:
		config_type = WMI_COEX_CONFIG_TX_POWER;
		break;
	case COEX_CONFIG_HANDOVER_RSSI:
		config_type = WMI_COEX_CONFIG_HANDOVER_RSSI;
		break;
	case COEX_CONFIG_BTC_MODE:
		config_type = WMI_COEX_CONFIG_BTC_MODE;
		break;
	case COEX_CONFIG_ANTENNA_ISOLATION:
		config_type = WMI_COEX_CONFIG_ANTENNA_ISOLATION;
		break;
	case COEX_CONFIG_BT_LOW_RSSI_THRESHOLD:
		config_type = WMI_COEX_CONFIG_BT_LOW_RSSI_THRESHOLD;
		break;
	case COEX_CONFIG_BT_INTERFERENCE_LEVEL:
		config_type = WMI_COEX_CONFIG_BT_INTERFERENCE_LEVEL;
		cmd->config_arg2 = params->config_value[1];
		cmd->config_arg3 = params->config_value[2];
		cmd->config_arg4 = params->config_value[3];
		cmd->config_arg5 = params->config_value[4];
		cmd->config_arg6 = params->config_value[5];
		break;
	default:
		WMI_LOGE("Unknown coex config type received");
		wmi_buf_free(buf);
		return QDF_STATUS_E_FAILURE;
	}
	cmd->config_type = config_type;

	status = wmi_unified_cmd_send(wmi_handle, buf, len,
				      WMI_COEX_CONFIG_CMDID);
	if (QDF_IS_STATUS_ERROR(status)) {
		WMI_LOGE("Failed to send WMI_COEX_CONFIG_CMDID");
		wmi_buf_free(buf);
	}
	return status;
}

/**
 * send_sar_limit_cmd_tlv() - send sar limit cmd to fw
 * @wmi_handle: wmi handle
@@ -15190,6 +15261,7 @@ struct wmi_ops tlv_ops = {
				send_encrypt_decrypt_send_cmd_tlv,
	.send_sar_limit_cmd = send_sar_limit_cmd_tlv,
	.get_sar_limit_cmd = get_sar_limit_cmd_tlv,
	.send_coex_config_cmd = send_coex_config_cmd_tlv,
	.extract_sar_limit_event = extract_sar_limit_event_tlv,
	.extract_sar2_result_event = extract_sar2_result_event_tlv,
	.send_per_roam_config_cmd = send_per_roam_config_cmd_tlv,