qcacmn: Add function to extract the events for FTM TIME SYNC feature
This patch adds the function to extract and parse the wmi events WMI_VDEV_AUDIO_SYNC_START_STOP_EVENTID and WMI_VDEV_AUDIO_SYNC_Q_MASTER_SLAVE_OFFSET_EVENTID. These events are required for ftm time sync feature. Change-Id: Ib17da82b7a8abfcff5d18125a0ba0e5249d6bf54 CRs-Fixed: 2615452
This commit is contained in:

committed by
nshrivas

parent
f2d6649390
commit
d6e10c598e
@@ -3820,7 +3820,7 @@ QDF_STATUS wmi_unified_extract_ani_level(wmi_unified_t wmi_handle,
|
||||
|
||||
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
|
||||
/**
|
||||
* wmi_send_wlan_time_sync_ftm_trigger() - send wlan time sync ftm trigger cmd.
|
||||
* wmi_unified_send_wlan_time_sync_ftm_trigger() - send ftm timesync trigger cmd
|
||||
* @wmi_handle: wmi handle
|
||||
* @vdev_id: vdev id
|
||||
* @burst_mode: mode reg getting time sync relation from FW
|
||||
@@ -3829,12 +3829,13 @@ QDF_STATUS wmi_unified_extract_ani_level(wmi_unified_t wmi_handle,
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
|
||||
*/
|
||||
QDF_STATUS wmi_send_wlan_time_sync_ftm_trigger(void *wmi_handle,
|
||||
uint32_t vdev_id,
|
||||
bool burst_mode);
|
||||
QDF_STATUS
|
||||
wmi_unified_send_wlan_time_sync_ftm_trigger(wmi_unified_t wmi_handle,
|
||||
uint32_t vdev_id,
|
||||
bool burst_mode);
|
||||
|
||||
/**
|
||||
* wmi_send_wlan_time_sync_qtime() - send wlan time sync qtime cmd.
|
||||
* wmi_unified_send_wlan_time_sync_qtime() - send ftm time sync qtime cmd.
|
||||
* @wmi_handle: wmi handle
|
||||
* @vdev_id: vdev id
|
||||
* @lpass_ts: audio qtime
|
||||
@@ -3843,8 +3844,40 @@ QDF_STATUS wmi_send_wlan_time_sync_ftm_trigger(void *wmi_handle,
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
|
||||
*/
|
||||
QDF_STATUS wmi_send_wlan_time_sync_qtime(void *wmi_handle, uint32_t vdev_id,
|
||||
uint64_t lpass_ts);
|
||||
QDF_STATUS
|
||||
wmi_unified_send_wlan_time_sync_qtime(wmi_unified_t wmi_handle,
|
||||
uint32_t vdev_id, uint64_t lpass_ts);
|
||||
|
||||
/**
|
||||
* wmi_unified_extract_time_sync_ftm_start_stop_params() - extract FTM time sync
|
||||
* params
|
||||
* @wmi_handle: wmi handle
|
||||
* @evt_buf: event buffer
|
||||
* @param: params received in start stop ftm timesync event
|
||||
*
|
||||
* This function extracts the params from ftm timesync start stop event
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
|
||||
*/
|
||||
QDF_STATUS
|
||||
wmi_unified_extract_time_sync_ftm_start_stop_params(
|
||||
wmi_unified_t wmi_handle, void *evt_buf,
|
||||
struct ftm_time_sync_start_stop_params *param);
|
||||
|
||||
/**
|
||||
* wmi_unified_extract_time_sync_ftm_offset() - extract timesync FTM offset
|
||||
* @wmi_handle: wmi handle
|
||||
* @evt_buf: event buffer
|
||||
* @param: params received in ftm timesync offset event
|
||||
*
|
||||
* This function extracts the params from ftm timesync offset event
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
|
||||
*/
|
||||
QDF_STATUS
|
||||
wmi_unified_extract_time_sync_ftm_offset(wmi_unified_t wmi_handle,
|
||||
void *evt_buf,
|
||||
struct ftm_time_sync_offset *param);
|
||||
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
|
||||
|
||||
#endif /* _WMI_UNIFIED_API_H_ */
|
||||
|
@@ -4314,6 +4314,50 @@ typedef struct {
|
||||
uint32_t rx_duration_us;
|
||||
} wmi_host_chan_stats;
|
||||
|
||||
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
|
||||
|
||||
#define FTM_TIME_SYNC_QTIME_PAIR_MAX 32
|
||||
|
||||
/**
|
||||
* struct ftm_time_sync_start_stop_param- Get wlan time sync ftm info
|
||||
* @vdev_id: vdev id
|
||||
* @timer_interval: periodicity to trigger wlan time sync strobe
|
||||
* @num_reads: Number of times to trigger wlabn time sync strobe
|
||||
* @qtime: ref Qtimer value
|
||||
* @mac_time: ref Mac timer value
|
||||
*/
|
||||
struct ftm_time_sync_start_stop_params {
|
||||
uint32_t vdev_id;
|
||||
uint32_t timer_interval;
|
||||
uint32_t num_reads;
|
||||
uint64_t qtime;
|
||||
uint64_t mac_time;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wlan_time_sync_qtime_pair- Get wlan time sync qtime pair value
|
||||
* @vdev_id: vdev id
|
||||
* @qtime_master: qtimer value of master
|
||||
* @qtime_slave: qtimer value of slave
|
||||
*/
|
||||
struct wlan_time_sync_qtime_pair {
|
||||
uint64_t qtime_master;
|
||||
uint64_t qtime_slave;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ftm_time_sync_offset- Get ftm time sync offset
|
||||
* @vdev_id: vdev id
|
||||
* @num_qtime: number of qtime values received
|
||||
* @pairs: array of qtime pairs
|
||||
*/
|
||||
struct ftm_time_sync_offset {
|
||||
uint32_t vdev_id;
|
||||
uint32_t num_qtime;
|
||||
struct wlan_time_sync_qtime_pair pairs[FTM_TIME_SYNC_QTIME_PAIR_MAX];
|
||||
};
|
||||
#endif
|
||||
|
||||
#define WMI_EVENT_ID_INVALID 0
|
||||
/**
|
||||
* Host based ENUM IDs for events to abstract target enums for event_id
|
||||
|
@@ -2164,9 +2164,18 @@ QDF_STATUS (*extract_multi_vdev_restart_resp_event)(
|
||||
QDF_STATUS (*send_wlan_time_sync_ftm_trigger_cmd)(wmi_unified_t wmi_handle,
|
||||
uint32_t vdev_id,
|
||||
bool burst_mode);
|
||||
|
||||
QDF_STATUS (*send_wlan_ts_qtime_cmd)(wmi_unified_t wmi_handle,
|
||||
uint32_t vdev_id,
|
||||
uint64_t lpass_ts);
|
||||
|
||||
QDF_STATUS (*extract_time_sync_ftm_start_stop_event)(
|
||||
wmi_unified_t wmi_hdl, void *evt_buf,
|
||||
struct ftm_time_sync_start_stop_params *param);
|
||||
|
||||
QDF_STATUS (*extract_time_sync_ftm_offset_event)(
|
||||
wmi_unified_t wmi_hdl, void *evt_buf,
|
||||
struct ftm_time_sync_offset *param);
|
||||
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
|
||||
|
||||
};
|
||||
|
@@ -3125,9 +3125,9 @@ wmi_unified_extract_roam_11kv_stats(wmi_unified_t wmi, void *evt_buf,
|
||||
}
|
||||
|
||||
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
|
||||
QDF_STATUS wmi_send_wlan_time_sync_ftm_trigger(wmi_unified_t wmi_handle,
|
||||
uint32_t vdev_id,
|
||||
bool burst_mode)
|
||||
QDF_STATUS wmi_unified_send_wlan_time_sync_ftm_trigger(wmi_unified_t wmi_handle,
|
||||
uint32_t vdev_id,
|
||||
bool burst_mode)
|
||||
{
|
||||
if (wmi_handle->ops->send_wlan_time_sync_ftm_trigger_cmd)
|
||||
return wmi_handle->ops->send_wlan_time_sync_ftm_trigger_cmd
|
||||
@@ -3136,9 +3136,9 @@ QDF_STATUS wmi_send_wlan_time_sync_ftm_trigger(wmi_unified_t wmi_handle,
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
QDF_STATUS wmi_send_wlan_time_sync_qtime(wmi_unified_t wmi_handle,
|
||||
uint32_t vdev_id,
|
||||
uint64_t lpass_ts)
|
||||
QDF_STATUS wmi_unified_send_wlan_time_sync_qtime(wmi_unified_t wmi_handle,
|
||||
uint32_t vdev_id,
|
||||
uint64_t lpass_ts)
|
||||
{
|
||||
if (wmi_handle->ops->send_wlan_ts_qtime_cmd)
|
||||
return wmi_handle->ops->send_wlan_ts_qtime_cmd(wmi_handle,
|
||||
@@ -3146,4 +3146,28 @@ QDF_STATUS wmi_send_wlan_time_sync_qtime(wmi_unified_t wmi_handle,
|
||||
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
QDF_STATUS wmi_unified_extract_time_sync_ftm_start_stop_params(
|
||||
wmi_unified_t wmi_handle, void *evt_buf,
|
||||
struct ftm_time_sync_start_stop_params *param)
|
||||
{
|
||||
if (wmi_handle->ops->extract_time_sync_ftm_start_stop_event)
|
||||
return
|
||||
wmi_handle->ops->extract_time_sync_ftm_start_stop_event(
|
||||
wmi_handle, evt_buf, param);
|
||||
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
QDF_STATUS wmi_unified_extract_time_sync_ftm_offset(
|
||||
wmi_unified_t wmi_handle, void *evt_buf,
|
||||
struct ftm_time_sync_offset *param)
|
||||
{
|
||||
if (wmi_handle->ops->extract_time_sync_ftm_offset_event)
|
||||
return
|
||||
wmi_handle->ops->extract_time_sync_ftm_offset_event(
|
||||
wmi_handle, evt_buf, param);
|
||||
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
|
||||
|
@@ -13067,6 +13067,80 @@ static QDF_STATUS send_wlan_ts_qtime_cmd_tlv(wmi_unified_t wmi,
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static QDF_STATUS extract_time_sync_ftm_start_stop_event_tlv(
|
||||
wmi_unified_t wmi, void *buf,
|
||||
struct ftm_time_sync_start_stop_params *param)
|
||||
{
|
||||
WMI_VDEV_AUDIO_SYNC_START_STOP_EVENTID_param_tlvs *param_buf;
|
||||
wmi_audio_sync_start_stop_event_fixed_param *resp_event;
|
||||
|
||||
param_buf = (WMI_VDEV_AUDIO_SYNC_START_STOP_EVENTID_param_tlvs *)buf;
|
||||
if (!param_buf) {
|
||||
WMI_LOGE("Invalid audio sync start stop event buffer");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
resp_event = param_buf->fixed_param;
|
||||
if (!resp_event) {
|
||||
WMI_LOGE("Invalid audio sync start stop fixed param buffer");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
param->vdev_id = resp_event->vdev_id;
|
||||
param->timer_interval = resp_event->periodicity;
|
||||
param->num_reads = resp_event->reads_needed;
|
||||
param->qtime = ((uint64_t)resp_event->qtimer_u32 << 32) |
|
||||
resp_event->qtimer_l32;
|
||||
param->mac_time = ((uint64_t)resp_event->mac_timer_u32 << 32) |
|
||||
resp_event->mac_timer_l32;
|
||||
|
||||
WMI_LOGI("%s: FTM time sync time_interval %d, num_reads %d", __func__,
|
||||
param->timer_interval, param->num_reads);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static QDF_STATUS
|
||||
extract_time_sync_ftm_offset_event_tlv(wmi_unified_t wmi, void *buf,
|
||||
struct ftm_time_sync_offset *param)
|
||||
{
|
||||
WMI_VDEV_AUDIO_SYNC_Q_MASTER_SLAVE_OFFSET_EVENTID_param_tlvs *param_buf;
|
||||
wmi_audio_sync_q_master_slave_offset_event_fixed_param *resp_event;
|
||||
wmi_audio_sync_q_master_slave_times *q_pair;
|
||||
int iter;
|
||||
|
||||
param_buf =
|
||||
(WMI_VDEV_AUDIO_SYNC_Q_MASTER_SLAVE_OFFSET_EVENTID_param_tlvs *)buf;
|
||||
if (!param_buf) {
|
||||
WMI_LOGE("Invalid timesync ftm offset event buffer");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
resp_event = param_buf->fixed_param;
|
||||
if (!resp_event) {
|
||||
WMI_LOGE("Invalid timesync ftm offset fixed param buffer");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
param->vdev_id = resp_event->vdev_id;
|
||||
param->num_qtime = param_buf->num_audio_sync_q_master_slave_times;
|
||||
q_pair = param_buf->audio_sync_q_master_slave_times;
|
||||
if (!q_pair) {
|
||||
WMI_LOGE("Invalid q_master_slave_times buffer");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
for (iter = 0; iter < param->num_qtime; iter++) {
|
||||
param->pairs[iter].qtime_master = (
|
||||
(uint64_t)q_pair[iter].qmaster_u32 << 32) |
|
||||
q_pair[iter].qmaster_l32;
|
||||
param->pairs[iter].qtime_slave = (
|
||||
(uint64_t)q_pair[iter].qslave_u32 << 32) |
|
||||
q_pair[iter].qslave_l32;
|
||||
}
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
|
||||
|
||||
struct wmi_ops tlv_ops = {
|
||||
@@ -13387,6 +13461,10 @@ struct wmi_ops tlv_ops = {
|
||||
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
|
||||
.send_wlan_time_sync_ftm_trigger_cmd = send_wlan_ts_ftm_trigger_cmd_tlv,
|
||||
.send_wlan_ts_qtime_cmd = send_wlan_ts_qtime_cmd_tlv,
|
||||
.extract_time_sync_ftm_start_stop_event =
|
||||
extract_time_sync_ftm_start_stop_event_tlv,
|
||||
.extract_time_sync_ftm_offset_event =
|
||||
extract_time_sync_ftm_offset_event_tlv,
|
||||
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user