Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a75fe59 authored by Lior David's avatar Lior David Committed by Alexei Avshalom Lazar
Browse files

wil6210: initial support for FTM and AOA



Added initial support for fine timing measurement(FTM)
and angle of arrival (AOA). These features allow a station
to get an accurate indoor location by measuring
distance (FTM) and azimuth/elevation (AOA) to one or more
stations/APs with a known location.

The following APIs are supported:
1. Get FTM/AOA capabilities, currently hard-coded for a
single-shot measurement to an associated AP
2. Start FTM session
3. Receive FTM results
4. Start standalone AOA measurement
5. Receive AOA results

Change-Id: I54ebc1bdff6ed7d91644165b16eb0a4240069321
CRs-Fixed: 1057307
Signed-off-by: default avatarLior David <liord@codeaurora.org>
[merez@codeaurora.org: fix compilation errors]
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
[ailizaro@codeaurora.org: trivial conflict fixes]
Signed-off-by: default avatarAlexei Avshalom Lazar <ailizaro@codeaurora.org>
parent d56b4ae5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ wil6210-y += wil_platform.o
wil6210-y += ethtool.o
wil6210-y += wil_crash_dump.o
wil6210-y += p2p.o
wil6210-y += ftm.o

# for tracing framework to find trace.h
CFLAGS_trace.o := -I$(src)
+70 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <net/netlink.h>
#include "wil6210.h"
#include "wmi.h"
#include "ftm.h"

#define WIL_MAX_ROC_DURATION_MS 5000

@@ -115,6 +116,15 @@ nla_policy wil_rf_sector_cfg_policy[QCA_ATTR_DMG_RF_SECTOR_CFG_MAX + 1] = {
};

enum qca_nl80211_vendor_subcmds {
	QCA_NL80211_VENDOR_SUBCMD_LOC_GET_CAPA = 128,
	QCA_NL80211_VENDOR_SUBCMD_FTM_START_SESSION = 129,
	QCA_NL80211_VENDOR_SUBCMD_FTM_ABORT_SESSION = 130,
	QCA_NL80211_VENDOR_SUBCMD_FTM_MEAS_RESULT = 131,
	QCA_NL80211_VENDOR_SUBCMD_FTM_SESSION_DONE = 132,
	QCA_NL80211_VENDOR_SUBCMD_FTM_CFG_RESPONDER = 133,
	QCA_NL80211_VENDOR_SUBCMD_AOA_MEAS = 134,
	QCA_NL80211_VENDOR_SUBCMD_AOA_ABORT_MEAS = 135,
	QCA_NL80211_VENDOR_SUBCMD_AOA_MEAS_RESULT = 136,
	QCA_NL80211_VENDOR_SUBCMD_DMG_RF_GET_SECTOR_CFG = 139,
	QCA_NL80211_VENDOR_SUBCMD_DMG_RF_SET_SECTOR_CFG = 140,
	QCA_NL80211_VENDOR_SUBCMD_DMG_RF_GET_SELECTED_SECTOR = 141,
@@ -136,6 +146,48 @@ static int wil_rf_sector_set_selected(struct wiphy *wiphy,

/* vendor specific commands */
static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = {
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LOC_GET_CAPA,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_ftm_get_capabilities
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_START_SESSION,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_ftm_start_session
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_ABORT_SESSION,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_ftm_abort_session
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_CFG_RESPONDER,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_ftm_configure_responder
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_AOA_MEAS,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_aoa_start_measurement
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_AOA_ABORT_MEAS,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_aoa_abort_measurement
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_DMG_RF_GET_SECTOR_CFG,
@@ -168,6 +220,22 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = {
	},
};

/* vendor specific events */
static const struct nl80211_vendor_cmd_info wil_nl80211_vendor_events[] = {
	[QCA_NL80211_VENDOR_EVENT_FTM_MEAS_RESULT_INDEX] = {
			.vendor_id = QCA_NL80211_VENDOR_ID,
			.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_MEAS_RESULT
	},
	[QCA_NL80211_VENDOR_EVENT_FTM_SESSION_DONE_INDEX] = {
			.vendor_id = QCA_NL80211_VENDOR_ID,
			.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_SESSION_DONE
	},
	[QCA_NL80211_VENDOR_EVENT_AOA_MEAS_RESULT_INDEX] = {
			.vendor_id = QCA_NL80211_VENDOR_ID,
			.subcmd = QCA_NL80211_VENDOR_SUBCMD_AOA_MEAS_RESULT
	},
};

static struct ieee80211_supported_band wil_band_60ghz = {
	.channels = wil_60ghz_channels,
	.n_channels = ARRAY_SIZE(wil_60ghz_channels),
@@ -1815,6 +1883,8 @@ static void wil_wiphy_init(struct wiphy *wiphy)

	wiphy->n_vendor_commands = ARRAY_SIZE(wil_nl80211_vendor_commands);
	wiphy->vendor_commands = wil_nl80211_vendor_commands;
	wiphy->vendor_events = wil_nl80211_vendor_events;
	wiphy->n_vendor_events = ARRAY_SIZE(wil_nl80211_vendor_events);

#ifdef CONFIG_PM
	wiphy->wowlan = &wil_wowlan_support;
+908 −0

File added.

Preview size limit exceeded, changes collapsed.

+512 −0

File added.

Preview size limit exceeded, changes collapsed.

+5 −0
Original line number Diff line number Diff line
@@ -558,6 +558,8 @@ int wil_priv_init(struct wil6210_priv *wil)
	wil->net_queue_stopped = 1;
	init_waitqueue_head(&wil->wq);

	wil_ftm_init(wil);

	wil->wmi_wq = create_singlethread_workqueue(WIL_NAME "_wmi");
	if (!wil->wmi_wq)
		return -EAGAIN;
@@ -622,6 +624,7 @@ void wil_priv_deinit(struct wil6210_priv *wil)
{
	wil_dbg_misc(wil, "priv_deinit\n");

	wil_ftm_deinit(wil);
	wil_set_recovery_state(wil, fw_recovery_idle);
	del_timer_sync(&wil->scan_timer);
	del_timer_sync(&wil->p2p.discovery_timer);
@@ -1189,6 +1192,8 @@ int __wil_down(struct wil6210_priv *wil)
	}
	wil_enable_irq(wil);

	wil_ftm_stop_operations(wil);

	mutex_lock(&wil->p2p_wdev_mutex);
	wil_p2p_stop_radio_operations(wil);
	wil_abort_scan(wil, false);
Loading