From ef0d4d698c36e046410182d8e343513c815370de Mon Sep 17 00:00:00 2001 From: Balakrishna Godavarthi Date: Mon, 31 May 2021 14:45:53 +0530 Subject: [PATCH] Add support to vote for SMPS This change will add support to vote for SMPS node if regulator handle is provided in DTS source. Change-Id: Ib370fd2fecfe04585cd2ab643f597714ead18a93 Signed-off-by: Balakrishna Godavarthi --- drivers/bluetooth/btpower.c | 27 +++++++++++++++++++-------- include/linux/btpower.h | 3 --- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/bluetooth/btpower.c b/drivers/bluetooth/btpower.c index 93a7fbb688b9..e149f5a135dd 100644 --- a/drivers/bluetooth/btpower.c +++ b/drivers/bluetooth/btpower.c @@ -32,12 +32,6 @@ #endif #include -#define PWR_SRC_STATUS_SET(index, status) do { \ - if (index >= PWR_SRC_INIT_STATE_IDX && index < BT_POWER_SRC_SIZE) { \ - bt_power_src_status[index] = (int) status; \ - } \ -} while (0) - #define PWR_SRC_NOT_AVAILABLE -2 #define DEFAULT_INVALID_VALUE -1 #define PWR_SRC_INIT_STATE_IDX 0 @@ -76,9 +70,24 @@ enum power_src_pos { BT_VDD_RFA_0p8_CURRENT, BT_VDD_RFACMN_CURRENT, BT_VDD_IPA_2p2, - BT_VDD_IPA_2p2_CURRENT + BT_VDD_IPA_2p2_CURRENT, + /* The below bucks are voted for HW WAR on some platform which supports + * WNC39xx. + */ + BT_VDD_SMPS, + BT_VDD_SMPS_CURRENT, + /* New entries need to be added before PWR_SRC_SIZE. + * Its hold the max size of power sources states. + */ + BT_POWER_SRC_SIZE, }; +#define PWR_SRC_STATUS_SET(index, status) do { \ + if (index >= PWR_SRC_INIT_STATE_IDX && index < BT_POWER_SRC_SIZE) { \ + bt_power_src_status[index] = (int) status; \ + } \ +} while (0) + // Regulator structure for QCA6174/QCA9377/QCA9379 BT SoC series static struct bt_power_vreg_data bt_vregs_info_qca61x4_937x[] = { {NULL, "qcom,bt-vdd-aon", 928000, 928000, 0, false, false, @@ -116,6 +125,8 @@ static struct bt_power_vreg_data bt_vregs_info_qca6xx0[] = { static struct bt_power bt_vreg_info_wcn399x = { .compatible = "qcom,wcn3990", .vregs = (struct bt_power_vreg_data []) { + {NULL, "qcom,bt-vdd-smps", 984000, 984000, 0, false, false, + {BT_VDD_SMPS, BT_VDD_SMPS_CURRENT}}, {NULL, "qcom,bt-vdd-io", 1700000, 1900000, 0, false, false, {BT_VDD_IO_LDO, BT_VDD_IO_LDO_CURRENT}}, {NULL, "qcom,bt-vdd-core", 1304000, 1304000, 0, false, false, @@ -125,7 +136,7 @@ static struct bt_power bt_vreg_info_wcn399x = { {NULL, "qcom,bt-vdd-xtal", 1700000, 1900000, 0, false, false, {BT_VDD_XTAL_LDO, BT_VDD_XTAL_LDO_CURRENT}}, }, - .num_vregs = 4, + .num_vregs = 5, }; static struct bt_power bt_vreg_info_qca_auto = { diff --git a/include/linux/btpower.h b/include/linux/btpower.h index 57b235733d62..a8bcd48f1623 100644 --- a/include/linux/btpower.h +++ b/include/linux/btpower.h @@ -89,7 +89,4 @@ int btpower_get_chipset_version(void); #define TCS_CMD_IO_ADDR_OFFSET 0x4 -/* total number of power src */ -#define BT_POWER_SRC_SIZE 30 - #endif /* __LINUX_BLUETOOTH_POWER_H */