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

Commit 6d5c8987 authored by Machani, Yaniv's avatar Machani, Yaniv Committed by Kalle Valo
Browse files

wlcore/wl18xx : add time sync event handling



Added support for a new time sync event
the event data contains the WiLink TSF value.
To trigger the event, a HW modification is required,
so as a supporting firmware binary.

Signed-off-by: default avatarYaniv Machani <yanivma@ti.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 100a0083
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -112,6 +112,14 @@ static int wlcore_smart_config_decode_event(struct wl1271 *wl,
	return 0;
}

static void wlcore_event_time_sync(struct wl1271 *wl, u16 tsf_msb, u16 tsf_lsb)
{
	u32 clock;
	/* convert the MSB+LSB to a u32 TSF value */
	clock = (tsf_msb << 16) | tsf_lsb;
	wl1271_info("TIME_SYNC_EVENT_ID: clock %u", clock);
}

int wl18xx_process_mailbox_events(struct wl1271 *wl)
{
	struct wl18xx_event_mailbox *mbox = wl->mbox;
@@ -128,6 +136,11 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
			wl18xx_scan_completed(wl, wl->scan_wlvif);
	}

	if (vector & TIME_SYNC_EVENT_ID)
		wlcore_event_time_sync(wl,
				mbox->time_sync_tsf_msb,
				mbox->time_sync_tsf_lsb);

	if (vector & RADAR_DETECTED_EVENT_ID) {
		wl1271_info("radar event: channel %d type %s",
			    mbox->radar_channel,
+8 −4
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ enum {
	PERIODIC_SCAN_REPORT_EVENT_ID            = BIT(20),
	SMART_CONFIG_SYNC_EVENT_ID               = BIT(22),
	SMART_CONFIG_DECODE_EVENT_ID             = BIT(23),
	TIME_SYNC_EVENT_ID                       = BIT(24),
};

enum wl18xx_radar_types {
@@ -95,13 +96,16 @@ struct wl18xx_event_mailbox {
	/* smart config sync channel */
	u8 sc_sync_channel;
	u8 sc_sync_band;
	u8 padding2[2];

	/* time sync msb*/
	u16 time_sync_tsf_msb;
	/* radar detect */
	u8 radar_channel;
	u8 radar_type;

	u8 padding3[2];
	/* time sync lsb*/
	u16 time_sync_tsf_lsb;

} __packed;

int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
+2 −2
Original line number Diff line number Diff line
@@ -1026,8 +1026,8 @@ static int wl18xx_boot(struct wl1271 *wl)
		CHANNEL_SWITCH_COMPLETE_EVENT_ID |
		DFS_CHANNELS_CONFIG_COMPLETE_EVENT |
		SMART_CONFIG_SYNC_EVENT_ID |
		SMART_CONFIG_DECODE_EVENT_ID;
;
		SMART_CONFIG_DECODE_EVENT_ID |
		TIME_SYNC_EVENT_ID;

	wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID;