From ec9e71c33b7481c06a4c5f7a237109cab91fae43 Mon Sep 17 00:00:00 2001 From: Yue Ma Date: Fri, 26 Feb 2016 18:52:20 -0800 Subject: [PATCH] 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 --- htc/htc.c | 112 +++++++++++++++++++++------------------------ htc/htc_api.h | 16 ++++--- htc/htc_internal.h | 6 ++- htc/htc_recv.c | 4 +- htc/htc_send.c | 3 +- 5 files changed, 71 insertions(+), 70 deletions(-) diff --git a/htc/htc.c b/htc/htc.c index 8d07d218fb..f282c02813 100644 --- a/htc/htc.c +++ b/htc/htc.c @@ -25,15 +25,11 @@ * to the Linux Foundation. */ -#include "ol_if_athvar.h" #include "htc_debug.h" #include "htc_internal.h" #include /* qdf_nbuf_t */ #include /* qdf_print */ #include -#include "epping_main.h" -#include "cds_concurrency.h" -#include #ifdef DEBUG static ATH_DEBUG_MASK_DESCRIPTION g_htc_debug_description[] = { @@ -190,8 +186,58 @@ static void htc_cleanup(HTC_TARGET *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 */ -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; 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)); target->host_handle = pInfo->pContext; target->osdev = osdev; + target->con_mode = con_mode; 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->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 * both target and host sides. * 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")); } -/** - * 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) { HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); diff --git a/htc/htc_api.h b/htc/htc_api.h index 6f922c6133..998a013f3d 100644 --- a/htc/htc_api.h +++ b/htc/htc_api.h @@ -290,16 +290,18 @@ typedef struct _HTC_ENDPOINT_STATS { /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @desc: Create an instance of HTC over the underlying HIF device @function name: htc_create - @input: HifDevice - hif device handle, - pInfo - initialization information + @input: HifDevice - hif device handle, + pInfo - initialization information + osdev - QDF device structure + con_mode - driver connection mode @output: @return: HTC_HANDLE on success, NULL on failure @notes: @example: @see also: htc_destroy +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -HTC_HANDLE htc_create(void *HifDevice, - HTC_INIT_INFO *pInfo, qdf_device_t osdev); +HTC_HANDLE htc_create(void *HifDevice, HTC_INIT_INFO *pInfo, qdf_device_t osdev, + uint32_t con_mode); /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @desc: Get the underlying HIF device handle @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_dump_counter_info(HTC_HANDLE HTCHandle); void *htc_get_targetdef(HTC_HANDLE htc_handle); -int htc_runtime_suspend(void); -int htc_runtime_resume(void); +#ifdef FEATURE_RUNTIME_PM +int htc_runtime_suspend(HTC_HANDLE htc_ctx); +int htc_runtime_resume(HTC_HANDLE htc_ctx); +#endif /* Disable ASPM : Disable PCIe low power */ bool htc_can_suspend_link(HTC_HANDLE HTCHandle); diff --git a/htc/htc_internal.h b/htc/htc_internal.h index 36bc1518ef..29f2a1cc10 100644 --- a/htc/htc_internal.h +++ b/htc/htc_internal.h @@ -78,6 +78,8 @@ extern "C" { #define HTC_CREDIT_HISTORY_MAX 1024 +#define HTC_IS_EPPING_ENABLED(_x) ((_x) == QDF_GLOBAL_EPPING_MODE) + typedef enum { HTC_REQUEST_CREDIT, HTC_PROCESS_CREDIT_REPORT, @@ -183,6 +185,7 @@ typedef struct _HTC_TARGET { A_UINT32 TX_comp_cnt; A_UINT8 MaxMsgsPerHTCBundle; qdf_work_t queue_kicker; + uint32_t con_mode; } HTC_TARGET; #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); void htc_fw_event_handler(void *context, QDF_STATUS status); 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); +#endif void htc_credit_record(htc_credit_exchange_type type, uint32_t tx_credit, uint32_t htc_tx_queue_depth); diff --git a/htc/htc_recv.c b/htc/htc_recv.c index f05d69fd1d..00b836d4fa 100644 --- a/htc/htc_recv.c +++ b/htc/htc_recv.c @@ -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. * @@ -27,9 +27,7 @@ #include "htc_debug.h" #include "htc_internal.h" -#include "cds_api.h" #include /* qdf_nbuf_t */ -#include "epping_main.h" /* HTC Control message receive timeout msec */ #define HTC_CONTROL_RX_TIMEOUT 3000 diff --git a/htc/htc_send.c b/htc/htc_send.c index 6a57416877..9466adefeb 100644 --- a/htc/htc_send.c +++ b/htc/htc_send.c @@ -29,7 +29,6 @@ #include "htc_internal.h" #include /* qdf_nbuf_t */ #include /* qdf_mem_malloc */ -#include "epping_main.h" /* #define 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); } +#ifdef FEATURE_RUNTIME_PM /** * htc_kick_queues(): resumes tx transactions of suspended endpoints * @context: pointer to the htc target context @@ -1816,6 +1816,7 @@ void htc_kick_queues(void *context) htc_try_send(target, endpoint, NULL); } } +#endif /* flush endpoint TX queue */ void htc_flush_endpoint_tx(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint,