qcacld-3.0: Add USB bus support (HDD)

Add HDD specific changes for USB bus support.

CRs-Fixed: 1023663
Change-Id: I572a78cd9de1f7e531f300ced69a7eb51f4a167f
This commit is contained in:
Mohit Khanna 2016-05-12 21:43:13 -07:00 • committed by qcabuildsw
commit fa99aea342
8 changed files with 174 additions and 51 deletions

View file

@ -35,7 +35,27 @@
* Originally written by Qualcomm Atheros, Inc
*/
#include <linux/ipa.h>
/**
* enum hdd_ipa_wlan_event - HDD IPA events
* @HDD_IPA_CLIENT_CONNECT: Client Connects
* @HDD_IPA_CLIENT_DISCONNECT: Client Disconnects
* @HDD_IPA_AP_CONNECT: SoftAP is started
* @HDD_IPA_AP_DISCONNECT: SoftAP is stopped
* @HDD_IPA_STA_CONNECT: STA associates to AP
* @HDD_IPA_STA_DISCONNECT: STA dissociates from AP
* @HDD_IPA_CLIENT_CONNECT_EX: Peer associates/re-associates to softap
* @HDD_IPA_WLAN_EVENT_MAX: Max value for the enum
*/
enum hdd_ipa_wlan_event {
HDD_IPA_CLIENT_CONNECT,
HDD_IPA_CLIENT_DISCONNECT,
HDD_IPA_AP_CONNECT,
HDD_IPA_AP_DISCONNECT,
HDD_IPA_STA_CONNECT,
HDD_IPA_STA_DISCONNECT,
HDD_IPA_CLIENT_CONNECT_EX,
HDD_IPA_WLAN_EVENT_MAX
};
#ifdef IPA_OFFLOAD
/* Include files */
@ -57,7 +77,7 @@ QDF_STATUS hdd_ipa_cleanup(hdd_context_t *hdd_ctx);
QDF_STATUS hdd_ipa_process_rxt(void *cds_context, qdf_nbuf_t rxBuf,
uint8_t sta_id);
int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
enum ipa_wlan_event type, uint8_t *mac_addr);
enum hdd_ipa_wlan_event type, uint8_t *mac_addr);
int hdd_ipa_set_perf_level(hdd_context_t *hdd_ctx, uint64_t tx_packets,
uint64_t rx_packets);
int hdd_ipa_suspend(hdd_context_t *hdd_ctx);
@ -92,7 +112,7 @@ static inline QDF_STATUS hdd_ipa_process_rxt(void *cds_context,
}
static inline int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
enum ipa_wlan_event type, uint8_t *mac_addr)
enum hdd_ipa_wlan_event type, uint8_t *mac_addr)
{
return 0;
}

View file

@ -1593,8 +1593,8 @@ static QDF_STATUS hdd_dis_connect_handler(hdd_adapter_t *pAdapter,
if (hdd_ipa_is_enabled(pHddCtx))
hdd_ipa_wlan_evt(pAdapter, pHddStaCtx->conn_info.staId[0],
WLAN_STA_DISCONNECT,
pHddStaCtx->conn_info.bssId.bytes);
HDD_IPA_STA_DISCONNECT,
pHddStaCtx->conn_info.bssId.bytes);
#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
wlan_hdd_auto_shutdown_enable(pHddCtx, true);
@ -2453,7 +2453,7 @@ static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter,
if (hdd_ipa_is_enabled(pHddCtx))
hdd_ipa_wlan_evt(pAdapter, pRoamInfo->staId,
WLAN_STA_CONNECT,
HDD_IPA_STA_CONNECT,
pRoamInfo->bssid.bytes);
#ifdef FEATURE_WLAN_AUTO_SHUTDOWN

View file

