qcacld-3.0: Add infra to support DBAM feature

Add infra to support Dedicated Bluetooth Antenna Mode (DBAM)
feature. It is used to switch between dedicated antenna for
BT and shared antenna for WLAN and BT.

Change-Id: I20b08a2fd446da4e3c17813aa64e368750286114
CRs-Fixed: 3239896
This commit is contained in:
Aditya Kodukula
2022-07-05 21:29:57 -07:00
committed by Madan Koyyalamudi
parent 49308343ab
commit 2d9a20e46f
14 changed files with 725 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 above
@@ -21,6 +22,7 @@
#define __TARGET_IF_COEX_H__
#include <target_if.h>
#include "wlan_coex_public_structs.h"
/**
* target_if_coex_register_tx_ops() - Register coex target_if tx ops
@@ -30,4 +32,26 @@
*/
QDF_STATUS
target_if_coex_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
#ifdef WLAN_FEATURE_DBAM_CONFIG
/**
* target_if_dbam_register_tx_ops() - Register dbam target_if tx ops
* @tx_ops: pointer to target if tx ops
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS
target_if_dbam_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
/**
* target_if_dbam_process_event() - dbam response function handler
* @psoc: pointer to psoc
* @resp: response received from FW to dbam config command
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS
target_if_dbam_process_event(struct wlan_objmgr_psoc *psoc,
enum coex_dbam_comp_status resp);
#endif
#endif

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 above
@@ -19,6 +20,7 @@
*/
#include <wlan_coex_main.h>
#include <target_if_coex.h>
#include "wlan_coex_public_structs.h"
static QDF_STATUS
target_if_coex_config_send(struct wlan_objmgr_pdev *pdev,
@@ -50,3 +52,176 @@ target_if_coex_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_DBAM_CONFIG
QDF_STATUS
target_if_dbam_process_event(struct wlan_objmgr_psoc *psoc,
enum coex_dbam_comp_status resp)
{
struct coex_psoc_obj *coex_obj;
struct wlan_coex_callback *cb;
if (!psoc) {
coex_err("psoc is null");
return QDF_STATUS_E_INVAL;
}
coex_obj = wlan_psoc_get_coex_obj(psoc);
if (!coex_obj) {
coex_err("failed to get coex_obj");
return QDF_STATUS_E_INVAL;
}
cb = &coex_obj->cb;
if (cb->set_dbam_config_cb)
cb->set_dbam_config_cb(cb->set_dbam_config_ctx, &resp);
return QDF_STATUS_SUCCESS;
}
/**
* target_if_dbam_response_event_handler() - function to handle dbam response
* event from firmware.
* @scn: scn handle
* @data: data buffer foe the event
* @data_len: data length
*
* Return: 0 on success, and error code on failure
*/
static int target_if_dbam_response_event_handler(ol_scn_t scn,
uint8_t *data,
uint32_t len)
{
QDF_STATUS status;
struct wlan_objmgr_psoc *psoc;
wmi_unified_t wmi_handle;
struct wlan_lmac_if_dbam_rx_ops *rx_ops;
struct coex_dbam_config_resp resp = {0};
target_if_debug("scn:%pK, data:%pK, datalen:%d", scn, data, len);
if (!scn || !data) {
target_if_err("scn: 0x%pK, data: 0x%pK", scn, data);
return -EINVAL;
}
psoc = target_if_get_psoc_from_scn_hdl(scn);
if (!psoc) {
target_if_err("psoc is Null");
return -EINVAL;
}
rx_ops = wlan_psoc_get_dbam_rx_ops(psoc);
if (!rx_ops || !rx_ops->dbam_resp_event) {
target_if_err("callback not registered");
return -EINVAL;
}
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("wmi_handle is null");
return -EINVAL;
}
status = wmi_extract_dbam_config_response(wmi_handle, data, &resp);
if (QDF_IS_STATUS_ERROR(status)) {
target_if_err("Failed to extract dbam config response");
return -EINVAL;
}
status = rx_ops->dbam_resp_event(psoc, resp.dbam_resp);
if (QDF_IS_STATUS_ERROR(status)) {
target_if_err("process dbam response event failed");
return -EINVAL;
}
return 0;
}
/**
* target_if_dbam_config_send() - Send WMI command for DBAM configuration
* @psoc: psoc pointer
* @param: dbam config parameters
*
* Return: QDF_STATUS
*/
static QDF_STATUS
target_if_dbam_config_send(struct wlan_objmgr_psoc *psoc,
struct coex_dbam_config_params *param)
{
QDF_STATUS status;
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("Invalid WMI handle");
return QDF_STATUS_E_FAILURE;
}
status = wmi_unified_send_dbam_config_cmd(wmi_handle, param);
if (QDF_IS_STATUS_ERROR(status))
target_if_err("Failed to send DBAM config %d", status);
return status;
}
static QDF_STATUS
target_if_dbam_register_event_handler(struct wlan_objmgr_psoc *psoc)
{
QDF_STATUS status;
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("Invalid WMI handle");
return QDF_STATUS_E_INVAL;
}
status = wmi_unified_register_event_handler(wmi_handle,
wmi_coex_dbam_complete_event_id,
target_if_dbam_response_event_handler,
WMI_RX_WORK_CTX);
if (QDF_IS_STATUS_ERROR(status))
target_if_err("Failed to register dbam complete event cb");
return status;
}
static QDF_STATUS
target_if_dbam_unregister_event_handler(struct wlan_objmgr_psoc *psoc)
{
wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("Invalid WMI handle");
return QDF_STATUS_E_INVAL;
}
wmi_unified_unregister_event_handler(wmi_handle,
wmi_coex_dbam_complete_event_id);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
target_if_dbam_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
{
struct wlan_lmac_if_dbam_tx_ops *dbam_tx_ops;
if (!tx_ops) {
target_if_err("target if tx ops is NULL!");
return QDF_STATUS_E_INVAL;
}
dbam_tx_ops = &tx_ops->dbam_tx_ops;
if (!dbam_tx_ops) {
target_if_err("target if dbam ops is NULL!");
return QDF_STATUS_E_FAILURE;
}
dbam_tx_ops->set_dbam_config = target_if_dbam_config_send;
dbam_tx_ops->dbam_event_attach = target_if_dbam_register_event_handler;
dbam_tx_ops->dbam_event_detach =
target_if_dbam_unregister_event_handler;
return QDF_STATUS_SUCCESS;
}
#endif