qcacld-3.0: HDD: Use PLD APIs (Part 2)

Replace CNSS/ICNSS APIs with PLD APIs for PCIE/SNOC.
SDIO/USB changes need to be done separately by adding
SDIO/USB support in PLD

Change-Id: I0d2446e57922254369b7e7ca69d900006f7a7e28
CRs-Fixed: 1000113
This commit is contained in:
Yuanyuan Liu 2016-04-06 17:41:37 -07:00 • committed by Gerrit - the friendly Code Review server
commit 1373850b01
5 changed files with 67 additions and 140 deletions

View file

@ -335,13 +335,13 @@ extern spinlock_t hdd_context_lock;
* @interval_tx: # of tx packets received in the last 100ms interval
* @total_rx: # of total rx packets received on interface
* @total_tx: # of total tx packets received on interface
* @next_vote_level: cnss_bus_width_type voting level (high or low)
* @next_vote_level: pld_bus_width_type voting level (high or low)
* determined on the basis of total tx and rx packets
* received in the last 100ms interval
* @next_rx_level: cnss_bus_width_type voting level (high or low)
* @next_rx_level: pld_bus_width_type voting level (high or low)
* determined on the basis of rx packets received in the
* last 100ms interval
* @next_tx_level: cnss_bus_width_type voting level (high or low)
* @next_tx_level: pld_bus_width_type voting level (high or low)
* determined on the basis of tx packets received in the
* last 100ms interval
*

View file

