Lines Matching +full:disable +full:- +full:radar +full:- +full:background

33 	if (!spec_priv->rfs_chan_spec_scan)  in ath_debug_send_fft_sample()
36 length = __be16_to_cpu(fft_sample_tlv->length) + in ath_debug_send_fft_sample()
38 relay_write(spec_priv->rfs_chan_spec_scan, fft_sample_tlv, length); in ath_debug_send_fft_sample()
55 if (bytes_read < SPECTRAL_HT20_SAMPLE_LEN - 1) in ath_cmn_max_idx_verify_ht20_fft()
56 return -1; in ath_cmn_max_idx_verify_ht20_fft()
58 mag_info = (struct ath_ht20_mag_info *) (sample_end - in ath_cmn_max_idx_verify_ht20_fft()
61 sample = sample_end - SPECTRAL_HT20_SAMPLE_LEN + 1; in ath_cmn_max_idx_verify_ht20_fft()
63 max_index = spectral_max_index_ht20(mag_info->all_bins); in ath_cmn_max_idx_verify_ht20_fft()
64 max_magnitude = spectral_max_magnitude(mag_info->all_bins); in ath_cmn_max_idx_verify_ht20_fft()
66 max_exp = mag_info->max_exp & 0xf; in ath_cmn_max_idx_verify_ht20_fft()
73 return -1; in ath_cmn_max_idx_verify_ht20_fft()
76 return -1; in ath_cmn_max_idx_verify_ht20_fft()
94 if (bytes_read < SPECTRAL_HT20_40_SAMPLE_LEN - 1) in ath_cmn_max_idx_verify_ht20_40_fft()
95 return -1; in ath_cmn_max_idx_verify_ht20_40_fft()
97 mag_info = (struct ath_ht20_40_mag_info *) (sample_end - in ath_cmn_max_idx_verify_ht20_40_fft()
100 sample = sample_end - SPECTRAL_HT20_40_SAMPLE_LEN + 1; in ath_cmn_max_idx_verify_ht20_40_fft()
102 lower_mag = spectral_max_magnitude(mag_info->lower_bins); in ath_cmn_max_idx_verify_ht20_40_fft()
103 lower_max_index = spectral_max_index_ht40(mag_info->lower_bins); in ath_cmn_max_idx_verify_ht20_40_fft()
105 upper_mag = spectral_max_magnitude(mag_info->upper_bins); in ath_cmn_max_idx_verify_ht20_40_fft()
106 upper_max_index = spectral_max_index_ht40(mag_info->upper_bins); in ath_cmn_max_idx_verify_ht20_40_fft()
108 max_exp = mag_info->max_exp & 0xf; in ath_cmn_max_idx_verify_ht20_40_fft()
116 return -1; in ath_cmn_max_idx_verify_ht20_40_fft()
122 return -1; in ath_cmn_max_idx_verify_ht20_40_fft()
138 struct ath_common *common = ath9k_hw_common(spec_priv->ah); in ath_cmn_process_ht20_fft()
139 struct ath_hw *ah = spec_priv->ah; in ath_cmn_process_ht20_fft()
148 length = sizeof(fft_sample_20) - sizeof(struct fft_sample_tlv); in ath_cmn_process_ht20_fft()
152 fft_sample_20.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]); in ath_cmn_process_ht20_fft()
153 fft_sample_20.noise = ah->noise; in ath_cmn_process_ht20_fft()
158 magnitude = spectral_max_magnitude(mag_info->all_bins); in ath_cmn_process_ht20_fft()
161 max_index = spectral_max_index_ht20(mag_info->all_bins); in ath_cmn_process_ht20_fft()
164 bitmap_w = spectral_bitmap_weight(mag_info->all_bins); in ath_cmn_process_ht20_fft()
167 max_exp = mag_info->max_exp & 0xf; in ath_cmn_process_ht20_fft()
182 ret = -1; in ath_cmn_process_ht20_fft()
189 fft_sample_20.data[dc_pos - 1]) / 2; in ath_cmn_process_ht20_fft()
221 ret = -1; in ath_cmn_process_ht20_fft()
242 struct ath_common *common = ath9k_hw_common(spec_priv->ah); in ath_cmn_process_ht20_40_fft()
243 struct ath_hw *ah = spec_priv->ah; in ath_cmn_process_ht20_40_fft()
244 struct ath9k_hw_cal_data *caldata = ah->caldata; in ath_cmn_process_ht20_40_fft()
257 ext_nf = ath9k_hw_getchan_noise(ah, ah->curchan, in ath_cmn_process_ht20_40_fft()
258 caldata->nfCalHist[3].privNF); in ath_cmn_process_ht20_40_fft()
262 length = sizeof(fft_sample_40) - sizeof(struct fft_sample_tlv); in ath_cmn_process_ht20_40_fft()
269 lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]); in ath_cmn_process_ht20_40_fft()
270 upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ext[0]); in ath_cmn_process_ht20_40_fft()
272 fft_sample_40.lower_noise = ah->noise; in ath_cmn_process_ht20_40_fft()
275 lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ext[0]); in ath_cmn_process_ht20_40_fft()
276 upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]); in ath_cmn_process_ht20_40_fft()
279 fft_sample_40.upper_noise = ah->noise; in ath_cmn_process_ht20_40_fft()
288 lower_mag = spectral_max_magnitude(mag_info->lower_bins); in ath_cmn_process_ht20_40_fft()
291 upper_mag = spectral_max_magnitude(mag_info->upper_bins); in ath_cmn_process_ht20_40_fft()
294 lower_max_index = spectral_max_index_ht40(mag_info->lower_bins); in ath_cmn_process_ht20_40_fft()
297 upper_max_index = spectral_max_index_ht40(mag_info->upper_bins); in ath_cmn_process_ht20_40_fft()
300 lower_bitmap_w = spectral_bitmap_weight(mag_info->lower_bins); in ath_cmn_process_ht20_40_fft()
303 upper_bitmap_w = spectral_bitmap_weight(mag_info->upper_bins); in ath_cmn_process_ht20_40_fft()
306 max_exp = mag_info->max_exp & 0xf; in ath_cmn_process_ht20_40_fft()
329 ret = -1; in ath_cmn_process_ht20_40_fft()
336 fft_sample_40.data[dc_pos - 1]) / 2; in ath_cmn_process_ht20_40_fft()
368 ret = -1; in ath_cmn_process_ht20_40_fft()
398 ret = -1; in ath_cmn_process_ht20_40_fft()
415 switch (sample_bytes - sample_len) { in ath_cmn_copy_fft_frame()
416 case -1: in ath_cmn_copy_fft_frame()
419 sample_len - 1); in ath_cmn_copy_fft_frame()
432 sample_len - 32); in ath_cmn_copy_fft_frame()
441 sample_len - 31); in ath_cmn_copy_fft_frame()
454 struct rchan *rc = spec_priv->rfs_chan_spec_scan; in ath_cmn_is_fft_buf_full()
457 if ((buf = *per_cpu_ptr(rc->buf, i))) { in ath_cmn_is_fft_buf_full()
473 struct ath_hw *ah = spec_priv->ah; in ath_cmn_process_fft()
474 struct ath_common *common = ath9k_hw_common(spec_priv->ah); in ath_cmn_process_fft()
475 struct ath_softc *sc = common->priv; in ath_cmn_process_fft()
478 int len = rs->rs_datalen; in ath_cmn_process_fft()
484 u16 fft_len, sample_len, freq = ah->curchan->chan->center_freq; in ath_cmn_process_fft()
493 if (rs->rs_phyerr != ATH9K_PHYERR_RADAR && in ath_cmn_process_fft()
494 rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT && in ath_cmn_process_fft()
495 rs->rs_phyerr != ATH9K_PHYERR_SPECTRAL) in ath_cmn_process_fft()
501 radar_info = ((struct ath_radar_info *)&vdata[len]) - 1; in ath_cmn_process_fft()
502 if (!(radar_info->pulse_bw_info & SPECTRAL_SCAN_BITMASK)) in ath_cmn_process_fft()
505 if (!spec_priv->rfs_chan_spec_scan) in ath_cmn_process_fft()
518 chan_type = cfg80211_get_chandef_type(&common->hw->conf.chandef); in ath_cmn_process_fft()
534 ath_dbg(common, SPECTRAL_SCAN, "Got radar dump bw_info: 0x%X," in ath_cmn_process_fft()
536 radar_info->pulse_bw_info, in ath_cmn_process_fft()
540 for (i = 0; i < len - 2; i++) { in ath_cmn_process_fft()
550 sample_bytes = len - sizeof(struct ath_radar_info); in ath_cmn_process_fft()
555 * sample_len - 1 and sample_len + 2. exp_max is 3 in ath_cmn_process_fft()
561 if (vdata[i] <= 0x7 && sample_bytes >= sample_len - 1) { in ath_cmn_process_fft()
566 * a) sample_len -> We got the correct length in ath_cmn_process_fft()
567 * b) sample_len + 2 -> 2 bytes added around bin[31] in ath_cmn_process_fft()
568 * c) sample_len - 1 -> The first byte is missing in ath_cmn_process_fft()
569 * d) sample_len + 1 -> b + c at the same time in ath_cmn_process_fft()
588 * Failure is non-fatal, later frames may in ath_cmn_process_fft()
597 /* We expect 1 - 2 more bytes */ in ath_cmn_process_fft()
605 else if ((sample_bytes == sample_len - 1) && in ath_cmn_process_fft()
664 /* -1 to grab sample_len -1, -2 since in ath_cmn_process_fft()
670 i += num_bins - 2; in ath_cmn_process_fft()
671 sample_bytes = num_bins - 2; in ath_cmn_process_fft()
677 i -= num_bins - 2; in ath_cmn_process_fft()
678 if (len - i != sizeof(struct ath_radar_info)) in ath_cmn_process_fft()
681 len - i); in ath_cmn_process_fft()
693 struct ath_spec_scan_priv *spec_priv = file->private_data; in read_file_spec_scan_ctl()
697 switch (spec_priv->spectral_mode) { in read_file_spec_scan_ctl()
699 mode = "disable"; in read_file_spec_scan_ctl()
702 mode = "background"; in read_file_spec_scan_ctl()
718 struct ath_hw *ah = spec_priv->ah; in ath9k_cmn_spectral_scan_trigger()
724 if (!ath9k_hw_ops(ah)->spectral_scan_trigger) { in ath9k_cmn_spectral_scan_trigger()
729 if (!spec_priv->spec_config.enabled) in ath9k_cmn_spectral_scan_trigger()
732 ath_ps_ops(common)->wakeup(common); in ath9k_cmn_spectral_scan_trigger()
743 ath9k_cmn_spectral_scan_config(common, spec_priv, spec_priv->spectral_mode); in ath9k_cmn_spectral_scan_trigger()
744 ath9k_hw_ops(ah)->spectral_scan_trigger(ah); in ath9k_cmn_spectral_scan_trigger()
745 ath_ps_ops(common)->restore(common); in ath9k_cmn_spectral_scan_trigger()
753 struct ath_hw *ah = spec_priv->ah; in ath9k_cmn_spectral_scan_config()
755 if (!ath9k_hw_ops(ah)->spectral_scan_trigger) { in ath9k_cmn_spectral_scan_config()
757 return -1; in ath9k_cmn_spectral_scan_config()
762 spec_priv->spec_config.enabled = 0; in ath9k_cmn_spectral_scan_config()
766 * TODO: is this really useful for "background"? in ath9k_cmn_spectral_scan_config()
768 spec_priv->spec_config.endless = 1; in ath9k_cmn_spectral_scan_config()
769 spec_priv->spec_config.enabled = 1; in ath9k_cmn_spectral_scan_config()
773 spec_priv->spec_config.endless = 0; in ath9k_cmn_spectral_scan_config()
774 spec_priv->spec_config.enabled = 1; in ath9k_cmn_spectral_scan_config()
777 return -1; in ath9k_cmn_spectral_scan_config()
780 ath_ps_ops(common)->wakeup(common); in ath9k_cmn_spectral_scan_config()
781 ath9k_hw_ops(ah)->spectral_scan_config(ah, &spec_priv->spec_config); in ath9k_cmn_spectral_scan_config()
782 ath_ps_ops(common)->restore(common); in ath9k_cmn_spectral_scan_config()
784 spec_priv->spectral_mode = spectral_mode; in ath9k_cmn_spectral_scan_config()
794 struct ath_spec_scan_priv *spec_priv = file->private_data; in write_file_spec_scan_ctl()
795 struct ath_common *common = ath9k_hw_common(spec_priv->ah); in write_file_spec_scan_ctl()
800 return -EOPNOTSUPP; in write_file_spec_scan_ctl()
802 len = min(count, sizeof(buf) - 1); in write_file_spec_scan_ctl()
804 return -EFAULT; in write_file_spec_scan_ctl()
810 } else if (strncmp("background", buf, 10) == 0) { in write_file_spec_scan_ctl()
812 ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n"); in write_file_spec_scan_ctl()
819 } else if (strncmp("disable", buf, 7) == 0) { in write_file_spec_scan_ctl()
823 return -EINVAL; in write_file_spec_scan_ctl()
845 struct ath_spec_scan_priv *spec_priv = file->private_data; in read_file_spectral_short_repeat()
849 len = sprintf(buf, "%d\n", spec_priv->spec_config.short_repeat); in read_file_spectral_short_repeat()
857 struct ath_spec_scan_priv *spec_priv = file->private_data; in write_file_spectral_short_repeat()
866 return -EINVAL; in write_file_spectral_short_repeat()
868 spec_priv->spec_config.short_repeat = val; in write_file_spectral_short_repeat()
888 struct ath_spec_scan_priv *spec_priv = file->private_data; in read_file_spectral_count()
892 len = sprintf(buf, "%d\n", spec_priv->spec_config.count); in read_file_spectral_count()
900 struct ath_spec_scan_priv *spec_priv = file->private_data; in write_file_spectral_count()
908 return -EINVAL; in write_file_spectral_count()
910 spec_priv->spec_config.count = val; in write_file_spectral_count()
930 struct ath_spec_scan_priv *spec_priv = file->private_data; in read_file_spectral_period()
934 len = sprintf(buf, "%d\n", spec_priv->spec_config.period); in read_file_spectral_period()
942 struct ath_spec_scan_priv *spec_priv = file->private_data; in write_file_spectral_period()
951 return -EINVAL; in write_file_spectral_period()
953 spec_priv->spec_config.period = val; in write_file_spectral_period()
973 struct ath_spec_scan_priv *spec_priv = file->private_data; in read_file_spectral_fft_period()
977 len = sprintf(buf, "%d\n", spec_priv->spec_config.fft_period); in read_file_spectral_fft_period()
985 struct ath_spec_scan_priv *spec_priv = file->private_data; in write_file_spectral_fft_period()
994 return -EINVAL; in write_file_spectral_fft_period()
996 spec_priv->spec_config.fft_period = val; in write_file_spectral_fft_period()
1047 if (spec_priv->rfs_chan_spec_scan) { in ath9k_cmn_spectral_deinit_debug()
1048 relay_close(spec_priv->rfs_chan_spec_scan); in ath9k_cmn_spectral_deinit_debug()
1049 spec_priv->rfs_chan_spec_scan = NULL; in ath9k_cmn_spectral_deinit_debug()
1057 spec_priv->rfs_chan_spec_scan = relay_open("spectral_scan", in ath9k_cmn_spectral_init_debug()
1061 if (!spec_priv->rfs_chan_spec_scan) in ath9k_cmn_spectral_init_debug()