@ -12329,7 +12329,7 @@ int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
pAdapter->
aStaInfo[i].
ucSTAId,
WLAN_CLIENT_DISCONNECT,
HDD_IPA_CLIENT_DISCONNECT,
mac);
}
hdd_notice("Delete STA with MAC::"
@ -12373,7 +12373,7 @@ int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
if (hdd_ipa_uc_is_enabled(pHddCtx)) {
hdd_ipa_wlan_evt(pAdapter, staId,
WLAN_CLIENT_DISCONNECT, mac);
HDD_IPA_CLIENT_DISCONNECT, mac);
}
if (pAdapter->aStaInfo[staId].isDeauthInProgress ==

View file

@ -193,6 +193,8 @@ static enum qdf_bus_type to_bus_type(enum pld_bus_type bus_type)
return QDF_BUS_TYPE_SNOC;
case PLD_BUS_TYPE_SDIO:
return QDF_BUS_TYPE_SDIO;
case PLD_BUS_TYPE_USB:
return QDF_BUS_TYPE_USB;
default:
return QDF_BUS_TYPE_NONE;
}
@ -446,7 +448,7 @@ static void wlan_hdd_remove(struct device *dev)
hdd_deinit();
pr_info("%s: Driver Removed\n", WLAN_MODULE_NAME);
pr_info("%s: Driver De-initialized\n", WLAN_MODULE_NAME);
}
/**
@ -658,6 +660,25 @@ int wlan_hdd_bus_resume(void)
return ret;
}
/**
* wlan_hdd_bus_reset_resume() - resume wlan bus after reset
*
* This function is called to tell the driver that the device has been resumed
* and it has also been reset. The driver should redo any necessary
* initialization. It is mainly used by the USB bus
*
* Return: int 0 for success, non zero for failure
*/
static int wlan_hdd_bus_reset_resume(void)
{
int ret;
cds_ssr_protect(__func__);
ret = hif_bus_reset_resume(cds_get_context(QDF_MODULE_ID_HIF));
cds_ssr_unprotect(__func__);
return ret;
}
#ifdef FEATURE_RUNTIME_PM
/**
* __wlan_hdd_runtime_suspend() - suspend the wlan bus without apps suspend
@ -901,6 +922,19 @@ static int wlan_hdd_pld_resume(struct device *dev,
return wlan_hdd_bus_resume();
}
/**
* wlan_hdd_pld_reset_resume() - reset resume function registered to PLD
* @dev: device
* @pld_bus_type: PLD bus type
*
* Return: 0 on success
*/
static int wlan_hdd_pld_reset_resume(struct device *dev,
enum pld_bus_type bus_type)
{
return wlan_hdd_bus_reset_resume();
}
/**
* wlan_hdd_pld_notify_handler() - notify_handler function registered to PLD
* @dev: device
@ -952,6 +986,7 @@ struct pld_driver_ops wlan_drv_ops = {
.crash_shutdown = wlan_hdd_pld_crash_shutdown,
.suspend = wlan_hdd_pld_suspend,
.resume = wlan_hdd_pld_resume,
.reset_resume = wlan_hdd_pld_reset_resume,
.modem_status = wlan_hdd_pld_notify_handler,
#ifdef FEATURE_RUNTIME_PM
.runtime_suspend = wlan_hdd_pld_runtime_suspend,

View file

@ -76,6 +76,7 @@ typedef struct qcmbr_queue_s {
} qcmbr_queue_t;
LIST_HEAD(qcmbr_queue_head);
DEFINE_SPINLOCK(qcmbr_queue_lock);
static void wlanqcmbr_mc_process_msg(void *message);
#endif
#endif

View file

@ -1078,7 +1078,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
if (hdd_ipa_is_enabled(pHddCtx)) {
status = hdd_ipa_wlan_evt(pHostapdAdapter,
pHddApCtx->uBCStaId,
WLAN_AP_CONNECT,
HDD_IPA_AP_CONNECT,
pHostapdAdapter->dev->dev_addr);
if (status) {
hdd_err("WLAN_AP_CONNECT event failed!!");
@ -1234,7 +1234,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
if (hdd_ipa_is_enabled(pHddCtx)) {
status = hdd_ipa_wlan_evt(pHostapdAdapter,
pHddApCtx->uBCStaId,
WLAN_AP_DISCONNECT,
HDD_IPA_AP_DISCONNECT,
pHostapdAdapter->dev->dev_addr);
if (status) {
hdd_err("WLAN_AP_DISCONNECT event failed!!");
@ -1473,7 +1473,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
status = hdd_ipa_wlan_evt(pHostapdAdapter,
pSapEvent->sapevt.
sapStationAssocReassocCompleteEvent.
staId, WLAN_CLIENT_CONNECT_EX,
staId, HDD_IPA_CLIENT_CONNECT_EX,
pSapEvent->sapevt.
sapStationAssocReassocCompleteEvent.
staMac.bytes);
@ -1608,7 +1608,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
#ifdef IPA_OFFLOAD
if (hdd_ipa_is_enabled(pHddCtx)) {
status = hdd_ipa_wlan_evt(pHostapdAdapter, staId,
WLAN_CLIENT_DISCONNECT,
HDD_IPA_CLIENT_DISCONNECT,
pSapEvent->sapevt.
sapStationDisassocCompleteEvent.
staMac.bytes);

View file

@ -35,6 +35,7 @@
#ifdef IPA_OFFLOAD
/* Include Files */
#include <linux/ipa.h>
#include <wlan_hdd_includes.h>
#include <wlan_hdd_ipa.h>
@ -593,6 +594,7 @@ static void hdd_ipa_w2i_cb(void *priv, enum ipa_dp_evt_type evt,
unsigned long data);
static void hdd_ipa_cleanup_iface(struct hdd_ipa_iface_context *iface_context);
static void hdd_ipa_uc_proc_pending_event (struct hdd_ipa_priv *hdd_ipa);
/**
* hdd_ipa_is_enabled() - Is IPA enabled?
@ -1289,40 +1291,6 @@ static void hdd_ipa_uc_rm_notify_defer(struct work_struct *work)
return;
}
/**
* hdd_ipa_uc_proc_pending_event() - Process IPA uC pending events
* @hdd_ipa: Global HDD IPA context
*
* Return: None
*/
static void hdd_ipa_uc_proc_pending_event(struct hdd_ipa_priv *hdd_ipa)
{
unsigned int pending_event_count;
struct ipa_uc_pending_event *pending_event = NULL;
pending_event_count = qdf_list_size(&hdd_ipa->pending_event);
HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
"%s, Pending Event Count %d", __func__, pending_event_count);
if (!pending_event_count) {
HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
"%s, No Pending Event", __func__);
return;
}
qdf_list_remove_front(&hdd_ipa->pending_event,
(qdf_list_node_t **)&pending_event);
while (pending_event != NULL) {
hdd_ipa_wlan_evt(pending_event->adapter,
pending_event->type,
pending_event->sta_id,
pending_event->mac_addr);
qdf_mem_free(pending_event);
pending_event = NULL;
qdf_list_remove_front(&hdd_ipa->pending_event,
(qdf_list_node_t **)&pending_event);
}
}
/**
* hdd_ipa_uc_op_cb() - IPA uC operation callback
* @op_msg: operation message received from firmware
@ -3582,15 +3550,59 @@ static inline char *hdd_ipa_wlan_event_to_str(enum ipa_wlan_event event)
}
/**
* hdd_ipa_wlan_evt() - IPA event handler
* hdd_to_ipa_wlan_event() - convert hdd_ipa_wlan_event to ipa_wlan_event
* @hdd_ipa_event_type: HDD IPA WLAN event to be converted to an ipa_wlan_event
*
* Return: ipa_wlan_event representing the hdd_ipa_wlan_event
*/
static enum ipa_wlan_event
hdd_to_ipa_wlan_event(enum hdd_ipa_wlan_event hdd_ipa_event_type)
{
enum ipa_wlan_event ipa_event;
switch (hdd_ipa_event_type) {
case HDD_IPA_CLIENT_CONNECT:
ipa_event = WLAN_CLIENT_CONNECT;
break;
case HDD_IPA_CLIENT_DISCONNECT:
ipa_event = WLAN_CLIENT_DISCONNECT;
break;
case HDD_IPA_AP_CONNECT:
ipa_event = WLAN_AP_CONNECT;
break;
case HDD_IPA_AP_DISCONNECT:
ipa_event = WLAN_AP_DISCONNECT;
break;
case HDD_IPA_STA_CONNECT:
ipa_event = WLAN_STA_CONNECT;
break;
case HDD_IPA_STA_DISCONNECT:
ipa_event = WLAN_STA_DISCONNECT;
break;
case HDD_IPA_CLIENT_CONNECT_EX:
ipa_event = WLAN_CLIENT_CONNECT_EX;
break;
case HDD_IPA_WLAN_EVENT_MAX:
default:
ipa_event = IPA_WLAN_EVENT_MAX;
break;
}
return ipa_event;
}
/**
* __hdd_ipa_wlan_evt() - IPA event handler
* @adapter: adapter upon which the event was received
* @sta_id: station id for the event
* @type: the event type
* @type: event enum of type ipa_wlan_event
* @mac_address: MAC address associated with the event
*
* This function is meant to be called from within wlan_hdd_ipa.c
*
* Return: 0 on success, negative errno value on error
*/
int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
static int __hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
enum ipa_wlan_event type, uint8_t *mac_addr)
{
struct hdd_ipa_priv *hdd_ipa = ghdd_ipa;
@ -3957,6 +3969,60 @@ end:
return ret;
}
/**
* hdd_ipa_wlan_evt() - IPA event handler
* @adapter: adapter upon which the event was received
* @sta_id: station id for the event
* @hdd_event_type: event enum of type hdd_ipa_wlan_event
* @mac_address: MAC address associated with the event
*
* This function is meant to be called from outside of wlan_hdd_ipa.c.
*
* Return: 0 on success, negative errno value on error
*/
int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
enum hdd_ipa_wlan_event hdd_event_type, uint8_t *mac_addr)
{
enum ipa_wlan_event type = hdd_to_ipa_wlan_event(hdd_event_type);
return __hdd_ipa_wlan_evt(adapter, sta_id, type, mac_addr);
}
/**
* hdd_ipa_uc_proc_pending_event() - Process IPA uC pending events
* @hdd_ipa: Global HDD IPA context
*
* Return: None
*/
static void
hdd_ipa_uc_proc_pending_event(struct hdd_ipa_priv *hdd_ipa)
{
unsigned int pending_event_count;
struct ipa_uc_pending_event *pending_event = NULL;
pending_event_count = qdf_list_size(&hdd_ipa->pending_event);
HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
"%s, Pending Event Count %d", __func__, pending_event_count);
if (!pending_event_count) {
HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
"%s, No Pending Event", __func__);
return;
}
qdf_list_remove_front(&hdd_ipa->pending_event,
(qdf_list_node_t **)&pending_event);
while (pending_event != NULL) {
__hdd_ipa_wlan_evt(pending_event->adapter,
pending_event->type,
pending_event->sta_id,
pending_event->mac_addr);
qdf_mem_free(pending_event);
pending_event = NULL;
qdf_list_remove_front(&hdd_ipa->pending_event,
(qdf_list_node_t **)&pending_event);
}
}
/**
* hdd_ipa_rm_state_to_str() - Convert IPA RM state to string
* @state: IPA RM state value

View file

@ -8506,7 +8506,8 @@ static int __hdd_module_init(void)
ret = wlan_hdd_register_driver();
if (ret) {
pr_err("%s: driver load failure\n", WLAN_MODULE_NAME);
pr_err("%s: driver load failure, err %d\n", WLAN_MODULE_NAME,
ret);
goto out;
}