Commit 1afb5eb7 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

rtw88: 8723d: Add cfg_ldo25 to control LDO25

Implement rtw_chip_ops::cfg_ldo25 to enable/disable LDO25 with proper
voltage.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200420055054.14592-7-yhchuang@realtek.com
parent 9874f685
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
#define REG_LDO_EFUSE_CTRL 0x0034 #define REG_LDO_EFUSE_CTRL 0x0034
#define BIT_MASK_EFUSE_BANK_SEL (BIT(8) | BIT(9)) #define BIT_MASK_EFUSE_BANK_SEL (BIT(8) | BIT(9))
#define BIT_LDO25_VOLTAGE_V25 0x03
#define BIT_MASK_LDO25_VOLTAGE GENMASK(6, 4)
#define BIT_SHIFT_LDO25_VOLTAGE 4
#define BIT_LDO25_EN BIT(7)
#define REG_GPIO_MUXCFG 0x0040 #define REG_GPIO_MUXCFG 0x0040
#define BIT_FSPI_EN BIT(19) #define BIT_FSPI_EN BIT(19)
#define BIT_BT_AOD_GPIO3 BIT(9) #define BIT_BT_AOD_GPIO3 BIT(9)
......
...@@ -14,10 +14,25 @@ ...@@ -14,10 +14,25 @@
#include "reg.h" #include "reg.h"
#include "debug.h" #include "debug.h"
static void rtw8723d_cfg_ldo25(struct rtw_dev *rtwdev, bool enable)
{
u8 ldo_pwr;
ldo_pwr = rtw_read8(rtwdev, REG_LDO_EFUSE_CTRL + 3);
if (enable) {
ldo_pwr &= ~BIT_MASK_LDO25_VOLTAGE;
ldo_pwr = (BIT_LDO25_VOLTAGE_V25 << 4) | BIT_LDO25_EN;
} else {
ldo_pwr &= ~BIT_LDO25_EN;
}
rtw_write8(rtwdev, REG_LDO_EFUSE_CTRL + 3, ldo_pwr);
}
static struct rtw_chip_ops rtw8723d_ops = { static struct rtw_chip_ops rtw8723d_ops = {
.read_rf = rtw_phy_read_rf_sipi, .read_rf = rtw_phy_read_rf_sipi,
.write_rf = rtw_phy_write_rf_reg_sipi, .write_rf = rtw_phy_write_rf_reg_sipi,
.set_antenna = NULL, .set_antenna = NULL,
.cfg_ldo25 = rtw8723d_cfg_ldo25,
.config_bfee = NULL, .config_bfee = NULL,
.set_gid_table = NULL, .set_gid_table = NULL,
.cfg_csi_rate = NULL, .cfg_csi_rate = NULL,
......
...@@ -1030,7 +1030,7 @@ static void rtw8822b_cfg_ldo25(struct rtw_dev *rtwdev, bool enable) ...@@ -1030,7 +1030,7 @@ static void rtw8822b_cfg_ldo25(struct rtw_dev *rtwdev, bool enable)
u8 ldo_pwr; u8 ldo_pwr;
ldo_pwr = rtw_read8(rtwdev, REG_LDO_EFUSE_CTRL + 3); ldo_pwr = rtw_read8(rtwdev, REG_LDO_EFUSE_CTRL + 3);
ldo_pwr = enable ? ldo_pwr | BIT(7) : ldo_pwr & ~BIT(7); ldo_pwr = enable ? ldo_pwr | BIT_LDO25_EN : ldo_pwr & ~BIT_LDO25_EN;
rtw_write8(rtwdev, REG_LDO_EFUSE_CTRL + 3, ldo_pwr); rtw_write8(rtwdev, REG_LDO_EFUSE_CTRL + 3, ldo_pwr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment