android_kernel_xiaomi_sm8450/include/linux/btpower.h
Mahesh Kumar Sharma d467c26bd7 Bluetooth: Implement a minimum off-time for AON discharge issue
Sometimes it is seen that AON LDO output takes minimum
off-time (worst case 100ms) to fully discharge. If BT is
turned on in this timeframe when AON is not fully
discharged yet ,BT would fail to turn ON.

This fix ensures to
Toggle BT_EN high when WL_EN is already high.
Handle corner case if WL_EN goes low in step 1.
Add 100ms to toggle BT_EN high when WL_EN is low.

Change-Id: Ibe082165788bd9ddb553e6043696bebc5bf4b609
Signed-off-by: Mahesh Kumar Sharma <smahesh@codeaurora.org>
2020-12-15 14:05:56 -08:00

87 lines
2.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#ifndef __LINUX_BLUETOOTH_POWER_H
#define __LINUX_BLUETOOTH_POWER_H
#include <linux/types.h>
/*
* voltage regulator information required for configuring the
* bluetooth chipset
*/
enum bt_power_modes {
BT_POWER_DISABLE = 0,
BT_POWER_ENABLE,
BT_POWER_RETENTION
};
struct log_index {
int init;
int crash;
};
struct bt_power_vreg_data {
struct regulator *reg; /* voltage regulator handle */
const char *name; /* regulator name */
u32 min_vol; /* min voltage level */
u32 max_vol; /* max voltage level */
u32 load_curr; /* current */
bool is_enabled; /* is this regulator enabled? */
bool is_retention_supp; /* does this regulator support retention mode */
struct log_index indx; /* Index for reg. w.r.t init & crash */
};
struct bt_power {
char compatible[32];
struct bt_power_vreg_data *vregs;
int num_vregs;
};
struct bt_power_clk_data {
struct clk *clk; /* clock regulator handle */
const char *name; /* clock name */
bool is_enabled; /* is this clock enabled? */
};
struct btpower_tcs_table_info {
resource_size_t tcs_cmd_base_addr;
void __iomem *tcs_cmd_base_addr_io;
};
/*
* Platform data for the bluetooth power driver.
*/
struct bluetooth_power_platform_data {
int bt_gpio_sys_rst; /* Bluetooth reset gpio */
int wl_gpio_sys_rst; /* Wlan reset gpio */
int bt_gpio_sw_ctrl; /* Bluetooth sw_ctrl gpio */
int bt_gpio_debug; /* Bluetooth debug gpio */
struct device *slim_dev;
struct bt_power_vreg_data *vreg_info; /* VDDIO voltage regulator */
struct bt_power_clk_data *bt_chip_clk; /* bluetooth reference clock */
int (*bt_power_setup)(int id); /* Bluetooth power setup function */
char compatible[32]; /*Bluetooth SoC name */
int num_vregs;
struct btpower_tcs_table_info tcs_table_info;
};
int btpower_register_slimdev(struct device *dev);
int btpower_get_chipset_version(void);
#define BT_CMD_SLIM_TEST 0xbfac
#define BT_CMD_PWR_CTRL 0xbfad
#define BT_CMD_CHIPSET_VERS 0xbfae
#define BT_CMD_GET_CHIPSET_ID 0xbfaf
#define BT_CMD_CHECK_SW_CTRL 0xbfb0
#define BT_CMD_GETVAL_POWER_SRCS 0xbfb1
#define BT_CMD_SET_IPA_TCS_INFO 0xbfc0
#define TCS_CMD_IO_ADDR_OFFSET 0x4
/* total number of power src */
#define BT_POWER_SRC_SIZE 28
#endif /* __LINUX_BLUETOOTH_POWER_H */