aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ath9k.h
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2013-12-17 23:23:18 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-12-18 15:23:37 -0500
commitf65c0825512b7b8ed6cc6e43bb46ca2c758d9ae4 (patch)
tree191e71555134308420c306b2b338212ef58dd6c2 /drivers/net/wireless/ath/ath9k/ath9k.h
parentf726ee65ae61e04762f722372095c99d10ed96a9 (diff)
ath9k: Cleanup spectral scan code
* Move definitions to spectral.h * Move processing/debug code to spectral.c Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ath9k.h')
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h179
1 files changed, 1 insertions, 178 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index dbf2a97d4daa..55bb87400b1a 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -27,6 +27,7 @@
27#include "common.h" 27#include "common.h"
28#include "mci.h" 28#include "mci.h"
29#include "dfs.h" 29#include "dfs.h"
30#include "spectral.h"
30 31
31/* 32/*
32 * Header for the ath9k.ko driver core *only* -- hw code nor any other driver 33 * Header for the ath9k.ko driver core *only* -- hw code nor any other driver
@@ -716,23 +717,6 @@ struct ath9k_vif_iter_data {
716 int nadhocs; /* number of adhoc vifs */ 717 int nadhocs; /* number of adhoc vifs */
717}; 718};
718 719
719/* enum spectral_mode:
720 *
721 * @SPECTRAL_DISABLED: spectral mode is disabled
722 * @SPECTRAL_BACKGROUND: hardware sends samples when it is not busy with
723 * something else.
724 * @SPECTRAL_MANUAL: spectral scan is enabled, triggering for samples
725 * is performed manually.
726 * @SPECTRAL_CHANSCAN: Like manual, but also triggered when changing channels
727 * during a channel scan.
728 */
729enum spectral_mode {
730 SPECTRAL_DISABLED = 0,
731 SPECTRAL_BACKGROUND,
732 SPECTRAL_MANUAL,
733 SPECTRAL_CHANSCAN,
734};
735
736struct ath_softc { 720struct ath_softc {
737 struct ieee80211_hw *hw; 721 struct ieee80211_hw *hw;
738 struct device *dev; 722 struct device *dev;
@@ -822,162 +806,6 @@ struct ath_softc {
822#endif 806#endif
823}; 807};
824 808
825#define SPECTRAL_SCAN_BITMASK 0x10
826/* Radar info packet format, used for DFS and spectral formats. */
827struct ath_radar_info {
828 u8 pulse_length_pri;
829 u8 pulse_length_ext;
830 u8 pulse_bw_info;
831} __packed;
832
833/* The HT20 spectral data has 4 bytes of additional information at it's end.
834 *
835 * [7:0]: all bins {max_magnitude[1:0], bitmap_weight[5:0]}
836 * [7:0]: all bins max_magnitude[9:2]
837 * [7:0]: all bins {max_index[5:0], max_magnitude[11:10]}
838 * [3:0]: max_exp (shift amount to size max bin to 8-bit unsigned)
839 */
840struct ath_ht20_mag_info {
841 u8 all_bins[3];
842 u8 max_exp;
843} __packed;
844
845#define SPECTRAL_HT20_NUM_BINS 56
846
847/* WARNING: don't actually use this struct! MAC may vary the amount of
848 * data by -1/+2. This struct is for reference only.
849 */
850struct ath_ht20_fft_packet {
851 u8 data[SPECTRAL_HT20_NUM_BINS];
852 struct ath_ht20_mag_info mag_info;
853 struct ath_radar_info radar_info;
854} __packed;
855
856#define SPECTRAL_HT20_TOTAL_DATA_LEN (sizeof(struct ath_ht20_fft_packet))
857
858/* Dynamic 20/40 mode:
859 *
860 * [7:0]: lower bins {max_magnitude[1:0], bitmap_weight[5:0]}
861 * [7:0]: lower bins max_magnitude[9:2]
862 * [7:0]: lower bins {max_index[5:0], max_magnitude[11:10]}
863 * [7:0]: upper bins {max_magnitude[1:0], bitmap_weight[5:0]}
864 * [7:0]: upper bins max_magnitude[9:2]
865 * [7:0]: upper bins {max_index[5:0], max_magnitude[11:10]}
866 * [3:0]: max_exp (shift amount to size max bin to 8-bit unsigned)
867 */
868struct ath_ht20_40_mag_info {
869 u8 lower_bins[3];
870 u8 upper_bins[3];
871 u8 max_exp;
872} __packed;
873
874#define SPECTRAL_HT20_40_NUM_BINS 128
875
876/* WARNING: don't actually use this struct! MAC may vary the amount of
877 * data. This struct is for reference only.
878 */
879struct ath_ht20_40_fft_packet {
880 u8 data[SPECTRAL_HT20_40_NUM_BINS];
881 struct ath_ht20_40_mag_info mag_info;
882 struct ath_radar_info radar_info;
883} __packed;
884
885
886#define SPECTRAL_HT20_40_TOTAL_DATA_LEN (sizeof(struct ath_ht20_40_fft_packet))
887
888/* grabs the max magnitude from the all/upper/lower bins */
889static inline u16 spectral_max_magnitude(u8 *bins)
890{
891 return (bins[0] & 0xc0) >> 6 |
892 (bins[1] & 0xff) << 2 |
893 (bins[2] & 0x03) << 10;
894}
895
896/* return the max magnitude from the all/upper/lower bins */
897static inline u8 spectral_max_index(u8 *bins)
898{
899 s8 m = (bins[2] & 0xfc) >> 2;
900
901 /* TODO: this still doesn't always report the right values ... */
902 if (m > 32)
903 m |= 0xe0;
904 else
905 m &= ~0xe0;
906
907 return m + 29;
908}
909
910/* return the bitmap weight from the all/upper/lower bins */
911static inline u8 spectral_bitmap_weight(u8 *bins)
912{
913 return bins[0] & 0x3f;
914}
915
916/* FFT sample format given to userspace via debugfs.
917 *
918 * Please keep the type/length at the front position and change
919 * other fields after adding another sample type
920 *
921 * TODO: this might need rework when switching to nl80211-based
922 * interface.
923 */
924enum ath_fft_sample_type {
925 ATH_FFT_SAMPLE_HT20 = 1,
926 ATH_FFT_SAMPLE_HT20_40,
927};
928
929struct fft_sample_tlv {
930 u8 type; /* see ath_fft_sample */
931 __be16 length;
932 /* type dependent data follows */
933} __packed;
934
935struct fft_sample_ht20 {
936 struct fft_sample_tlv tlv;
937
938 u8 max_exp;
939
940 __be16 freq;
941 s8 rssi;
942 s8 noise;
943
944 __be16 max_magnitude;
945 u8 max_index;
946 u8 bitmap_weight;
947
948 __be64 tsf;
949
950 u8 data[SPECTRAL_HT20_NUM_BINS];
951} __packed;
952
953struct fft_sample_ht20_40 {
954 struct fft_sample_tlv tlv;
955
956 u8 channel_type;
957 __be16 freq;
958
959 s8 lower_rssi;
960 s8 upper_rssi;
961
962 __be64 tsf;
963
964 s8 lower_noise;
965 s8 upper_noise;
966
967 __be16 lower_max_magnitude;
968 __be16 upper_max_magnitude;
969
970 u8 lower_max_index;
971 u8 upper_max_index;
972
973 u8 lower_bitmap_weight;
974 u8 upper_bitmap_weight;
975
976 u8 max_exp;
977
978 u8 data[SPECTRAL_HT20_40_NUM_BINS];
979} __packed;
980
981/********/ 809/********/
982/* TX99 */ 810/* TX99 */
983/********/ 811/********/
@@ -1022,11 +850,6 @@ void ath9k_deinit_device(struct ath_softc *sc);
1022void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw); 850void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw);
1023void ath9k_reload_chainmask_settings(struct ath_softc *sc); 851void ath9k_reload_chainmask_settings(struct ath_softc *sc);
1024 852
1025void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw);
1026int ath9k_spectral_scan_config(struct ieee80211_hw *hw,
1027 enum spectral_mode spectral_mode);
1028
1029
1030#ifdef CONFIG_ATH9K_PCI 853#ifdef CONFIG_ATH9K_PCI
1031int ath_pci_init(void); 854int ath_pci_init(void);
1032void ath_pci_exit(void); 855void ath_pci_exit(void);