Bluetooth: btpower: Add snapshot of BT power driver
This is a snapshot of btpower as of msm-5.4
'commit d09dd7908f0d ("Revert Bluetooth: Adjust bt-vdd-rfa2 voltage
within the limit")'.
Change-Id: I8df2364ae1b63d8bfa97ab991d779a4ab914b831
Signed-off-by: Nehasri Mallem <quic_nmallem@quicinc.com>
This commit is contained in:
parent
23d0f552e1
commit
b39118ff24
4 changed files with 1442 additions and 1 deletions
|
|
@ -397,6 +397,19 @@ config BT_MTKSDIO
|
|||
Say Y here to compile support for MediaTek Bluetooth SDIO devices
|
||||
into the kernel or say M to compile it as module (btmtksdio).
|
||||
|
||||
config MSM_BT_POWER
|
||||
tristate "MSM Bluetooth Power Control"
|
||||
depends on ARCH_QCOM
|
||||
help
|
||||
MSM Bluetooth Power control driver.
|
||||
This provides a parameter to switch on/off power from PMIC
|
||||
to Bluetooth device. This will control LDOs/Clock/GPIOs to
|
||||
control Bluetooth Chipset based on power on/off sequence.
|
||||
|
||||
Say Y here to compile support for Bluetooth Power driver
|
||||
into the kernel or say M to compile as a module.
|
||||
|
||||
|
||||
config BT_MTKUART
|
||||
tristate "MediaTek HCI UART driver"
|
||||
depends on SERIAL_DEV_BUS
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ obj-$(CONFIG_BT_HCIBFUSB) += bfusb.o
|
|||
obj-$(CONFIG_BT_HCIDTL1) += dtl1_cs.o
|
||||
obj-$(CONFIG_BT_HCIBT3C) += bt3c_cs.o
|
||||
obj-$(CONFIG_BT_HCIBLUECARD) += bluecard_cs.o
|
||||
|
||||
obj-$(CONFIG_MSM_BT_POWER) += btpower.o
|
||||
obj-$(CONFIG_BT_HCIBTUSB) += btusb.o
|
||||
obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o
|
||||
|
||||
|
|
|
|||
1335
drivers/bluetooth/btpower.c
Normal file
1335
drivers/bluetooth/btpower.c
Normal file
File diff suppressed because it is too large
Load diff
93
include/linux/btpower.h
Normal file
93
include/linux/btpower.h
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. 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
|
||||
};
|
||||
|
||||
/* Hasting chipset version information */
|
||||
enum {
|
||||
HASTINGS_SOC_ID_0100 = 0x400A0100,
|
||||
HASTINGS_SOC_ID_0101 = 0x400A0101,
|
||||
HASTINGS_SOC_ID_0110 = 0x400A0110,
|
||||
HASTINGS_SOC_ID_0200 = 0x400A0200,
|
||||
};
|
||||
|
||||
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 */
|
||||
int xo_gpio_sys_rst; /* XO reset 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
|
||||
|
||||
#endif /* __LINUX_BLUETOOTH_POWER_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue