qcacmn: Modify wmi handle and api for common wmi layer

Modify wmi handle and wmi unified interface API
for common wmi layer.
Register UMAC callbacks using opaque callbacks.

CRs-Fixed: 978579
Change-Id: I505fe4ac339213db30bb00695234c4cfea5a5908
This commit is contained in:
Govind Singh
2016-02-04 18:42:30 +05:30
parent d475ea965e
commit 6ad6adac26
2 changed files with 37 additions and 7 deletions

View File

@@ -26,7 +26,8 @@
*/ */
/* /*
* This file contains the API definitions for the Unified Wireless Module Interface (WMI). * This file contains the API definitions for the Unified Wireless Module
* Interface (WMI).
*/ */
#ifndef _WMI_UNIFIED_API_H_ #ifndef _WMI_UNIFIED_API_H_
@@ -41,6 +42,32 @@
typedef cdf_nbuf_t wmi_buf_t; typedef cdf_nbuf_t wmi_buf_t;
#define wmi_buf_data(_buf) cdf_nbuf_data(_buf) #define wmi_buf_data(_buf) cdf_nbuf_data(_buf)
/**
* struct wmi_ops - service callbacks to upper layer
* @service_ready_cbk: service ready callback
* @service_ready_ext_cbk: service ready ext callback
* @ready_cbk: ready calback
* @wma_process_fw_event_handler_cbk: generic event handler callback
*/
struct wmi_ops {
void (*service_ready_cbk)(void *ctx, void *ev);
void (*service_ready_ext_cbk)(void *ctx, void *ev);
void (*ready_cbk)(void *ctx, void *ev);
int (*wma_process_fw_event_handler_cbk)(void *ctx,
void *ev);
};
/**
* enum wmi_target_type - type of supported wmi command
* @WMI_TLV_TARGET: tlv based target
* @WMI_NON_TLV_TARGET: non-tlv based target
*
*/
enum wmi_target_type {
WMI_TLV_TARGET,
WMI_NON_TLV_TARGET
};
/** /**
* attach for unified WMI * attach for unified WMI
* *
@@ -48,7 +75,9 @@ typedef cdf_nbuf_t wmi_buf_t;
* @return opaque handle. * @return opaque handle.
*/ */
void *wmi_unified_attach(void *scn_handle, void *wmi_unified_attach(void *scn_handle,
int (*func)(struct wmi_unified *, wmi_buf_t)); osdev_t osdev, enum wmi_target_type target_type,
bool use_cookie, struct wmi_ops *ops);
/** /**
* detach for unified WMI * detach for unified WMI
* *
@@ -92,7 +121,7 @@ void wmi_buf_free(wmi_buf_t net_buf);
* @return 0 on success and -ve on failure. * @return 0 on success and -ve on failure.
*/ */
int int
wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int buflen, wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, uint32_t buflen,
WMI_CMD_ID cmd_id); WMI_CMD_ID cmd_id);
/** /**
@@ -168,13 +197,9 @@ static inline bool wmi_get_runtime_pm_inprogress(wmi_unified_t wmi_handle)
} }
#endif #endif
/** /**
* WMA Callback to process fw event. * WMA Callback to process fw event.
*/ */
typedef int (*wma_process_fw_event_handler_cbk)(struct wmi_unified *wmi_handle,
wmi_buf_t evt_buf);
void wmi_process_fw_event(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf); void wmi_process_fw_event(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf);
uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle); uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle);
#endif /* _WMI_UNIFIED_API_H_ */ #endif /* _WMI_UNIFIED_API_H_ */

View File

@@ -69,6 +69,7 @@ struct fwdebug {
struct wmi_unified { struct wmi_unified {
ol_scn_t scn_handle; /* handle to device */ ol_scn_t scn_handle; /* handle to device */
osdev_t osdev; /* handle to use OS-independent services */
cdf_atomic_t pending_cmds; cdf_atomic_t pending_cmds;
HTC_ENDPOINT_ID wmi_endpoint_id; HTC_ENDPOINT_ID wmi_endpoint_id;
uint16_t max_msg_len; uint16_t max_msg_len;
@@ -79,6 +80,7 @@ struct wmi_unified {
cdf_spinlock_t eventq_lock; cdf_spinlock_t eventq_lock;
cdf_nbuf_queue_t event_queue; cdf_nbuf_queue_t event_queue;
struct work_struct rx_event_work; struct work_struct rx_event_work;
int wmi_stop_in_progress;
#ifdef WLAN_OPEN_SOURCE #ifdef WLAN_OPEN_SOURCE
struct fwdebug dbglog; struct fwdebug dbglog;
struct dentry *debugfs_phy; struct dentry *debugfs_phy;
@@ -96,5 +98,8 @@ struct wmi_unified {
int (*wma_process_fw_event_handler_cbk)(struct wmi_unified *wmi_handle, int (*wma_process_fw_event_handler_cbk)(struct wmi_unified *wmi_handle,
wmi_buf_t evt_buf); wmi_buf_t evt_buf);
struct wmi_ops ops;
void *event_handler_cookie[WMI_UNIFIED_MAX_EVENT];
bool use_cookie;
}; };
#endif #endif