rtw88: set power trim according to efuse PG values
PATCH v2 1/1 rtw88: set power trim according to efuse PG values
From: Tzu-En Huang <[email protected]>
8822C devices have power trim, thermal and PA bias values programmed in efuse. Driver should configure the RF components according to the values.
If the power trim is not configured, then the devices might have distortion on the output tx power.
---
v1 -> v2
* disable DPD low rates
drivers/net/wireless/realtek/rtw88/efuse.c | 21 ++++ drivers/net/wireless/realtek/rtw88/efuse.h | 3 + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 113 ++++++++++++++++++ drivers/net/wireless/realtek/rtw88/rtw8822c.h | 28 +++++ 4 files changed, 165 insertions(+)
drivers/net/wireless/realtek/rtw88/efuse.c +21 -0
@@ -116,6 +116,27 @@ static int rtw_dump_physical_efuse_map(struct rtw_dev *rtwdev, u8 *map)return 0 ; } +int rtw_read8_physical_efuse (struct rtw_dev *rtwdev,u16 addr,u8 *data) +{ +u32 efuse_ctl, cnt; + +rtw_write32_mask (rtwdev,REG_EFUSE_CTRL ,0x3ff00 , addr); +rtw_write32_clr (rtwdev,REG_EFUSE_CTRL ,BIT_EF_FLAG ); + cnt =1000 ; +do { +mdelay (1 ); + efuse_ctl =rtw_read32 (rtwdev,REG_EFUSE_CTRL ); +if (--cnt ==0 ) { + *data =EFUSE_READ_FAIL ; +return -EBUSY ; + } + }while (!(efuse_ctl &BIT_EF_FLAG )); + + *data =rtw_read8 (rtwdev,REG_EFUSE_CTRL ); + +return 0 ; +} +int rtw_parse_efuse_map (struct rtw_dev *rtwdev) {struct rtw_chip_info *chip = rtwdev->chip;
drivers/net/wireless/realtek/rtw88/efuse.h +3 -0
@@ -10,6 +10,8 @@#define EFUSE_HW_CAP_SUPP_BW80 7#define EFUSE_HW_CAP_SUPP_BW40 6 +#define EFUSE_READ_FAIL 0xff +#define GET_EFUSE_HW_CAP_HCI (hw_cap) \ le32_get_bits(*((__le32 *)(hw_cap) + 0x01), GENMASK(3, 0))#define GET_EFUSE_HW_CAP_BW (hw_cap) \
@@ -22,5 +24,6 @@ le32_get_bits(*((__le32 *)(hw_cap) + 0x01), GENMASK(27, 26))int rtw_parse_efuse_map (struct rtw_dev *rtwdev); +int rtw_read8_physical_efuse (struct rtw_dev *rtwdev,u16 addr,u8 *data);#endif
drivers/net/wireless/realtek/rtw88/rtw8822c.c +113 -0
129 lines not on this page · raw message
drivers/net/wireless/realtek/rtw88/rtw8822c.h +28 -0
@@ -309,4 +309,32 @@ const struct rtw_table name ## _tbl = { \#define BIT_GS_PWSF GENMASK(27, 0)#define BIT_RPT_DGAIN GENMASK(27, 16)#define BIT_TX_CFIR GENMASK(31, 30) + +#define PPG_THERMAL_A 0x1ef +#define PPG_THERMAL_B 0x1b0 +#define RF_THEMAL_MASK GENMASK(19, 16) +#define PPG_2GL_TXAB 0x1d4 +#define PPG_2GM_TXAB 0x1ee +#define PPG_2GH_TXAB 0x1d2 +#define PPG_2G_A_MASK GENMASK(3, 0) +#define PPG_2G_B_MASK GENMASK(7, 4) +#define PPG_5GL1_TXA 0x1ec +#define PPG_5GL2_TXA 0x1e8 +#define PPG_5GM1_TXA 0x1e4 +#define PPG_5GM2_TXA 0x1e0 +#define PPG_5GH1_TXA 0x1dc +#define PPG_5GL1_TXB 0x1eb +#define PPG_5GL2_TXB 0x1e7 +#define PPG_5GM1_TXB 0x1e3 +#define PPG_5GM2_TXB 0x1df +#define PPG_5GH1_TXB 0x1db +#define PPG_5G_MASK GENMASK(4, 0) +#define PPG_PABIAS_2GA 0x1d6 +#define PPG_PABIAS_2GB 0x1d5 +#define PPG_PABIAS_5GA 0x1d8 +#define PPG_PABIAS_5GB 0x1d7 +#define PPG_PABIAS_MASK GENMASK(3, 0) +#define RF_PABIAS_2G_MASK GENMASK(15, 12) +#define RF_PABIAS_5G_MASK GENMASK(19, 16) +#endif
Signature · 1 line
2.17.1
Quoted 11 lines · <[email protected]> wrote:
From: Tzu-En Huang <[email protected]>
8822C devices have power trim, thermal and PA bias values programmed in efuse. Driver should configure the RF components according to the values.
If the power trim is not configured, then the devices might have distortion on the output tx power.
Signed-off-by Tzu-En Huang <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>
You didn't use read_poll_timeout() like Chris suggested?
Signature · 3 lines
https://patchwork.kernel.org/patch/11492217/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 8 lines
Quoted 6 lines · <[email protected]> wrote:
From: Tzu-En Huang <[email protected]>
8822C devices have power trim, thermal and PA bias values programmed in efuse. Driver should configure the RF components according to the values.
Quoted 8 lines
Quoted 5 lines
If the power trim is not configured, then the devices might have distortion on the output tx power.
Signed-off-by Tzu-En Huang <[email protected]>Signed-off-by Yan-Hsuan Chuang <[email protected]>You didn't use
read_poll_timeout()like Chris suggested?
Missed that, will resend another.
Yen-Hsuan