Enable VHCI Bluetooth interface and remove rfkill from it (interferes with flightmode)

This commit is contained in:
Florian Leeber 2020-12-09 22:05:32 +01:00
parent 105eb9b8eb
commit 7b86427e4c
3 changed files with 3 additions and 76 deletions

View file

@ -1106,7 +1106,7 @@ CONFIG_BT_DEBUGFS=y
# CONFIG_BT_HCIUART is not set
# CONFIG_BT_HCIBCM203X is not set
# CONFIG_BT_HCIBFUSB is not set
# CONFIG_BT_HCIVHCI is not set
CONFIG_BT_HCIVHCI=y
# CONFIG_BT_MRVL is not set
CONFIG_MSM_BT_POWER=y
CONFIG_BTFM_SLIM=y

View file

@ -43,4 +43,4 @@ hci_uart-$(CONFIG_BT_HCIUART_BCM) += hci_bcm.o
hci_uart-$(CONFIG_BT_HCIUART_QCA) += hci_qca.o
hci_uart-objs := $(hci_uart-y)
ccflags-y += -D__CHECK_ENDIAN__
ccflags-y += -D__CHECK_ENDIAN__ -Wno-unused-variable

View file

@ -19,7 +19,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/rfkill.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/delay.h>
@ -45,7 +44,6 @@ static const struct of_device_id bt_power_match_table[] = {
static struct bluetooth_power_platform_data *bt_power_pdata;
static struct platform_device *btpdev;
static bool previous;
static int pwr_state;
struct class *bt_class;
static int bt_major;
@ -343,25 +341,6 @@ out:
return rc;
}
static int bluetooth_toggle_radio(void *data, bool blocked)
{
int ret = 0;
int (*power_control)(int enable);
power_control =
((struct bluetooth_power_platform_data *)data)->bt_power_setup;
if (previous != blocked)
ret = (*power_control)(!blocked);
if (!ret)
previous = blocked;
return ret;
}
static const struct rfkill_ops bluetooth_power_rfkill_ops = {
.set_block = bluetooth_toggle_radio,
};
#if defined(CONFIG_CNSS) && defined(CONFIG_CLD_LL_CORE)
static ssize_t enable_extldo(struct device *dev, struct device_attribute *attr,
char *buf)
@ -389,54 +368,6 @@ static ssize_t enable_extldo(struct device *dev, struct device_attribute *attr,
static DEVICE_ATTR(extldo, S_IRUGO, enable_extldo, NULL);
static int bluetooth_power_rfkill_probe(struct platform_device *pdev)
{
struct rfkill *rfkill;
int ret;
rfkill = rfkill_alloc("bt_power", &pdev->dev, RFKILL_TYPE_BLUETOOTH,
&bluetooth_power_rfkill_ops,
pdev->dev.platform_data);
if (!rfkill) {
dev_err(&pdev->dev, "rfkill allocate failed\n");
return -ENOMEM;
}
/* add file into rfkill0 to handle LDO27 */
ret = device_create_file(&pdev->dev, &dev_attr_extldo);
if (ret < 0)
BT_PWR_ERR("device create file error!");
/* force Bluetooth off during init to allow for user control */
rfkill_init_sw_state(rfkill, 1);
previous = 1;
ret = rfkill_register(rfkill);
if (ret) {
dev_err(&pdev->dev, "rfkill register failed=%d\n", ret);
rfkill_destroy(rfkill);
return ret;
}
platform_set_drvdata(pdev, rfkill);
return 0;
}
static void bluetooth_power_rfkill_remove(struct platform_device *pdev)
{
struct rfkill *rfkill;
dev_dbg(&pdev->dev, "%s\n", __func__);
rfkill = platform_get_drvdata(pdev);
if (rfkill)
rfkill_unregister(rfkill);
rfkill_destroy(rfkill);
platform_set_drvdata(pdev, NULL);
}
#define MAX_PROP_SIZE 32
static int bt_dt_parse_vreg_info(struct device *dev,
struct bt_power_vreg_data **vreg_data, const char *vreg_name)
@ -643,10 +574,8 @@ static int bt_power_probe(struct platform_device *pdev)
goto free_pdata;
}
if (bluetooth_power_rfkill_probe(pdev) < 0)
goto free_pdata;
btpdev = pdev;
bluetooth_power(true);
return 0;
@ -659,8 +588,6 @@ static int bt_power_remove(struct platform_device *pdev)
{
dev_dbg(&pdev->dev, "%s\n", __func__);
bluetooth_power_rfkill_remove(pdev);
if (bt_power_pdata->bt_chip_pwd->reg)
regulator_put(bt_power_pdata->bt_chip_pwd->reg);