Author: adrian
Date: Wed Jan 2 00:38:01 2013
New Revision: 244943
URL: http://svnweb.freebsd.org/changeset/base/244943
Log:
Bring over the basic spectral scan framework code from Qualcomm Atheros.
This includes the HAL routines to setup, enable/activate/disable spectral
scan and configure the relevant registers.
This still requires driver interaction to enable spectral scan reporting.
Specifically:
* call ah_spectralConfigure() to configure and enable spectral scan;
* .. there's currently no way to disable spectral scan... that will have
to follow.
* call ah_spectralStart() to force start a spectral report;
* call ah_spectralStop() to force stop an active spectral report.
The spectral scan results appear as PHY errors (type 0x5 on the AR9280,
same as radar) but with the spectral scan bit set (0x10 in the last byte
of the frame) identifying it as a spectral report rather than a radar
FFT report.
Caveats:
* It's likely quite difficult to run spectral _and_ radar at the same
time. Enabling spectral scan disables the radar thresholds but
leaves radar enabled. Thus, the driver (for now) needs to ensure
that only one or the other is enabled.
* .. it needs testing on HT40 mode.
Tested:
* AR9280 in STA mode, HT/20 only
TODO:
* Test on AR9285, AR9287;
* Test in both HT20 and HT40 modes;
* .. all the driver glue.
Obtained from:Qualcomm Atheros
Added:
head/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c (contents, props changed)
Modified:
head/sys/dev/ath/ath_hal/ar5416/ar5416.h
head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h
head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.hTue Jan 1 19:42:06 2013
(r244942)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.hWed Jan 2 00:38:01 2013
(r244943)
@@ -265,6 +265,16 @@ extern HAL_BOOL ar5416ProcessRadarEvent(
HAL_DFS_EVENT *event);
extern HAL_BOOL ar5416IsFastClockEnabled(struct ath_hal *ah);
+/* ar9280_spectral.c */
+extern void ar5416ConfigureSpectralScan(struct ath_hal *ah, HAL_SPECTRAL_PARAM
*ss);
+extern void ar5416GetSpectralParams(struct ath_hal *ah, HAL_SPECTRAL_PARAM
*ss);
+extern HAL_BOOL ar5416IsSpectralActive(struct ath_hal *ah);
+extern HAL_BOOL ar5416IsSpectralEnabled(struct ath_hal *ah);
+extern void ar5416StartSpectralScan(struct ath_hal *ah);
+extern void ar5416StopSpectralScan(struct ath_hal *ah);
+extern uint32_t ar5416GetSpectralConfig(struct ath_hal *ah);
+extern void ar5416RestoreSpectralConfig(struct ath_hal *ah, uint32_t
restoreval);
+
extern HAL_BOOL ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode,
int setChip);
extern HAL_POWER_MODE ar5416GetPowerMode(struct ath_hal *ah);
Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Tue Jan 1 19:42:06
2013(r244942)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Wed Jan 2 00:38:01
2013(r244943)
@@ -161,6 +161,14 @@ ar5416InitState(struct ath_hal_5416 *ahp
ah-ah_procRadarEvent = ar5416ProcessRadarEvent;
ah-ah_isFastClockEnabled = ar5416IsFastClockEnabled;
+ /* Spectral Scan Functions */
+ ah-ah_spectralConfigure= ar5416ConfigureSpectralScan;
+ ah-ah_spectralGetConfig= ar5416GetSpectralParams;
+ ah-ah_spectralStart= ar5416StartSpectralScan;
+ ah-ah_spectralStop = ar5416StopSpectralScan;
+ ah-ah_spectralIsEnabled= ar5416IsSpectralEnabled;
+ ah-ah_spectralIsActive = ar5416IsSpectralActive;
+
/* Power Management Functions */
ah-ah_setPowerMode = ar5416SetPowerMode;
@@ -918,6 +926,7 @@ ar5416FillCapabilityInfo(struct ath_hal
pCap-halMcastKeySrchSupport = AH_TRUE; /* Works on AR5416 and later */
pCap-halTsfAddSupport = AH_TRUE;
pCap-hal4AddrAggrSupport = AH_FALSE; /* Broken in Owl */
+ pCap-halSpectralScanSupport = AH_FALSE;/* AR9280 and later */
if (ath_hal_eepromGet(ah, AR_EEP_MAXQCU, val) == HAL_OK)
pCap-halTotalQueues = val;
Added: head/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c
==
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c Wed Jan 2 00:38:01
2013(r244943)
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2012 Qualcomm