phydm_adaptivity.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2017 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * The full GNU General Public License is included in this distribution in the
  15. * file called LICENSE.
  16. *
  17. * Contact Information:
  18. * wlanfae <wlanfae@realtek.com>
  19. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  20. * Hsinchu 300, Taiwan.
  21. *
  22. * Larry Finger <Larry.Finger@lwfinger.net>
  23. *
  24. *****************************************************************************/
  25. #ifndef __PHYDMADAPTIVITY_H__
  26. #define __PHYDMADAPTIVITY_H__
  27. #define ADAPTIVITY_VERSION "9.5.20" /*@20180306 changed by Kevin,
  28. *remove phydm lna set and use halrf part
  29. */
  30. #define PWDB_UPPER_BOUND 7
  31. #define DFIR_LOSS 7
  32. #define ODM_IC_PWDB_EDCCA (ODM_RTL8188E | ODM_RTL8723B | ODM_RTL8192E |\
  33. ODM_RTL8881A | ODM_RTL8821 | ODM_RTL8812)
  34. #if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_AP))
  35. #define ADAPT_DC_BACKOFF 2
  36. #elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  37. #define ADAPT_DC_BACKOFF 4
  38. #elif (DM_ODM_SUPPORT_TYPE & ODM_IOT)
  39. #define ADAPT_DC_BACKOFF 0
  40. #endif
  41. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
  42. enum phydm_regulation_type {
  43. REGULATION_FCC = 0,
  44. REGULATION_MKK = 1,
  45. REGULATION_ETSI = 2,
  46. REGULATION_WW = 3,
  47. MAX_REGULATION_NUM = 4
  48. };
  49. #endif
  50. enum phydm_adapinfo {
  51. PHYDM_ADAPINFO_CARRIER_SENSE_ENABLE = 0,
  52. PHYDM_ADAPINFO_TH_L2H_INI,
  53. PHYDM_ADAPINFO_TH_EDCCA_HL_DIFF,
  54. PHYDM_ADAPINFO_AP_NUM_TH,
  55. PHYDM_ADAPINFO_DOMAIN_CODE_2G,
  56. PHYDM_ADAPINFO_DOMAIN_CODE_5G
  57. };
  58. enum phydm_mac_edcca_type {
  59. PHYDM_IGNORE_EDCCA = 0,
  60. PHYDM_DONT_IGNORE_EDCCA = 1
  61. };
  62. enum phydm_adaptivity_mode {
  63. PHYDM_ADAPT_MSG = 0,
  64. PHYDM_ADAPT_DEBUG = 1,
  65. PHYDM_ADAPT_RESUME = 2,
  66. PHYDM_EDCCA_TH_PAUSE = 3,
  67. PHYDM_EDCCA_RESUME = 4
  68. };
  69. struct phydm_adaptivity_struct {
  70. s8 th_l2h_ini_backup;
  71. s8 th_edcca_hl_diff_backup;
  72. s8 igi_base;
  73. u8 igi_target;
  74. s8 h2l_lb;
  75. s8 l2h_lb;
  76. u8 ap_num_th;
  77. u8 adajust_igi_level;
  78. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  79. RT_WORK_ITEM phydm_pause_edcca_work_item;
  80. RT_WORK_ITEM phydm_resume_edcca_work_item;
  81. #endif
  82. u32 adaptivity_dbg_port; /*N:0x208, AC:0x209*/
  83. u8 debug_mode;
  84. u16 igi_up_bound_lmt_cnt; /*@When igi_up_bound_lmt_cnt !=0, limit IGI upper bound to "adapt_igi_up"*/
  85. u16 igi_up_bound_lmt_val; /*@max value of igi_up_bound_lmt_cnt*/
  86. boolean igi_lmt_en;
  87. u8 adapt_igi_up;
  88. s8 rvrt_val[2];
  89. s8 th_l2h;
  90. s8 th_h2l;
  91. u8 regulation_2g;
  92. u8 regulation_5g;
  93. boolean is_adapt_en;
  94. boolean edcca_en;
  95. s8 th_l2h_ini_mode2;
  96. s8 th_edcca_hl_diff_mode2;
  97. };
  98. #ifdef PHYDM_SUPPORT_ADAPTIVITY
  99. void phydm_adaptivity_debug(void *dm_void, char input[][16], u32 *_used,
  100. char *output, u32 *_out_len);
  101. void phydm_set_edcca_val(void *dm_void, u32 *val_buf, u8 val_len);
  102. #endif
  103. void phydm_set_edcca_threshold_api(void *dm_void, u8 IGI);
  104. void phydm_adaptivity_info_init(void *dm_void, enum phydm_adapinfo cmn_info,
  105. u32 value);
  106. void phydm_adaptivity_info_update(void *dm_void, enum phydm_adapinfo cmn_info,
  107. u32 value);
  108. void phydm_adaptivity_init(void *dm_void);
  109. void phydm_adaptivity(void *dm_void);
  110. void phydm_pause_edcca(void *dm_void, boolean is_pasue_edcca);
  111. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  112. void phydm_pause_edcca_work_item_callback(void *adapter);
  113. void phydm_resume_edcca_work_item_callback(void *adapter);
  114. #endif
  115. #endif