qcacld-3.0: Handle audio transport switch SM events
Add changes to handle audio transport switch events in different states of the bearer switch state machine. Change-Id: I07568b3c3ccc5877d1e6f46ae5bf12afd3af3ec2 CRs-Fixed: 3626950
This commit is contained in:

committed by
Rahul Choudhary

parent
cd478f4c07
commit
e6302e4ed3
@@ -30,8 +30,6 @@
|
||||
* caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
|
||||
* ref count
|
||||
*
|
||||
* Return: vdev pointer
|
||||
* NULL on FAILURE
|
||||
* Return: vdev id
|
||||
*/
|
||||
struct wlan_objmgr_vdev *
|
||||
wlan_policy_mgr_get_ll_lt_sap_vdev(struct wlan_objmgr_psoc *psoc);
|
||||
uint8_t wlan_policy_mgr_get_ll_lt_sap_vdev(struct wlan_objmgr_psoc *psoc);
|
||||
|
@@ -24,27 +24,18 @@
|
||||
#include "wlan_policy_mgr_i.h"
|
||||
#include "wlan_cmn.h"
|
||||
|
||||
struct wlan_objmgr_vdev *
|
||||
wlan_policy_mgr_get_ll_lt_sap_vdev(struct wlan_objmgr_psoc *psoc)
|
||||
uint8_t wlan_policy_mgr_get_ll_lt_sap_vdev(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
uint8_t ll_lt_sap_cnt;
|
||||
uint8_t vdev_id_list[MAX_NUMBER_OF_CONC_CONNECTIONS];
|
||||
struct wlan_objmgr_vdev *vdev;
|
||||
|
||||
ll_lt_sap_cnt = policy_mgr_get_mode_specific_conn_info(
|
||||
psoc, NULL,
|
||||
ll_lt_sap_cnt = policy_mgr_get_mode_specific_conn_info(psoc, NULL,
|
||||
vdev_id_list,
|
||||
PM_LL_LT_SAP_MODE);
|
||||
|
||||
/* Currently only 1 ll_lt_sap is supported */
|
||||
if (ll_lt_sap_cnt != 1) {
|
||||
policy_mgr_err("invalid number of ll_lt_sap %d", ll_lt_sap_cnt);
|
||||
return NULL;
|
||||
}
|
||||
if (!ll_lt_sap_cnt)
|
||||
return WLAN_INVALID_VDEV_ID;
|
||||
|
||||
vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id_list[0],
|
||||
WLAN_LL_SAP_ID);
|
||||
if (!vdev)
|
||||
policy_mgr_err("vdev is NULL");
|
||||
return vdev;
|
||||
return vdev_id_list[0];
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -26,20 +26,7 @@
|
||||
#include <qdf_atomic.h>
|
||||
#include "wlan_cmn.h"
|
||||
#include "wlan_ll_sap_main.h"
|
||||
|
||||
/**
|
||||
* enum bearer_switch_status: Bearer switch request status
|
||||
* @XPAN_BLE_SWITCH_INIT: Init status
|
||||
* @XPAN_BLE_SWITCH_SUCCESS: Bearer switch success
|
||||
* @XPAN_BLE_SWITCH_REJECTED: Bearer switch is rejected
|
||||
* @XPAN_BLE_SWITCH_TIMEOUT: Bearer switch request timed out
|
||||
*/
|
||||
enum bearer_switch_status {
|
||||
XPAN_BLE_SWITCH_INIT,
|
||||
XPAN_BLE_SWITCH_SUCCESS,
|
||||
XPAN_BLE_SWITCH_REJECTED,
|
||||
XPAN_BLE_SWITCH_TIMEOUT,
|
||||
};
|
||||
#include "wlan_sm_engine.h"
|
||||
|
||||
/**
|
||||
* enum wlan_bearer_switch_sm_state - Bearer switch states
|
||||
@@ -98,23 +85,6 @@ struct bs_state_sm {
|
||||
enum wlan_bearer_switch_sm_state bs_state;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct bearer_switch_request - Data structure to store the bearer switch
|
||||
* request
|
||||
* @requester_cb: Callback which needs to be invoked to indicate the status of
|
||||
* the request to the requester, this callback will be passed by the requester
|
||||
* when requester will send the request.
|
||||
* @arg: Argument passed by requester, this will be returned back in the
|
||||
* callback
|
||||
* @request_id: Unique value to identify the request
|
||||
*/
|
||||
|
||||
struct bearer_switch_request {
|
||||
requester_callback requester_cb;
|
||||
void *arg;
|
||||
uint32_t request_id;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct bearer_switch_info - Data structure to store the bearer switch
|
||||
* requests and related information
|
||||
@@ -122,25 +92,31 @@ struct bearer_switch_request {
|
||||
* @request_id: Last allocated request id
|
||||
* @sm: state machine context
|
||||
* @ref_count: Reference count corresponding to each vdev and requester
|
||||
* @last_status: last status of the bearer switch request
|
||||
* @fw_ref_count: Reference counts for the firmware requests
|
||||
* @total_ref_count: Total reference counts
|
||||
* @last_status:status of the last bearer switch request
|
||||
* @requests: Array of bearer_switch_requests to cache the request information
|
||||
* @bs_request_timer: Bearer switch request timer
|
||||
*/
|
||||
struct bearer_switch_info {
|
||||
struct wlan_objmgr_vdev *vdev;
|
||||
qdf_atomic_t request_id;
|
||||
struct bs_state_sm sm;
|
||||
uint8_t ref_count[WLAN_UMAC_PSOC_MAX_VDEVS][XPAN_BLE_SWITCH_REQUESTER_MAX];
|
||||
enum bearer_switch_status last_status;
|
||||
struct bearer_switch_request requests[MAX_BEARER_SWITCH_REQUESTERS];
|
||||
qdf_atomic_t ref_count[WLAN_UMAC_PSOC_MAX_VDEVS][BEARER_SWITCH_REQ_MAX];
|
||||
qdf_atomic_t fw_ref_count;
|
||||
qdf_atomic_t total_ref_count;
|
||||
QDF_STATUS last_status;
|
||||
struct wlan_bearer_switch_request requests[MAX_BEARER_SWITCH_REQUESTERS];
|
||||
qdf_mc_timer_t bs_request_timer;
|
||||
};
|
||||
|
||||
/**
|
||||
* ll_lt_sap_bearer_switch_get_id() - Get the request id for bearer switch
|
||||
* request
|
||||
* @vdev: Pointer to vdev
|
||||
* @psoc: Pointer to psoc
|
||||
* Return: Bearer switch request id
|
||||
*/
|
||||
uint32_t ll_lt_sap_bearer_switch_get_id(struct wlan_objmgr_vdev *vdev);
|
||||
wlan_bs_req_id ll_lt_sap_bearer_switch_get_id(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* bs_sm_create() - Invoke SM creation for bearer switch
|
||||
@@ -211,4 +187,77 @@ static inline void bs_lock_release(struct bearer_switch_info *bs_ctx)
|
||||
{
|
||||
qdf_mutex_release(&bs_ctx->sm.bs_sm_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* bs_sm_transition_to() - invokes state transition
|
||||
* @bs_ctx: Bearer switch ctx
|
||||
* @state: new cm state
|
||||
*
|
||||
* API to invoke SM API to move to new state
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
static inline void bs_sm_transition_to(struct bearer_switch_info *bs_ctx,
|
||||
enum wlan_bearer_switch_sm_state state)
|
||||
{
|
||||
wlan_sm_transition_to(bs_ctx->sm.sm_hdl, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* bs_sm_deliver_event() - Delivers event to Bearer switch SM
|
||||
* @psoc: Pointer to psoc
|
||||
* @event: BS event
|
||||
* @data_len: data size
|
||||
* @data: event data
|
||||
*
|
||||
* API to dispatch event to Bearer switch state machine. To be used while
|
||||
* posting events from API called from public API.
|
||||
*
|
||||
* Return: SUCCESS: on handling event
|
||||
* FAILURE: If event not handled
|
||||
*/
|
||||
QDF_STATUS bs_sm_deliver_event(struct wlan_objmgr_psoc *psoc,
|
||||
enum wlan_bearer_switch_sm_evt event,
|
||||
uint16_t data_len, void *data);
|
||||
|
||||
/**
|
||||
* bs_req_timer_init() - Initialize Bearer switch request timer
|
||||
* @bs_ctx: Bearer switch context
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void bs_req_timer_init(struct bearer_switch_info *bs_ctx);
|
||||
|
||||
/**
|
||||
* bs_req_timer_deinit() - De-initialize Bearer switch request timer
|
||||
* @bs_ctx: Bearer switch context
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void bs_req_timer_deinit(struct bearer_switch_info *bs_ctx);
|
||||
|
||||
/**
|
||||
* ll_lt_sap_is_bs_ctx_valid() - Check if bearer switch context is valid or not
|
||||
* @bs_ctx: Bearer switch context
|
||||
*
|
||||
* Return: True if bearer switch context is valid else return false
|
||||
*/
|
||||
#define ll_lt_sap_is_bs_ctx_valid(bs_ctx) \
|
||||
__ll_lt_sap_is_bs_ctx_valid(bs_ctx, __func__)
|
||||
|
||||
bool __ll_lt_sap_is_bs_ctx_valid(struct bearer_switch_info *bs_ctx,
|
||||
const char *func);
|
||||
|
||||
/**
|
||||
* ll_lt_sap_is_bs_req_valid() - Check if bearer switch request is valid or not
|
||||
* @bs_req: Bearer switch request
|
||||
*
|
||||
* Return: True if bearer switch request is valid else return false
|
||||
*/
|
||||
#define ll_lt_sap_is_bs_req_valid(bs_req) \
|
||||
__ll_lt_sap_is_bs_req_valid(bs_req, __func__)
|
||||
|
||||
bool __ll_lt_sap_is_bs_req_valid(struct wlan_bearer_switch_request *bs_req,
|
||||
const char *func);
|
||||
|
||||
#endif /* _WLAN_LL_LT_SAP_BEARER_SWITCH_H_ */
|
||||
|
@@ -76,6 +76,8 @@ QDF_STATUS ll_lt_sap_init(struct wlan_objmgr_vdev *vdev)
|
||||
{
|
||||
struct ll_sap_vdev_priv_obj *ll_sap_obj;
|
||||
QDF_STATUS status;
|
||||
uint8_t i, j;
|
||||
struct bearer_switch_info *bs_ctx;
|
||||
|
||||
ll_sap_obj = ll_sap_get_vdev_priv_obj(vdev);
|
||||
|
||||
@@ -85,16 +87,24 @@ QDF_STATUS ll_lt_sap_init(struct wlan_objmgr_vdev *vdev)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
ll_sap_obj->bearer_switch_ctx =
|
||||
qdf_mem_malloc(sizeof(struct bearer_switch_info));
|
||||
if (!ll_sap_obj->bearer_switch_ctx)
|
||||
bs_ctx = ll_sap_obj->bearer_switch_ctx;
|
||||
|
||||
bs_ctx = qdf_mem_malloc(sizeof(struct bearer_switch_info));
|
||||
if (!bs_ctx)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
qdf_atomic_init(&ll_sap_obj->bearer_switch_ctx->request_id);
|
||||
qdf_atomic_init(&bs_ctx->request_id);
|
||||
|
||||
ll_sap_obj->bearer_switch_ctx->vdev = vdev;
|
||||
for (i = 0; i < WLAN_UMAC_PSOC_MAX_VDEVS; i++)
|
||||
for (j = 0; j < BEARER_SWITCH_REQ_MAX; j++)
|
||||
qdf_atomic_init(&bs_ctx->ref_count[i][j]);
|
||||
|
||||
status = bs_sm_create(ll_sap_obj->bearer_switch_ctx);
|
||||
qdf_atomic_init(&bs_ctx->fw_ref_count);
|
||||
qdf_atomic_init(&bs_ctx->total_ref_count);
|
||||
|
||||
bs_ctx->vdev = vdev;
|
||||
|
||||
status = bs_sm_create(bs_ctx);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
goto bs_sm_failed;
|
||||
@@ -105,6 +115,7 @@ QDF_STATUS ll_lt_sap_init(struct wlan_objmgr_vdev *vdev)
|
||||
|
||||
bs_sm_failed:
|
||||
qdf_mem_free(ll_sap_obj->bearer_switch_ctx);
|
||||
ll_sap_obj->bearer_switch_ctx = NULL;
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -134,3 +145,11 @@ QDF_STATUS ll_lt_sap_deinit(struct wlan_objmgr_vdev *vdev)
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS ll_lt_sap_switch_bearer_to_ble(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_bearer_switch_request *bs_request)
|
||||
{
|
||||
return bs_sm_deliver_event(psoc, WLAN_BS_SM_EV_SWITCH_TO_WLAN,
|
||||
sizeof(*bs_request), bs_request);
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <i_qdf_types.h>
|
||||
#include <qdf_types.h>
|
||||
#include "wlan_ll_sap_main.h"
|
||||
#include "wlan_ll_sap_public_structs.h"
|
||||
|
||||
/**
|
||||
* ll_lt_sap_is_supported() - Check if ll_lt_sap is supported or not
|
||||
@@ -64,4 +65,15 @@ QDF_STATUS ll_lt_sap_init(struct wlan_objmgr_vdev *vdev);
|
||||
* else error code
|
||||
*/
|
||||
QDF_STATUS ll_lt_sap_deinit(struct wlan_objmgr_vdev *vdev);
|
||||
|
||||
/**
|
||||
* ll_lt_sap_switch_bearer_to_ble() - Switch audio transport to BLE
|
||||
* @psoc: Pointer to psoc
|
||||
* @bs_request: Pointer to bearer switch request
|
||||
* Return: QDF_STATUS_SUCCESS on successful bearer switch else failure
|
||||
*/
|
||||
QDF_STATUS
|
||||
ll_lt_sap_switch_bearer_to_ble(struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_bearer_switch_request *bs_request);
|
||||
|
||||
#endif /* _WLAN_LL_SAP_MAIN_H_ */
|
||||
|
@@ -24,22 +24,41 @@
|
||||
|
||||
#include <wlan_cmn.h>
|
||||
#include <wlan_objmgr_vdev_obj.h>
|
||||
#include "wlan_ll_sap_public_structs.h"
|
||||
|
||||
#ifdef WLAN_FEATURE_LL_LT_SAP
|
||||
|
||||
/**
|
||||
* wlan_ll_lt_sap_bearer_switch_get_id() - Get the request id for bearer switch
|
||||
* request
|
||||
* @vdev: Pointer to vdev
|
||||
* @psoc: Pointer to psoc
|
||||
* Return: Bearer switch request id
|
||||
*/
|
||||
uint32_t wlan_ll_lt_sap_bearer_switch_get_id(struct wlan_objmgr_vdev *vdev);
|
||||
wlan_bs_req_id
|
||||
wlan_ll_lt_sap_bearer_switch_get_id(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* wlan_ll_lt_sap_switch_bearer_to_ble() - Switch audio transport to BLE
|
||||
* @psoc: Pointer to psoc
|
||||
* @bs_request: Pointer to bearer switch request
|
||||
* Return: QDF_STATUS_SUCCESS on successful bearer switch else failure
|
||||
*/
|
||||
QDF_STATUS wlan_ll_lt_sap_switch_bearer_to_ble(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_bearer_switch_request *bs_request);
|
||||
#else
|
||||
|
||||
static inline uint32_t
|
||||
static inline wlan_bs_req_id
|
||||
wlan_ll_lt_sap_bearer_switch_get_id(struct wlan_objmgr_vdev *vdev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_ll_lt_sap_switch_bearer_to_ble(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_bearer_switch_request *bs_request)
|
||||
{
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
#endif /* WLAN_FEATURE_LL_LT_SAP */
|
||||
#endif /* _WLAN_LL_LT_SAP_API_H_ */
|
||||
|
@@ -27,35 +27,75 @@
|
||||
|
||||
/* Indicates MAX bearer switch requesters at a time */
|
||||
#define MAX_BEARER_SWITCH_REQUESTERS 5
|
||||
#define BS_REQ_ID_INVALID 0xFFFFFFFF
|
||||
typedef uint32_t wlan_bs_req_id;
|
||||
|
||||
/**
|
||||
* enum bearer_switch_requester_source: Bearer switch requester source
|
||||
* @XPAN_BLE_SWITCH_REQUESTER_CONNECT: Bearer switch requester is connect
|
||||
* @XPAN_BLE_SWITCH_REQUESTER_CSA: Bearer switch requester is CSA
|
||||
* @XPAN_BLE_SWITCH_REQUESTER_FW: Bearer switch requester is FW
|
||||
* @XPAN_BLE_SWITCH_REQUESTER_MAX: Indicates MAX bearer switch requester
|
||||
* enum bearer_switch_req_type: Bearer switch request type
|
||||
* @WLAN_BS_REQ_TO_WLAN: Bearer switch request to wlan
|
||||
* @WLAN_BS_REQ_TO_NON_WLAN: Bearer switch request to non-wlan
|
||||
*/
|
||||
enum bearer_switch_requester_source {
|
||||
XPAN_BLE_SWITCH_REQUESTER_CONNECT,
|
||||
XPAN_BLE_SWITCH_REQUESTER_CSA,
|
||||
XPAN_BLE_SWITCH_REQUESTER_FW,
|
||||
XPAN_BLE_SWITCH_REQUESTER_MAX,
|
||||
enum bearer_switch_req_type {
|
||||
WLAN_BS_REQ_TO_WLAN = 0,
|
||||
WLAN_BS_REQ_TO_NON_WLAN = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum bearer_switch_req_source: Bearer switch requester source
|
||||
* @BEARER_SWITCH_REQ_CONNECT: Bearer switch requester is connect
|
||||
* @BEARER_SWITCH_REQ_CSA: Bearer switch requester is CSA
|
||||
* @BEARER_SWITCH_REQ_FW: Bearer switch requester is FW
|
||||
* @BEARER_SWITCH_REQ_MAX: Indicates MAX bearer switch requester
|
||||
*/
|
||||
enum bearer_switch_req_source {
|
||||
BEARER_SWITCH_REQ_CONNECT,
|
||||
BEARER_SWITCH_REQ_CSA,
|
||||
BEARER_SWITCH_REQ_FW,
|
||||
BEARER_SWITCH_REQ_MAX,
|
||||
};
|
||||
|
||||
/**
|
||||
* typedef requester_callback() - Callback function, which will be invoked with
|
||||
* the bearer switch request status.
|
||||
* @psoc: Psoc pointer
|
||||
* @request_id: Request ID
|
||||
* @status: Status of the bearer switch request
|
||||
* @request_params: Request params for the bearer switch request
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
* typedef bearer_switch_requester_cb() - Callback function, which will
|
||||
* be invoked with the bearer switch request status.
|
||||
* @psoc: Psoc pointer
|
||||
* @request_id: Request ID
|
||||
* @status: Status of the bearer switch request
|
||||
* @req_value: Request value for the bearer switch request
|
||||
* @request_params: Request params for the bearer switch request
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
typedef void (*bearer_switch_requester_cb)(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t vdev_id,
|
||||
wlan_bs_req_id request_id,
|
||||
QDF_STATUS status,
|
||||
uint32_t req_value,
|
||||
void *request_params);
|
||||
|
||||
typedef void (*requester_callback)(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t vdev_id, uint32_t request_id,
|
||||
QDF_STATUS status,
|
||||
void *request_params);
|
||||
/**
|
||||
* struct wlan_bearer_switch_request - Data structure to store the bearer switch
|
||||
* request
|
||||
* @vdev_id: Vdev id of the requester
|
||||
* @request_id: Unique value to identify the request
|
||||
* @req_type: Type of the request, bearer switch to wlan or bearer switch
|
||||
* to non-wlan
|
||||
* @source: Bearer switch request source
|
||||
* @requester_cb: Callback which needs to be invoked to indicate the status of
|
||||
* the request to the requester, this callback will be passed by the requester
|
||||
* when requester will send the request.
|
||||
* @arg_value: argument value passed by requester, this will be returned back
|
||||
* in the callback
|
||||
* @arg: Argument passed by requester, this will be returned back in the
|
||||
* callback
|
||||
*/
|
||||
struct wlan_bearer_switch_request {
|
||||
uint8_t vdev_id;
|
||||
wlan_bs_req_id request_id;
|
||||
enum bearer_switch_req_type req_type;
|
||||
enum bearer_switch_req_source source;
|
||||
bearer_switch_requester_cb requester_cb;
|
||||
uint32_t arg_value;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
#endif /* _WLAN_LL_LT_SAP_BEARER_SWITCH_PUBLIC_STRUCTS_H_ */
|
||||
|
@@ -18,7 +18,16 @@
|
||||
#include <../../core/src/wlan_ll_lt_sap_bearer_switch.h>
|
||||
#include <../../core/src/wlan_ll_lt_sap_main.h>
|
||||
|
||||
uint32_t wlan_ll_lt_sap_bearer_switch_get_id(struct wlan_objmgr_vdev *vdev)
|
||||
wlan_bs_req_id
|
||||
wlan_ll_lt_sap_bearer_switch_get_id(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
return ll_lt_sap_bearer_switch_get_id(vdev);
|
||||
return ll_lt_sap_bearer_switch_get_id(psoc);
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_ll_lt_sap_switch_bearer_to_ble(struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_bearer_switch_request *bs_request)
|
||||
{
|
||||
return ll_lt_sap_switch_bearer_to_ble(psoc, bs_request);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user