halrf_powertracking.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. /* ************************************************************
  26. * include files
  27. * ************************************************************
  28. */
  29. #include "mp_precomp.h"
  30. #include "phydm_precomp.h"
  31. boolean
  32. odm_check_power_status(void *dm_void)
  33. {
  34. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  35. struct dm_struct *dm = (struct dm_struct *)dm_void;
  36. PADAPTER *adapter = dm->adapter;
  37. RT_RF_POWER_STATE rt_state;
  38. MGNT_INFO *mgnt_info = &((PADAPTER)adapter)->MgntInfo;
  39. /* 2011/07/27 MH We are not testing ready~~!! We may fail to get correct value when init sequence. */
  40. if (mgnt_info->init_adpt_in_progress == true) {
  41. RF_DBG(dm, DBG_RF_INIT,
  42. "check_pow_status Return true, due to initadapter\n");
  43. return true;
  44. }
  45. /*
  46. * 2011/07/19 MH We can not execute tx pwoer tracking/ LLC calibrate or IQK.
  47. */
  48. ((PADAPTER)adapter)->HalFunc.GetHwRegHandler((PADAPTER)adapter, HW_VAR_RF_STATE, (u8 *)(&rt_state));
  49. if (((PADAPTER)adapter)->bDriverStopped || ((PADAPTER)adapter)->bDriverIsGoingToPnpSetPowerSleep || rt_state == eRfOff) {
  50. RF_DBG(dm, DBG_RF_INIT,
  51. "check_pow_status Return false, due to %d/%d/%d\n",
  52. ((PADAPTER)adapter)->bDriverStopped,
  53. ((PADAPTER)adapter)->bDriverIsGoingToPnpSetPowerSleep,
  54. rt_state);
  55. return false;
  56. }
  57. #endif
  58. return true;
  59. }
  60. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
  61. void halrf_update_pwr_track(void *dm_void, u8 rate)
  62. {
  63. struct dm_struct *dm = (struct dm_struct *)dm_void;
  64. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  65. u8 path_idx = 0;
  66. #endif
  67. RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "Pwr Track Get rate=0x%x\n", rate);
  68. dm->tx_rate = rate;
  69. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  70. #if DEV_BUS_TYPE == RT_PCI_INTERFACE
  71. #if USE_WORKITEM
  72. odm_schedule_work_item(&dm->ra_rpt_workitem);
  73. #else
  74. if (dm->support_ic_type == ODM_RTL8821) {
  75. #if (RTL8821A_SUPPORT == 1)
  76. odm_tx_pwr_track_set_pwr8821a(dm, MIX_MODE, RF_PATH_A, 0);
  77. #endif
  78. } else if (dm->support_ic_type == ODM_RTL8812) {
  79. for (path_idx = RF_PATH_A; path_idx < MAX_PATH_NUM_8812A; path_idx++) {
  80. #if (RTL8812A_SUPPORT == 1)
  81. odm_tx_pwr_track_set_pwr8812a(dm, MIX_MODE, path_idx, 0);
  82. #endif
  83. }
  84. } else if (dm->support_ic_type == ODM_RTL8723B) {
  85. #if (RTL8723B_SUPPORT == 1)
  86. odm_tx_pwr_track_set_pwr_8723b(dm, MIX_MODE, RF_PATH_A, 0);
  87. #endif
  88. } else if (dm->support_ic_type == ODM_RTL8192E) {
  89. for (path_idx = RF_PATH_A; path_idx < MAX_PATH_NUM_8192E; path_idx++) {
  90. #if (RTL8192E_SUPPORT == 1)
  91. odm_tx_pwr_track_set_pwr92_e(dm, MIX_MODE, path_idx, 0);
  92. #endif
  93. }
  94. } else if (dm->support_ic_type == ODM_RTL8188E) {
  95. #if (RTL8188E_SUPPORT == 1)
  96. odm_tx_pwr_track_set_pwr88_e(dm, MIX_MODE, RF_PATH_A, 0);
  97. #endif
  98. }
  99. #endif
  100. #else
  101. odm_schedule_work_item(&dm->ra_rpt_workitem);
  102. #endif
  103. #endif
  104. }
  105. #endif
  106. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  107. void halrf_update_init_rate_work_item_callback(
  108. void *context)
  109. {
  110. void *adapter = (void *)context;
  111. HAL_DATA_TYPE *hal_data = GET_HAL_DATA(((PADAPTER)adapter));
  112. struct dm_struct *dm = &hal_data->DM_OutSrc;
  113. u8 p = 0;
  114. if (dm->support_ic_type == ODM_RTL8821) {
  115. #if (RTL8821A_SUPPORT == 1)
  116. odm_tx_pwr_track_set_pwr8821a(dm, MIX_MODE, RF_PATH_A, 0);
  117. #endif
  118. } else if (dm->support_ic_type == ODM_RTL8812) {
  119. #if (RTL8812A_SUPPORT == 1)
  120. /*Don't know how to include &c*/
  121. for (p = RF_PATH_A; p < MAX_PATH_NUM_8812A; p++)
  122. odm_tx_pwr_track_set_pwr8812a(dm, MIX_MODE, p, 0);
  123. #endif
  124. } else if (dm->support_ic_type == ODM_RTL8723B) {
  125. #if (RTL8723B_SUPPORT == 1)
  126. odm_tx_pwr_track_set_pwr_8723b(dm, MIX_MODE, RF_PATH_A, 0);
  127. #endif
  128. } else if (dm->support_ic_type == ODM_RTL8192E) {
  129. #if (RTL8192E_SUPPORT == 1)
  130. /*Don't know how to include &c*/
  131. for (p = RF_PATH_A; p < MAX_PATH_NUM_8192E; p++)
  132. odm_tx_pwr_track_set_pwr92_e(dm, MIX_MODE, p, 0);
  133. #endif
  134. } else if (dm->support_ic_type == ODM_RTL8188E) {
  135. #if (RTL8188E_SUPPORT == 1)
  136. odm_tx_pwr_track_set_pwr88_e(dm, MIX_MODE, RF_PATH_A, 0);
  137. #endif
  138. }
  139. }
  140. #endif