qcacmn: Remove CDS related functions in HTC
Clean up CDS related functions so that HTC layer can be converged. Also add compilation flag for runtime PM APIs. Change-Id: I4c4a06b4387c8cc3f9b41d0191f46d7fa1b0a0b4 CRs-fixed: 982024
This commit is contained in:
112
htc/htc.c
112
htc/htc.c
@@ -25,15 +25,11 @@
|
|||||||
* to the Linux Foundation.
|
* to the Linux Foundation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ol_if_athvar.h"
|
|
||||||
#include "htc_debug.h"
|
#include "htc_debug.h"
|
||||||
#include "htc_internal.h"
|
#include "htc_internal.h"
|
||||||
#include <qdf_nbuf.h> /* qdf_nbuf_t */
|
#include <qdf_nbuf.h> /* qdf_nbuf_t */
|
||||||
#include <qdf_types.h> /* qdf_print */
|
#include <qdf_types.h> /* qdf_print */
|
||||||
#include <hif.h>
|
#include <hif.h>
|
||||||
#include "epping_main.h"
|
|
||||||
#include "cds_concurrency.h"
|
|
||||||
#include <cds_api.h>
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static ATH_DEBUG_MASK_DESCRIPTION g_htc_debug_description[] = {
|
static ATH_DEBUG_MASK_DESCRIPTION g_htc_debug_description[] = {
|
||||||
@@ -190,8 +186,58 @@ static void htc_cleanup(HTC_TARGET *target)
|
|||||||
qdf_mem_free(target);
|
qdf_mem_free(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FEATURE_RUNTIME_PM
|
||||||
|
/**
|
||||||
|
* htc_runtime_pm_init(): runtime pm related intialization
|
||||||
|
*
|
||||||
|
* need to initialize a work item.
|
||||||
|
*/
|
||||||
|
static void htc_runtime_pm_init(HTC_TARGET *target)
|
||||||
|
{
|
||||||
|
qdf_create_work(0, &target->queue_kicker, htc_kick_queues, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* htc_runtime_suspend() - runtime suspend HTC
|
||||||
|
*
|
||||||
|
* @htc_ctx: HTC context pointer
|
||||||
|
*
|
||||||
|
* This is a dummy function for symmetry.
|
||||||
|
*
|
||||||
|
* Return: 0 for success
|
||||||
|
*/
|
||||||
|
int htc_runtime_suspend(HTC_HANDLE htc_ctx)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* htc_runtime_resume(): resume htc
|
||||||
|
*
|
||||||
|
* The htc message queue needs to be kicked off after
|
||||||
|
* a runtime resume. Otherwise messages would get stuck.
|
||||||
|
*
|
||||||
|
* @htc_ctx: HTC context pointer
|
||||||
|
*
|
||||||
|
* Return: 0 for success;
|
||||||
|
*/
|
||||||
|
int htc_runtime_resume(HTC_HANDLE htc_ctx)
|
||||||
|
{
|
||||||
|
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_ctx);
|
||||||
|
|
||||||
|
if (target == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
qdf_sched_work(0, &target->queue_kicker);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline void htc_runtime_pm_init(HTC_TARGET *target) { }
|
||||||
|
#endif
|
||||||
|
|
||||||
/* registered target arrival callback from the HIF layer */
|
/* registered target arrival callback from the HIF layer */
|
||||||
HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev)
|
HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
|
||||||
|
uint32_t con_mode)
|
||||||
{
|
{
|
||||||
struct hif_msg_callbacks htcCallbacks;
|
struct hif_msg_callbacks htcCallbacks;
|
||||||
HTC_ENDPOINT *pEndpoint = NULL;
|
HTC_ENDPOINT *pEndpoint = NULL;
|
||||||
@@ -224,6 +270,7 @@ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev)
|
|||||||
A_MEMCPY(&target->HTCInitInfo, pInfo, sizeof(HTC_INIT_INFO));
|
A_MEMCPY(&target->HTCInitInfo, pInfo, sizeof(HTC_INIT_INFO));
|
||||||
target->host_handle = pInfo->pContext;
|
target->host_handle = pInfo->pContext;
|
||||||
target->osdev = osdev;
|
target->osdev = osdev;
|
||||||
|
target->con_mode = con_mode;
|
||||||
|
|
||||||
reset_endpoint_states(target);
|
reset_endpoint_states(target);
|
||||||
|
|
||||||
@@ -337,7 +384,7 @@ A_STATUS htc_setup_target_buffer_assignments(HTC_TARGET *target)
|
|||||||
pEntry->service_id = WMI_CONTROL_SVC;
|
pEntry->service_id = WMI_CONTROL_SVC;
|
||||||
pEntry->CreditAllocation = credits;
|
pEntry->CreditAllocation = credits;
|
||||||
|
|
||||||
if (WLAN_IS_EPPING_ENABLED(cds_get_conparam())) {
|
if (HTC_IS_EPPING_ENABLED(target->con_mode)) {
|
||||||
/* endpoint ping is a testing tool directly on top of HTC in
|
/* endpoint ping is a testing tool directly on top of HTC in
|
||||||
* both target and host sides.
|
* both target and host sides.
|
||||||
* In target side, the endppint ping fw has no wlan stack and the
|
* In target side, the endppint ping fw has no wlan stack and the
|
||||||
@@ -682,59 +729,6 @@ void htc_stop(HTC_HANDLE HTCHandle)
|
|||||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_stop\n"));
|
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_stop\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* htc_runtime_pm_init(): runtime pm related intialization
|
|
||||||
*
|
|
||||||
* need to initialize a work item.
|
|
||||||
*/
|
|
||||||
void htc_runtime_pm_init(HTC_TARGET *target)
|
|
||||||
{
|
|
||||||
qdf_create_work(0, &target->queue_kicker, htc_kick_queues, target);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* htc_runtime_suspend(): ensure htc is ready to suspend
|
|
||||||
*
|
|
||||||
* htc is ready to suspend if there are no pending pactets
|
|
||||||
* in the txrx queues.
|
|
||||||
*
|
|
||||||
* Return: 0 on success or -EBUSY if there are queued packets.
|
|
||||||
*/
|
|
||||||
int htc_runtime_suspend(void)
|
|
||||||
{
|
|
||||||
ol_txrx_pdev_handle txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
|
|
||||||
|
|
||||||
if (txrx_pdev == NULL) {
|
|
||||||
HTC_ERROR("%s: txrx context null", __func__);
|
|
||||||
return QDF_STATUS_E_FAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ol_txrx_get_tx_pending(txrx_pdev))
|
|
||||||
return -EBUSY;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* htc_runtime_resume(): resume htc
|
|
||||||
*
|
|
||||||
* The htc message queue needs to be kicked off after
|
|
||||||
* a runtime resume. Otherwise messages would get stuck.
|
|
||||||
*
|
|
||||||
* Return: 0 for success;
|
|
||||||
*/
|
|
||||||
int htc_runtime_resume(void)
|
|
||||||
{
|
|
||||||
HTC_HANDLE htc_ctx = cds_get_context(QDF_MODULE_ID_HTC);
|
|
||||||
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_ctx);
|
|
||||||
|
|
||||||
if (target == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
qdf_sched_work(0, &target->queue_kicker);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void htc_dump_credit_states(HTC_HANDLE HTCHandle)
|
void htc_dump_credit_states(HTC_HANDLE HTCHandle)
|
||||||
{
|
{
|
||||||
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
|
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
|
||||||
|
@@ -290,16 +290,18 @@ typedef struct _HTC_ENDPOINT_STATS {
|
|||||||
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@desc: Create an instance of HTC over the underlying HIF device
|
@desc: Create an instance of HTC over the underlying HIF device
|
||||||
@function name: htc_create
|
@function name: htc_create
|
||||||
@input: HifDevice - hif device handle,
|
@input: HifDevice - hif device handle,
|
||||||
pInfo - initialization information
|
pInfo - initialization information
|
||||||
|
osdev - QDF device structure
|
||||||
|
con_mode - driver connection mode
|
||||||
@output:
|
@output:
|
||||||
@return: HTC_HANDLE on success, NULL on failure
|
@return: HTC_HANDLE on success, NULL on failure
|
||||||
@notes:
|
@notes:
|
||||||
@example:
|
@example:
|
||||||
@see also: htc_destroy
|
@see also: htc_destroy
|
||||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||||
HTC_HANDLE htc_create(void *HifDevice,
|
HTC_HANDLE htc_create(void *HifDevice, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
|
||||||
HTC_INIT_INFO *pInfo, qdf_device_t osdev);
|
uint32_t con_mode);
|
||||||
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@desc: Get the underlying HIF device handle
|
@desc: Get the underlying HIF device handle
|
||||||
@function name: htc_get_hif_device
|
@function name: htc_get_hif_device
|
||||||
@@ -702,8 +704,10 @@ do { \
|
|||||||
void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle, int *credit);
|
void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle, int *credit);
|
||||||
void htc_dump_counter_info(HTC_HANDLE HTCHandle);
|
void htc_dump_counter_info(HTC_HANDLE HTCHandle);
|
||||||
void *htc_get_targetdef(HTC_HANDLE htc_handle);
|
void *htc_get_targetdef(HTC_HANDLE htc_handle);
|
||||||
int htc_runtime_suspend(void);
|
#ifdef FEATURE_RUNTIME_PM
|
||||||
int htc_runtime_resume(void);
|
int htc_runtime_suspend(HTC_HANDLE htc_ctx);
|
||||||
|
int htc_runtime_resume(HTC_HANDLE htc_ctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Disable ASPM : Disable PCIe low power */
|
/* Disable ASPM : Disable PCIe low power */
|
||||||
bool htc_can_suspend_link(HTC_HANDLE HTCHandle);
|
bool htc_can_suspend_link(HTC_HANDLE HTCHandle);
|
||||||
|
@@ -78,6 +78,8 @@ extern "C" {
|
|||||||
|
|
||||||
#define HTC_CREDIT_HISTORY_MAX 1024
|
#define HTC_CREDIT_HISTORY_MAX 1024
|
||||||
|
|
||||||
|
#define HTC_IS_EPPING_ENABLED(_x) ((_x) == QDF_GLOBAL_EPPING_MODE)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
HTC_REQUEST_CREDIT,
|
HTC_REQUEST_CREDIT,
|
||||||
HTC_PROCESS_CREDIT_REPORT,
|
HTC_PROCESS_CREDIT_REPORT,
|
||||||
@@ -183,6 +185,7 @@ typedef struct _HTC_TARGET {
|
|||||||
A_UINT32 TX_comp_cnt;
|
A_UINT32 TX_comp_cnt;
|
||||||
A_UINT8 MaxMsgsPerHTCBundle;
|
A_UINT8 MaxMsgsPerHTCBundle;
|
||||||
qdf_work_t queue_kicker;
|
qdf_work_t queue_kicker;
|
||||||
|
uint32_t con_mode;
|
||||||
} HTC_TARGET;
|
} HTC_TARGET;
|
||||||
|
|
||||||
#define HTC_ENABLE_BUNDLE(target) (target->MaxMsgsPerHTCBundle > 1)
|
#define HTC_ENABLE_BUNDLE(target) (target->MaxMsgsPerHTCBundle > 1)
|
||||||
@@ -250,8 +253,9 @@ void htc_process_credit_rpt(HTC_TARGET *target,
|
|||||||
int NumEntries, HTC_ENDPOINT_ID FromEndpoint);
|
int NumEntries, HTC_ENDPOINT_ID FromEndpoint);
|
||||||
void htc_fw_event_handler(void *context, QDF_STATUS status);
|
void htc_fw_event_handler(void *context, QDF_STATUS status);
|
||||||
void htc_send_complete_check_cleanup(void *context);
|
void htc_send_complete_check_cleanup(void *context);
|
||||||
void htc_runtime_pm_init(HTC_TARGET *target);
|
#ifdef FEATURE_RUNTIME_PM
|
||||||
void htc_kick_queues(void *context);
|
void htc_kick_queues(void *context);
|
||||||
|
#endif
|
||||||
|
|
||||||
void htc_credit_record(htc_credit_exchange_type type, uint32_t tx_credit,
|
void htc_credit_record(htc_credit_exchange_type type, uint32_t tx_credit,
|
||||||
uint32_t htc_tx_queue_depth);
|
uint32_t htc_tx_queue_depth);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
|
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||||
*
|
*
|
||||||
@@ -27,9 +27,7 @@
|
|||||||
|
|
||||||
#include "htc_debug.h"
|
#include "htc_debug.h"
|
||||||
#include "htc_internal.h"
|
#include "htc_internal.h"
|
||||||
#include "cds_api.h"
|
|
||||||
#include <qdf_nbuf.h> /* qdf_nbuf_t */
|
#include <qdf_nbuf.h> /* qdf_nbuf_t */
|
||||||
#include "epping_main.h"
|
|
||||||
|
|
||||||
/* HTC Control message receive timeout msec */
|
/* HTC Control message receive timeout msec */
|
||||||
#define HTC_CONTROL_RX_TIMEOUT 3000
|
#define HTC_CONTROL_RX_TIMEOUT 3000
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
#include "htc_internal.h"
|
#include "htc_internal.h"
|
||||||
#include <qdf_nbuf.h> /* qdf_nbuf_t */
|
#include <qdf_nbuf.h> /* qdf_nbuf_t */
|
||||||
#include <qdf_mem.h> /* qdf_mem_malloc */
|
#include <qdf_mem.h> /* qdf_mem_malloc */
|
||||||
#include "epping_main.h"
|
|
||||||
|
|
||||||
/* #define USB_HIF_SINGLE_PIPE_DATA_SCHED */
|
/* #define USB_HIF_SINGLE_PIPE_DATA_SCHED */
|
||||||
/* #ifdef USB_HIF_SINGLE_PIPE_DATA_SCHED */
|
/* #ifdef USB_HIF_SINGLE_PIPE_DATA_SCHED */
|
||||||
@@ -1788,6 +1787,7 @@ void htc_tx_resource_avail_handler(void *context, A_UINT8 pipeID)
|
|||||||
htc_try_send(target, pEndpoint, NULL);
|
htc_try_send(target, pEndpoint, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FEATURE_RUNTIME_PM
|
||||||
/**
|
/**
|
||||||
* htc_kick_queues(): resumes tx transactions of suspended endpoints
|
* htc_kick_queues(): resumes tx transactions of suspended endpoints
|
||||||
* @context: pointer to the htc target context
|
* @context: pointer to the htc target context
|
||||||
@@ -1816,6 +1816,7 @@ void htc_kick_queues(void *context)
|
|||||||
htc_try_send(target, endpoint, NULL);
|
htc_try_send(target, endpoint, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* flush endpoint TX queue */
|
/* flush endpoint TX queue */
|
||||||
void htc_flush_endpoint_tx(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint,
|
void htc_flush_endpoint_tx(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint,
|
||||||
|
Reference in New Issue
Block a user