summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy.green@linaro.org>2015-01-12 13:29:16 +0800
committerAndy Green <andy.green@linaro.org>2015-01-12 13:29:16 +0800
commit276c62e9c3b0736a5cc1756350b97a4d77212b7b (patch)
treed7dd49506fc0463435ce6b8741a7021346c18e2e
parent250e0a8cecdd4a5997a8a019b34d9cb9fb3a6724 (diff)
bluetooth smdtty ch3 hacksmainline-basis-test-2015-01-12-1
Signed-off-by: Andy Green <andy.green@linaro.org>
-rw-r--r--arch/arm/configs/msm8916-qrd_defconfig1
-rw-r--r--drivers/tty/serial/msm_smd_tty.c46
2 files changed, 36 insertions, 11 deletions
diff --git a/arch/arm/configs/msm8916-qrd_defconfig b/arch/arm/configs/msm8916-qrd_defconfig
index 04071cf19f63..07183324dc5f 100644
--- a/arch/arm/configs/msm8916-qrd_defconfig
+++ b/arch/arm/configs/msm8916-qrd_defconfig
@@ -76,6 +76,7 @@ CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
CONFIG_BT_HCIUART=y
+CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
CONFIG_BT_HCISMD=m
CONFIG_CFG80211=y
diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c
index 794ab3743c41..ced735639c08 100644
--- a/drivers/tty/serial/msm_smd_tty.c
+++ b/drivers/tty/serial/msm_smd_tty.c
@@ -110,6 +110,8 @@ struct smd_tty_info {
char ch_name[SMD_MAX_CH_NAME_LEN];
char dev_name[SMD_MAX_CH_NAME_LEN];
+ bool swallow_first_tx_byte;
+
struct mutex open_lock_lha1;
unsigned int open_wait;
@@ -288,6 +290,8 @@ static void smd_tty_read(unsigned long param)
spin_unlock_irqrestore(&info->ra_lock_lha3, flags);
break;
}
+ if (info->swallow_first_tx_byte)
+ avail++;
spin_unlock_irqrestore(&info->ra_lock_lha3, flags);
if (avail > MAX_TTY_BUF_SIZE)
@@ -300,16 +304,27 @@ static void smd_tty_read(unsigned long param)
tty_kref_put(tty);
return;
}
-
- if (smd_read(info->ch, ptr, avail) != avail) {
- /* shouldn't be possible since we're in interrupt
- ** context here and nobody else could 'steal' our
- ** characters.
- */
- SMD_TTY_ERR(
- "%s - Possible smd_tty_buffer mismatch for %s",
- __func__, info->ch_name);
- }
+ if (info->swallow_first_tx_byte) {
+ *ptr = 4;
+ if (smd_read(info->ch, ptr + 1, avail - 1) != avail - 1) {
+ /* shouldn't be possible since we're in interrupt
+ ** context here and nobody else could 'steal' our
+ ** characters.
+ */
+ SMD_TTY_ERR(
+ "%s - Possible smd_tty_buffer mismatch for %s",
+ __func__, info->ch_name);
+ }
+ } else
+ if (smd_read(info->ch, ptr, avail) != avail) {
+ /* shouldn't be possible since we're in interrupt
+ ** context here and nobody else could 'steal' our
+ ** characters.
+ */
+ SMD_TTY_ERR(
+ "%s - Possible smd_tty_buffer mismatch for %s",
+ __func__, info->ch_name);
+ }
/*
* Keep system awake long enough to allow the TTY
@@ -748,6 +763,13 @@ static int smd_tty_write(struct tty_struct *tty, const unsigned char *buf,
SMD_TTY_INFO("[WRITE]: PID %u -> port %s %x bytes",
current->pid, info->ch_name, len);
+ if (info->swallow_first_tx_byte) {
+// pr_err("trunc %d\n", len - 1);
+ if (len < 2)
+ return 0;
+ return smd_write(info->ch, buf + 1, len - 1) + 1;
+ }
+
return smd_write(info->ch, buf, len);
}
@@ -920,6 +942,7 @@ static void smd_tty_device_init(int idx)
spin_lock_init(&smd_tty[idx].reset_lock_lha2);
spin_lock_init(&smd_tty[idx].ra_lock_lha3);
smd_tty[idx].is_open = 0;
+ smd_tty[idx].swallow_first_tx_byte = idx == 3;
setup_timer(&smd_tty[idx].buf_req_timer, buf_req_retry,
(unsigned long)&smd_tty[idx]);
init_waitqueue_head(&smd_tty[idx].ch_opened_wait_queue);
@@ -946,7 +969,8 @@ static int smd_tty_core_init(void)
for (n = 0; n < ARRAY_SIZE(smd_configs); ++n) {
idx = smd_configs[n].tty_dev_index;
smd_tty[idx].edge = smd_configs[n].edge;
-
+ smd_tty[idx].swallow_first_tx_byte = idx == 3;
+ pr_err("%s: %d %d\n", __func__, idx, smd_tty[idx].swallow_first_tx_byte);
strlcpy(smd_tty[idx].ch_name, smd_configs[n].port_name,
SMD_MAX_CH_NAME_LEN);
if (smd_configs[n].dev_name == NULL) {