Skip to content

Commit

Permalink
bluetooth: Disable MSM 8974 Bluetooth rfkill
Browse files Browse the repository at this point in the history
Having both HCI core rfkill and MSM 8974 rfkill enabled causes
problems with unblocking BT after it has been blocked. Also, using
only the device-specific rfkill to block and unblock bluetooth leads
to device becoming unresponsive for reasons currently unknown.

For the time being, disable the device-specific rfkill, but power on
the device during initialization.

[bluetooth] Disable MSM 8974 Bluetooth rfkill

Signed-off-by: Hannu Mallat <hannu.mallat@jollamobile.com>
  • Loading branch information
Hannu Mallat authored and RealJohnGalt committed Apr 27, 2016
1 parent 6f6d5e1 commit 2f66ef3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions arch/arm/mach-msm/lge/board-8974-rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@
#endif
#endif /* CONFIG_BCM4335BT */

/* Power on the device but do not allow rfkilling via GPIO */
#define DISABLE_RFKILL 1

#ifndef DISABLE_RFKILL
static struct rfkill *bt_rfk;
static const char bt_name[] = "brcm_Bluetooth_rfkill";
#endif /* DISABLE_RFKILL */

#ifdef CONFIG_BCM4335BT
#define BTLOCK_NAME "btlock"
Expand Down Expand Up @@ -194,14 +199,18 @@ static int bluetooth_set_power(void *data, bool blocked)
return 0;
}

#ifndef DISABLE_RFKILL
static struct rfkill_ops bluetooth_rfkill_ops = {
.set_block = bluetooth_set_power,
};
#endif /* DISABLE_RFKILL */

static int bluetooth_rfkill_probe(struct platform_device *pdev)
{
int rc = 0;
#ifndef DISABLE_RFKILL
bool default_state = true; /* off */
#endif /* DISABLE_RFKILL */

#ifdef CONFIG_BCM4335BT
bcm_btlock_init();
Expand All @@ -220,6 +229,10 @@ static int bluetooth_rfkill_probe(struct platform_device *pdev)
}
gpio_direction_output(GPIO_BT_RESET_N, 0);

#ifdef DISABLE_RFKILL
bluetooth_set_power(NULL, false);
return 0;
#else
bluetooth_set_power(NULL, default_state);

bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
Expand All @@ -244,6 +257,7 @@ static int bluetooth_rfkill_probe(struct platform_device *pdev)
err_rfkill_reg:
rfkill_destroy(bt_rfk);
err_rfkill_alloc:
#endif /* DISABLE_RFKILL */
err_gpio_reset:
gpio_free(GPIO_BT_RESET_N);
printk(KERN_ERR "bluetooth_rfkill_probe error!\n");
Expand All @@ -252,8 +266,10 @@ static int bluetooth_rfkill_probe(struct platform_device *pdev)

static int bluetooth_rfkill_remove(struct platform_device *dev)
{
#ifndef DISABLE_RFKILL
rfkill_unregister(bt_rfk);
rfkill_destroy(bt_rfk);
#endif /* DISABLE_RFKILL */
gpio_free(GPIO_BT_RESET_N);

#ifdef CONFIG_BCM4335BT
Expand Down

0 comments on commit 2f66ef3

Please sign in to comment.