mt76x2_dfs.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (C) 2016 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef __MT76x2_DFS_H
  17. #define __MT76x2_DFS_H
  18. #include <linux/types.h>
  19. #include <linux/nl80211.h>
  20. #define MT_DFS_GP_INTERVAL (10 << 4) /* 64 us unit */
  21. #define MT_DFS_NUM_ENGINES 4
  22. /* bbp params */
  23. #define MT_DFS_SYM_ROUND 0
  24. #define MT_DFS_DELTA_DELAY 2
  25. #define MT_DFS_VGA_MASK 0
  26. #define MT_DFS_PWR_GAIN_OFFSET 3
  27. #define MT_DFS_PWR_DOWN_TIME 0xf
  28. #define MT_DFS_RX_PE_MASK 0xff
  29. #define MT_DFS_PKT_END_MASK 0
  30. #define MT_DFS_CH_EN 0xf
  31. struct mt76x2_radar_specs {
  32. u8 mode;
  33. u16 avg_len;
  34. u16 e_low;
  35. u16 e_high;
  36. u16 w_low;
  37. u16 w_high;
  38. u16 w_margin;
  39. u32 t_low;
  40. u32 t_high;
  41. u16 t_margin;
  42. u32 b_low;
  43. u32 b_high;
  44. u32 event_expiration;
  45. u16 pwr_jmp;
  46. };
  47. struct mt76x2_dfs_hw_pulse {
  48. u8 engine;
  49. u32 period;
  50. u32 w1;
  51. u32 w2;
  52. u32 burst;
  53. };
  54. struct mt76x2_dfs_engine_stats {
  55. u32 hw_pattern;
  56. u32 hw_pulse_discarded;
  57. };
  58. struct mt76x2_dfs_pattern_detector {
  59. enum nl80211_dfs_regions region;
  60. u8 chirp_pulse_cnt;
  61. u32 chirp_pulse_ts;
  62. struct mt76x2_dfs_engine_stats stats[MT_DFS_NUM_ENGINES];
  63. struct tasklet_struct dfs_tasklet;
  64. };
  65. void mt76x2_dfs_init_params(struct mt76x2_dev *dev);
  66. void mt76x2_dfs_init_detector(struct mt76x2_dev *dev);
  67. void mt76x2_dfs_adjust_agc(struct mt76x2_dev *dev);
  68. void mt76x2_dfs_set_domain(struct mt76x2_dev *dev,
  69. enum nl80211_dfs_regions region);
  70. #endif /* __MT76x2_DFS_H */