rtw8852b.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2. /* Copyright(c) 2019-2022 Realtek Corporation
  3. */
  4. #ifndef __RTW89_8852B_H__
  5. #define __RTW89_8852B_H__
  6. #include "core.h"
  7. #define RF_PATH_NUM_8852B 2
  8. #define BB_PATH_NUM_8852B 2
  9. enum rtw8852b_pmac_mode {
  10. NONE_TEST,
  11. PKTS_TX,
  12. PKTS_RX,
  13. CONT_TX
  14. };
  15. struct rtw8852b_u_efuse {
  16. u8 rsvd[0x88];
  17. u8 mac_addr[ETH_ALEN];
  18. };
  19. struct rtw8852b_e_efuse {
  20. u8 mac_addr[ETH_ALEN];
  21. };
  22. struct rtw8852b_tssi_offset {
  23. u8 cck_tssi[TSSI_CCK_CH_GROUP_NUM];
  24. u8 bw40_tssi[TSSI_MCS_2G_CH_GROUP_NUM];
  25. u8 rsvd[7];
  26. u8 bw40_1s_tssi_5g[TSSI_MCS_5G_CH_GROUP_NUM];
  27. } __packed;
  28. struct rtw8852b_efuse {
  29. u8 rsvd[0x210];
  30. struct rtw8852b_tssi_offset path_a_tssi;
  31. u8 rsvd1[10];
  32. struct rtw8852b_tssi_offset path_b_tssi;
  33. u8 rsvd2[94];
  34. u8 channel_plan;
  35. u8 xtal_k;
  36. u8 rsvd3;
  37. u8 iqk_lck;
  38. u8 rsvd4[5];
  39. u8 reg_setting:2;
  40. u8 tx_diversity:1;
  41. u8 rx_diversity:2;
  42. u8 ac_mode:1;
  43. u8 module_type:2;
  44. u8 rsvd5;
  45. u8 shared_ant:1;
  46. u8 coex_type:3;
  47. u8 ant_iso:1;
  48. u8 radio_on_off:1;
  49. u8 rsvd6:2;
  50. u8 eeprom_version;
  51. u8 customer_id;
  52. u8 tx_bb_swing_2g;
  53. u8 tx_bb_swing_5g;
  54. u8 tx_cali_pwr_trk_mode;
  55. u8 trx_path_selection;
  56. u8 rfe_type;
  57. u8 country_code[2];
  58. u8 rsvd7[3];
  59. u8 path_a_therm;
  60. u8 path_b_therm;
  61. u8 rsvd8[2];
  62. u8 rx_gain_2g_ofdm;
  63. u8 rsvd9;
  64. u8 rx_gain_2g_cck;
  65. u8 rsvd10;
  66. u8 rx_gain_5g_low;
  67. u8 rsvd11;
  68. u8 rx_gain_5g_mid;
  69. u8 rsvd12;
  70. u8 rx_gain_5g_high;
  71. u8 rsvd13[35];
  72. u8 path_a_cck_pwr_idx[6];
  73. u8 path_a_bw40_1tx_pwr_idx[5];
  74. u8 path_a_ofdm_1tx_pwr_idx_diff:4;
  75. u8 path_a_bw20_1tx_pwr_idx_diff:4;
  76. u8 path_a_bw20_2tx_pwr_idx_diff:4;
  77. u8 path_a_bw40_2tx_pwr_idx_diff:4;
  78. u8 path_a_cck_2tx_pwr_idx_diff:4;
  79. u8 path_a_ofdm_2tx_pwr_idx_diff:4;
  80. u8 rsvd14[0xf2];
  81. union {
  82. struct rtw8852b_u_efuse u;
  83. struct rtw8852b_e_efuse e;
  84. };
  85. } __packed;
  86. struct rtw8852b_bb_pmac_info {
  87. u8 en_pmac_tx:1;
  88. u8 is_cck:1;
  89. u8 mode:3;
  90. u8 rsvd:3;
  91. u16 tx_cnt;
  92. u16 period;
  93. u16 tx_time;
  94. u8 duty_cycle;
  95. };
  96. struct rtw8852b_bb_tssi_bak {
  97. u8 tx_path;
  98. u8 rx_path;
  99. u32 p0_rfmode;
  100. u32 p0_rfmode_ftm;
  101. u32 p1_rfmode;
  102. u32 p1_rfmode_ftm;
  103. s16 tx_pwr; /* S9 */
  104. };
  105. extern const struct rtw89_chip_info rtw8852b_chip_info;
  106. void rtw8852b_bb_set_plcp_tx(struct rtw89_dev *rtwdev);
  107. void rtw8852b_bb_set_pmac_tx(struct rtw89_dev *rtwdev,
  108. struct rtw8852b_bb_pmac_info *tx_info,
  109. enum rtw89_phy_idx idx);
  110. void rtw8852b_bb_set_pmac_pkt_tx(struct rtw89_dev *rtwdev, u8 enable,
  111. u16 tx_cnt, u16 period, u16 tx_time,
  112. enum rtw89_phy_idx idx);
  113. void rtw8852b_bb_set_power(struct rtw89_dev *rtwdev, s16 pwr_dbm,
  114. enum rtw89_phy_idx idx);
  115. void rtw8852b_bb_cfg_tx_path(struct rtw89_dev *rtwdev, u8 tx_path);
  116. void rtw8852b_bb_ctrl_rx_path(struct rtw89_dev *rtwdev,
  117. enum rtw89_rf_path_bit rx_path);
  118. void rtw8852b_bb_tx_mode_switch(struct rtw89_dev *rtwdev,
  119. enum rtw89_phy_idx idx, u8 mode);
  120. void rtw8852b_bb_backup_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx idx,
  121. struct rtw8852b_bb_tssi_bak *bak);
  122. void rtw8852b_bb_restore_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx idx,
  123. const struct rtw8852b_bb_tssi_bak *bak);
  124. #endif