diff options
author | Cheney Ni <cheneyni@google.com> | 2021-10-15 02:23:57 +0800 |
---|---|---|
committer | Cheney Ni <cheneyni@google.com> | 2021-12-11 00:37:43 +0800 |
commit | a55b58ec990c7665eeb5f7e75a881a165eeb9560 (patch) | |
tree | 95f5c1f5f45963dc3869673d131610dfc1d00cac | |
parent | 12bfd33c0a9704c4272619fb5b72f6fb8186c27a (diff) | |
download | qcom-a55b58ec990c7665eeb5f7e75a881a165eeb9560.tar.gz |
btpower: Report idle state to platform peripheral bus
This holds the UART resource when BT is running, and must refine with
the OOBS solution.
Bug: 202113218
Bug: 202091533
Test: manually
Signed-off-by: Cheney Ni <cheneyni@google.com>
Change-Id: Ibcfe8c39cbb68463bf555535bbdd6fb04ecc8374
-rw-r--r-- | btpower.c | 13 | ||||
-rw-r--r-- | linux/btpower.h | 2 |
2 files changed, 15 insertions, 0 deletions
@@ -24,6 +24,7 @@ #include <linux/btpower.h> #include <linux/of_device.h> #include <soc/qcom/cmd-db.h> +#include <soc/google/exynos-cpupm.h> #if IS_ENABLED(CONFIG_BT_SLIM_QCA6390) || \ IS_ENABLED(CONFIG_BT_SLIM_QCA6490) || \ @@ -240,6 +241,14 @@ static int bt_power_vreg_set(struct btpower_platform_data *drvdata, enum bt_power_modes mode); static int btpower_enable_ipa_vreg(struct btpower_platform_data *drvdata); +static void btpower_uart_transport_locked(struct btpower_platform_data *drvdata, + bool locked) +{ + pr_debug("%s: %s\n", __func__, (locked ? "busy" : "idle")); + /* idle status: true - idle, false otherwise */ + exynos_update_ip_idle_status(drvdata->uart_idle_index, !locked); +} + static int bt_vreg_enable(struct bt_power_vreg_data *vreg) { int rc = 0; @@ -559,6 +568,7 @@ static int bluetooth_power(struct btpower_platform_data *drvdata, switch (mode) { case BT_POWER_DISABLE: bt_configure_gpios(drvdata, false); + btpower_uart_transport_locked(drvdata, false); drvdata->pwr_state = BT_POWER_DISABLE; goto clk_disable; case BT_POWER_ENABLE: @@ -586,6 +596,7 @@ static int bluetooth_power(struct btpower_platform_data *drvdata, pr_err("%s: bt_power gpio config failed\n", __func__); goto clk_disable; } + btpower_uart_transport_locked(drvdata, true); drvdata->pwr_state = BT_POWER_ENABLE; return rc; case BT_POWER_RETENTION: @@ -1088,6 +1099,8 @@ static int bt_power_probe(struct platform_device *pdev) btpower_aop_mbox_init(drvdata); + drvdata->uart_idle_index = exynos_get_idle_ip_index("bluetooth"); + platform_set_drvdata(pdev, drvdata); return 0; diff --git a/linux/btpower.h b/linux/btpower.h index 22521ef..98f30aa 100644 --- a/linux/btpower.h +++ b/linux/btpower.h @@ -86,6 +86,8 @@ struct btpower_platform_data { struct mbox_chan *mbox_chan; const char *vreg_ipa; bool vreg_ipa_configured; + + int uart_idle_index; }; extern int btpower_register_slimdev(struct device *dev); |