@ -30,13 +30,6 @@
#include <linux/platform_device.h>
#include <linux/pci.h>
#ifdef HIF_PCI
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif /* CONFIG_CNSS */
#else
#include <soc/qcom/icnss.h>
#endif /* HIF_PCI */
#include "cds_api.h"
#include "qdf_status.h"
#include "qdf_lock.h"
@ -71,25 +64,16 @@
* The delay incurred for resuming from IDLE/SA PS is huge during driver load.
* So prevent APPS IDLE/SA PS durint driver load for reducing interrupt latency.
*/
#ifdef CONFIG_CNSS
static inline void hdd_request_pm_qos(int val)
static inline void hdd_request_pm_qos(struct device *dev, int val)
{
cnss_request_pm_qos(val);
pld_request_pm_qos(dev, val);
}
static inline void hdd_remove_pm_qos(void)
static inline void hdd_remove_pm_qos(struct device *dev)
{
cnss_remove_pm_qos();
pld_remove_pm_qos(dev);
}
#else
static inline void hdd_request_pm_qos(int val)
{
}
static inline void hdd_remove_pm_qos(void)
{
}
#endif
/**
* hdd_set_recovery_in_progress() - API to set recovery in progress
@ -346,7 +330,7 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
* The Fix is to not allow Krait to enter Idle Power Save during driver
* load.
*/
hdd_request_pm_qos(DISABLE_KRAIT_IDLE_PS_VAL);
hdd_request_pm_qos(dev, DISABLE_KRAIT_IDLE_PS_VAL);
if (reinit) {
cds_set_recovery_in_progress(true);
@ -399,7 +383,7 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
}
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
hdd_remove_pm_qos();
hdd_remove_pm_qos(dev);
return 0;
@ -415,19 +399,14 @@ err_hdd_deinit:
hdd_deinit();
out:
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
hdd_remove_pm_qos();
hdd_remove_pm_qos(dev);
return ret;
}
#ifdef CONFIG_CNSS
static inline void hdd_cnss_driver_unloading(void)
static inline void hdd_pld_driver_unloading(struct device *dev)
{
cnss_set_driver_status(CNSS_LOAD_UNLOAD);
pld_set_driver_status(dev, PLD_LOAD_UNLOAD);
}
#else
static inline void hdd_cnss_driver_unloading(void) { }
#endif
/**
* wlan_hdd_remove() - wlan_hdd_remove
@ -437,7 +416,7 @@ static inline void hdd_cnss_driver_unloading(void) { }
*
* Return: void
*/
static void wlan_hdd_remove(void)
static void wlan_hdd_remove(struct device *dev)
{
void *hif_ctx;
@ -456,7 +435,7 @@ static void wlan_hdd_remove(void)
if (!cds_wait_for_external_threads_completion(__func__))
hdd_err("External threads are still active attempting driver unload anyway");
hdd_cnss_driver_unloading();
hdd_pld_driver_unloading(dev);
hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
@ -492,7 +471,7 @@ static void wlan_hdd_shutdown(void)
hdd_err("Load/unload in progress, ignore SSR shutdown");
return;
}
/* this is for cases, where shutdown invoked from CNSS */
/* this is for cases, where shutdown invoked from platform */
cds_set_recovery_in_progress(true);
if (!cds_wait_for_external_threads_completion(__func__))
@ -680,7 +659,7 @@ static int wlan_hdd_bus_resume(void)
*
* Return: 0 or errno
*/
static int __wlan_hdd_runtime_suspend(void)
static int __wlan_hdd_runtime_suspend(struct device *dev)
{
void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
@ -711,7 +690,7 @@ static int __wlan_hdd_runtime_suspend(void)
if (status)
goto resume_wma;
status = cnss_auto_suspend();
status = pld_auto_suspend(dev);
if (status)
goto resume_hif;
@ -740,12 +719,12 @@ process_failure:
*
* Return: 0 or errno
*/
static int wlan_hdd_runtime_suspend(void)
static int wlan_hdd_runtime_suspend(struct device *dev)
{
int ret;
cds_ssr_protect(__func__);
ret = __wlan_hdd_runtime_suspend();
ret = __wlan_hdd_runtime_suspend(dev);
cds_ssr_unprotect(__func__);
return ret;
@ -759,14 +738,14 @@ static int wlan_hdd_runtime_suspend(void)
*
* Return: success since failure is a bug
*/
static int __wlan_hdd_runtime_resume(void)
static int __wlan_hdd_runtime_resume(struct device *dev)
{
void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
void *htc_ctx = cds_get_context(QDF_MODULE_ID_HTC);
void *txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
hif_pre_runtime_resume(hif_ctx);
QDF_BUG(!cnss_auto_resume());
QDF_BUG(!pld_auto_resume(dev));
QDF_BUG(!hif_runtime_resume(hif_ctx));
QDF_BUG(!wma_runtime_resume());
QDF_BUG(!htc_runtime_resume(htc_ctx));
@ -783,12 +762,12 @@ static int __wlan_hdd_runtime_resume(void)
*
* Return: success since failure is a bug
*/
static int wlan_hdd_runtime_resume(void)
static int wlan_hdd_runtime_resume(struct device *dev)
{
int ret;
cds_ssr_protect(__func__);
ret = __wlan_hdd_runtime_resume();
ret = __wlan_hdd_runtime_resume(dev);
cds_ssr_unprotect(__func__);
return ret;
@ -830,7 +809,7 @@ static int wlan_hdd_pld_probe(struct device *dev,
static void wlan_hdd_pld_remove(struct device *dev,
enum pld_bus_type bus_type)
{
wlan_hdd_remove();
wlan_hdd_remove(dev);
}
/**
@ -939,7 +918,7 @@ static void wlan_hdd_pld_notify_handler(struct device *dev,
static int wlan_hdd_pld_runtime_suspend(struct device *dev,
enum pld_bus_type bus_type)
{
return wlan_hdd_runtime_suspend();
return wlan_hdd_runtime_suspend(dev);
}
/**
@ -952,7 +931,7 @@ static int wlan_hdd_pld_runtime_suspend(struct device *dev,
static int wlan_hdd_pld_runtime_resume(struct device *dev,
enum pld_bus_type bus_type)
{
return wlan_hdd_runtime_resume();
return wlan_hdd_runtime_resume(dev);
}
#endif

View file

@ -62,9 +62,7 @@
#include "wni_cfg.h"
#include "wlan_hdd_misc.h"
#include <cds_utils.h>
#if defined CONFIG_CNSS
#include <net/cnss.h>
#endif
#include "pld_common.h"
#include "wma.h"
#ifdef DEBUG
@ -899,9 +897,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
uint8_t cc_len = WLAN_SVC_COUNTRY_CODE_LEN;
hdd_adapter_t *con_sap_adapter;
QDF_STATUS status = QDF_STATUS_SUCCESS;
#if defined CONFIG_CNSS
int ret = 0;
#endif
dev = (struct net_device *)usrDataForCallback;
if (!dev) {
@ -1771,47 +1767,37 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
case eSAP_DFS_NOL_GET:
hddLog(LOG1,
FL("Received eSAP_DFS_NOL_GET event"));
#if defined CONFIG_CNSS
/* get the dfs nol from cnss */
ret =
cnss_wlan_get_dfs_nol(pSapEvent->sapevt.sapDfsNolInfo.
pDfsList,
pSapEvent->sapevt.sapDfsNolInfo.
sDfsList);
/* get the dfs nol from PLD */
ret = pld_wlan_get_dfs_nol(pHddCtx->parent_dev,
pSapEvent->sapevt.sapDfsNolInfo.
pDfsList,
pSapEvent->sapevt.sapDfsNolInfo.
sDfsList);
if (ret > 0) {
hddLog(LOG2,
FL("Get %d bytes of dfs nol from cnss"), ret);
hdd_info("Get %d bytes of dfs nol from PLD", ret);
return QDF_STATUS_SUCCESS;
} else {
hddLog(LOG2,
FL("No dfs nol entry in CNSS, ret: %d"), ret);
hdd_info("No dfs nol entry in PLD, ret: %d", ret);
return QDF_STATUS_E_FAULT;
}
#else
return QDF_STATUS_E_FAILURE;
#endif
case eSAP_DFS_NOL_SET:
hddLog(LOG1, FL("Received eSAP_DFS_NOL_SET event"));
#if defined CONFIG_CNSS
/* set the dfs nol to cnss */
ret =
cnss_wlan_set_dfs_nol(pSapEvent->sapevt.sapDfsNolInfo.
pDfsList,
pSapEvent->sapevt.sapDfsNolInfo.
sDfsList);
/* set the dfs nol to PLD */
ret = pld_wlan_set_dfs_nol(pHddCtx->parent_dev,
pSapEvent->sapevt.sapDfsNolInfo.
pDfsList,
pSapEvent->sapevt.sapDfsNolInfo.
sDfsList);
if (ret) {
hddLog(LOG2,
FL("Failed to set dfs nol - ret: %d"),
ret);
hdd_info("Failed to set dfs nol - ret: %d", ret);
} else {
hddLog(LOG2, FL(" Set %d bytes dfs nol to cnss"),
pSapEvent->sapevt.sapDfsNolInfo.sDfsList);
hdd_info(" Set %d bytes dfs nol to PLD",
pSapEvent->sapevt.sapDfsNolInfo.sDfsList);
}
#else
return QDF_STATUS_E_FAILURE;
#endif
return QDF_STATUS_SUCCESS;
case eSAP_ACS_CHANNEL_SELECTED:
hddLog(LOG1, FL("ACS Completed for wlan%d"),

View file

@ -74,10 +74,8 @@
#include <linux/ctype.h>
#include <linux/compat.h>
#ifdef MSM_PLATFORM
#ifdef CONFIG_CNSS
#include <soc/qcom/subsystem_restart.h>
#endif
#endif
#include <wlan_hdd_hostapd.h>
#include <wlan_hdd_softap_tx_rx.h>
#include "cfg_api.h"
@ -85,9 +83,6 @@
#include "wma_types.h"
#include "wlan_hdd_tdls.h"
#ifdef FEATURE_WLAN_CH_AVOID
#ifdef CONFIG_CNSS
#include <net/cnss.h>
#endif
#include "cds_regdomain.h"
#include "cdp_txrx_flow_ctrl_v2.h"
#endif /* FEATURE_WLAN_CH_AVOID */
@ -105,7 +100,6 @@
#include "cds_concurrency.h"
#include "wlan_hdd_tsf.h"
#include "wlan_hdd_green_ap.h"
#include "platform_icnss.h"
#include "bmi.h"
#include <wlan_hdd_regulatory.h>
@ -2115,23 +2109,6 @@ static QDF_STATUS hdd_sme_close_session_callback(void *pContext)
clear_bit(SME_SESSION_OPENED, &adapter->event_flags);
#if !defined (CONFIG_CNSS) && \
!defined (WLAN_OPEN_SOURCE)
/*
* need to make sure all of our scheduled work has completed.
* This callback is called from MC thread context, so it is safe to
* to call below flush workqueue API from here.
*
* Even though this is called from MC thread context, if there is a faulty
* work item in the system, that can hang this call forever. So flushing
* this global work queue is not safe; and now we make sure that
* individual work queues are stopped correctly. But the cancel work queue
* is a GPL only API, so the proprietary version of the driver would still
* rely on the global work queue flush.
*/
flush_scheduled_work();
#endif
/*
* We can be blocked while waiting for scheduled work to be
* flushed, and the adapter structure can potentially be freed, in
@ -4584,7 +4561,7 @@ static int hdd_wiphy_init(hdd_context_t *hdd_ctx)
}
/**
* hdd_cnss_request_bus_bandwidth() - Function to control bus bandwidth
* hdd_pld_request_bus_bandwidth() - Function to control bus bandwidth
* @hdd_ctx - handle to hdd context
* @tx_packets - transmit packet count
* @rx_packets - receive packet count
@ -4595,26 +4572,25 @@ static int hdd_wiphy_init(hdd_context_t *hdd_ctx)
* Returns: None
*/
#ifdef MSM_PLATFORM
void hdd_cnss_request_bus_bandwidth(hdd_context_t *hdd_ctx,
void hdd_pld_request_bus_bandwidth(hdd_context_t *hdd_ctx,
const uint64_t tx_packets, const uint64_t rx_packets)
{
#ifdef CONFIG_CNSS
uint64_t total = tx_packets + rx_packets;
uint64_t temp_rx = 0;
uint64_t temp_tx = 0;
enum cnss_bus_width_type next_vote_level = CNSS_BUS_WIDTH_NONE;
enum pld_bus_width_type next_vote_level = PLD_BUS_WIDTH_NONE;
enum wlan_tp_level next_rx_level = WLAN_SVC_TP_NONE;
enum wlan_tp_level next_tx_level = WLAN_SVC_TP_NONE;
if (total > hdd_ctx->config->busBandwidthHighThreshold)
next_vote_level = CNSS_BUS_WIDTH_HIGH;
next_vote_level = PLD_BUS_WIDTH_HIGH;
else if (total > hdd_ctx->config->busBandwidthMediumThreshold)
next_vote_level = CNSS_BUS_WIDTH_MEDIUM;
next_vote_level = PLD_BUS_WIDTH_MEDIUM;
else if (total > hdd_ctx->config->busBandwidthLowThreshold)
next_vote_level = CNSS_BUS_WIDTH_LOW;
next_vote_level = PLD_BUS_WIDTH_LOW;
else
next_vote_level = CNSS_BUS_WIDTH_NONE;
next_vote_level = PLD_BUS_WIDTH_NONE;
hdd_ctx->hdd_txrx_hist[hdd_ctx->hdd_txrx_hist_idx].next_vote_level =
next_vote_level;
@ -4623,7 +4599,7 @@ void hdd_cnss_request_bus_bandwidth(hdd_context_t *hdd_ctx,
hdd_debug("trigger level %d, tx_packets: %lld, rx_packets: %lld",
next_vote_level, tx_packets, rx_packets);
hdd_ctx->cur_vote_level = next_vote_level;
cnss_request_bus_bandwidth(next_vote_level);
pld_request_bus_bandwidth(hdd_ctx->parent_dev, next_vote_level);
}
/* fine-tuning parameters for RX Flows */
@ -4674,7 +4650,6 @@ void hdd_cnss_request_bus_bandwidth(hdd_context_t *hdd_ctx,
next_tx_level;
hdd_ctx->hdd_txrx_hist_idx++;
hdd_ctx->hdd_txrx_hist_idx &= NUM_TX_RX_HISTOGRAM_MASK;
#endif
}
#define HDD_BW_GET_DIFF(_x, _y) (unsigned long)((ULONG_MAX - (_y)) + (_x) + 1)
@ -4745,7 +4720,7 @@ static void hdd_bus_bw_compute_cbk(void *priv)
return;
}
hdd_cnss_request_bus_bandwidth(hdd_ctx, tx_packets, rx_packets);
hdd_pld_request_bus_bandwidth(hdd_ctx, tx_packets, rx_packets);
hdd_ipa_set_perf_level(hdd_ctx, tx_packets, rx_packets);
hdd_ipa_uc_stat_request(adapter, 2);
@ -5026,7 +5001,7 @@ static void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
}
#endif
#if defined(FEATURE_WLAN_CH_AVOID) && defined(CONFIG_CNSS)
#if defined(FEATURE_WLAN_CH_AVOID)
/**
* hdd_set_thermal_level_cb() - set thermal level callback function
* @context: hdd context pointer
@ -5244,7 +5219,8 @@ static void hdd_ch_avoid_cb(void *hdd_context, void *indi_param)
FL("number of unsafe channels is %d "),
hdd_ctxt->unsafe_channel_count);
if (cnss_set_wlan_unsafe_channel(hdd_ctxt->unsafe_channel_list,
if (pld_set_wlan_unsafe_channel(hdd_ctxt->parent_dev,
hdd_ctxt->unsafe_channel_list,
hdd_ctxt->unsafe_channel_count)) {
hdd_err("Failed to set unsafe channel");
@ -5322,7 +5298,7 @@ static void hdd_ch_avoid_cb(void *hdd_context, void *indi_param)
* @hdd_ctx: HDD global context
*
* Initialize the channel avoidance logic by retrieving the unsafe
* channel list from the CNSS platform driver and plumbing the data
* channel list from the platform driver and plumbing the data
* down to the lower layers. Then subscribe to subsequent channel
* avoidance events.
*
@ -5333,7 +5309,8 @@ static void hdd_init_channel_avoidance(hdd_context_t *hdd_ctx)
uint16_t unsafe_channel_count;
int index;
cnss_get_wlan_unsafe_channel(hdd_ctx->unsafe_channel_list,
pld_get_wlan_unsafe_channel(hdd_ctx->parent_dev,
hdd_ctx->unsafe_channel_list,
&(hdd_ctx->unsafe_channel_count),
sizeof(uint16_t) * NUM_CHANNELS);
@ -5359,7 +5336,7 @@ static void hdd_init_channel_avoidance(hdd_context_t *hdd_ctx)
static void hdd_set_thermal_level_cb(void *context, u_int8_t level)
{
}
#endif /* defined(FEATURE_WLAN_CH_AVOID) && defined(CONFIG_CNSS) */
#endif /* defined(FEATURE_WLAN_CH_AVOID) */
/**
* hdd_indicate_mgmt_frame() - Wrapper to indicate management frame to
@ -5665,7 +5642,8 @@ hdd_context_t *hdd_context_create(struct device *dev, void *hif_sc)
hdd_ctx->target_type = tgt_info->target_type;
icnss_set_fw_debug_mode(hdd_ctx->config->enable_fw_log);
pld_set_fw_debug_mode(hdd_ctx->parent_dev,
hdd_ctx->config->enable_fw_log);
hdd_enable_fastpath(hdd_ctx->config, hif_sc);
@ -6775,19 +6753,6 @@ void wlan_hdd_send_version_pkg(uint32_t fw_version,
{
int ret = 0;
struct wlan_version_data data;
#ifdef CONFIG_CNSS
struct cnss_platform_cap cap;
ret = cnss_get_platform_cap(&cap);
if (ret) {
hddLog(QDF_TRACE_LEVEL_ERROR,
FL("platform capability info from CNSS not available"));
return;
}
if (!(cap.cap_flag & CNSS_HAS_UART_ACCESS))
return;
#endif
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
return;

View file

@ -71,6 +71,7 @@
#include "sme_power_save_api.h"
#include "cds_concurrency.h"
#include "cdp_txrx_flow_ctrl_v2.h"
#include "pld_common.h"
/* Preprocessor definitions and constants */
#define HDD_SSR_BRING_UP_TIME 30000
@ -1794,9 +1795,7 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy)
result = wlan_hdd_validate_context(pHddCtx);
if (0 != result)
return result;
#ifdef CONFIG_CNSS
cnss_request_bus_bandwidth(CNSS_BUS_WIDTH_MEDIUM);
#endif
pld_request_bus_bandwidth(pHddCtx->parent_dev, PLD_BUS_WIDTH_MEDIUM);
/* Resume MC thread */
if (pHddCtx->isMcThreadSuspended) {
@ -2065,9 +2064,7 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
NO_SESSION, pHddCtx->isWiphySuspended));
pHddCtx->isWiphySuspended = true;
#ifdef CONFIG_CNSS
cnss_request_bus_bandwidth(CNSS_BUS_WIDTH_NONE);
#endif
pld_request_bus_bandwidth(pHddCtx->parent_dev, PLD_BUS_WIDTH_NONE);
EXIT();
return 0;