[HD2 Android NAND Development] trilu:
Bluetooth

I've compared a little bit different kernels - the one you are using and also a desire kernel. Here are my findings:

I assume that board_htcleo.c should similar to board_mahimahi.c at least for the bluetooth stuff. But there are a lot of differences...

board-mahimahi.c refers on bcm_bt_lpm.h

<bcm_bt_lpm.h>--------------------------------------------------------

#ifndef __ASM_ARCH_BCM_BT_LPM_H

#define __ASM_ARCH_BCM_BT_LPM_H

#include <linux/serial_core.h>

/* Uart driver must call this every time it beings TX, to ensure

* this driver keeps WAKE asserted during TX. Called with uart

* spinlock held. */

extern void bcm_bt_lpm_exit_lpm_locked(struct uart_port *uport);

struct bcm_bt_lpm_platform_data {

unsigned int gpio_wake; /* CPU -> BCM wakeup gpio */

unsigned int gpio_host_wake; /* BCM -> CPU wakeup gpio */

/* Callback to request the uart driver to clock off.

* Called with uart spinlock held. */

void (*request_clock_off_locked)(struct uart_port *uport);

/* Callback to request the uart driver to clock on.

* Called with uart spinlock held. */

void (*request_clock_on_locked)(struct uart_port *uport);

};

#endif

----------------------------------------------------------------------

<board-mahimahi.c>----------------------------------------------------

......

static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {

.rx_wakeup_irq = -1,

.inject_rx_on_wakeup = 0,

.exit_lpm_cb = bcm_bt_lpm_exit_lpm_locked,

};

static struct bcm_bt_lpm_platform_data bcm_bt_lpm_pdata = {

.gpio_wake = MAHIMAHI_GPIO_BT_WAKE,

.gpio_host_wake = MAHIMAHI_GPIO_BT_HOST_WAKE,

.request_clock_off_locked = msm_hs_request_clock_off_locked,

.request_clock_on_locked = msm_hs_request_clock_on_locked,

};

struct platform_device bcm_bt_lpm_device = {

.name = "bcm_bt_lpm",

.id = 0,

.dev = {

.platform_data = &bcm_bt_lpm_pdata,

},

};

....

static uint32_t bt_gpio_table[] = {

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_UART1_RTS, 2, GPIO_OUTPUT,

GPIO_PULL_UP, GPIO_8MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_UART1_CTS, 2, GPIO_INPUT,

GPIO_PULL_UP, GPIO_8MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_UART1_RX, 2, GPIO_INPUT,

GPIO_PULL_UP, GPIO_8MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_UART1_TX, 2, GPIO_OUTPUT,

GPIO_PULL_UP, GPIO_8MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_RESET_N, 0, GPIO_OUTPUT,

GPIO_PULL_DOWN, GPIO_4MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_SHUTDOWN_N, 0, GPIO_OUTPUT,

GPIO_PULL_DOWN, GPIO_4MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_WAKE, 0, GPIO_OUTPUT,

GPIO_PULL_DOWN, GPIO_4MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_HOST_WAKE, 0, GPIO_INPUT,

GPIO_PULL_DOWN, GPIO_4MA),

};

static uint32_t bt_gpio_table_rev_CX[] = {

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_UART1_RTS, 2, GPIO_OUTPUT,

GPIO_PULL_UP, GPIO_8MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_UART1_CTS, 2, GPIO_INPUT,

GPIO_PULL_UP, GPIO_8MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_UART1_RX, 2, GPIO_INPUT,

GPIO_PULL_UP, GPIO_8MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_UART1_TX, 2, GPIO_OUTPUT,

GPIO_PULL_UP, GPIO_8MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_RESET_N, 0, GPIO_OUTPUT,

GPIO_PULL_DOWN, GPIO_4MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_SHUTDOWN_N, 0, GPIO_OUTPUT,

GPIO_PULL_DOWN, GPIO_4MA),

PCOM_GPIO_CFG(MAHIMAHI_CDMA_GPIO_BT_WAKE, 0, GPIO_OUTPUT,

GPIO_PULL_DOWN, GPIO_4MA),

PCOM_GPIO_CFG(MAHIMAHI_GPIO_BT_HOST_WAKE, 0, GPIO_INPUT,

GPIO_PULL_DOWN, GPIO_4MA),

};

-----------------------------------------------------------------------

msm_serial_hs.c needs the "msm_serial_hs_platform_data" struct in <board-mahimahi.c>

I think the main problem is the missing link between board_htcleo.c and bcm_bt_lpm.c, because the uart calls for each tx a bcm_bt_lpm_exit.

Hopefully my findings are useful for fixing the bluetooth battery drain bug.

Best regards

trilu