Skip to content

Commit

Permalink
Bluetooth: add Qualcomm In-Band Sleep support
Browse files Browse the repository at this point in the history
This adds "qualcomm-ibs" to the supported controller types list
and claims HCI UART protocol number 5 for it. This corresponds the
kernel tty line discipline configured as HCI_UART_IBS, which
supports Qualcomm's Software In-Band Sleep protocol.

Change-Id: Ie6f568833db76e234d3bed89f9d4b06a005e3d30
  • Loading branch information
Ankit Verma authored and rmcc committed Jul 30, 2012
1 parent c245cd2 commit f107594
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
39 changes: 37 additions & 2 deletions tools/hciattach.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
*
* Copyright (C) 2000-2001, 2010, 2011 Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1034,6 +1033,39 @@ static int bcm2035(int fd, struct uart_t *u, struct termios *ti)
return 0;
}

static int qcom_uart_init(int fd, struct uart_t *u, struct termios *ti)
{
int flags = 0;

if (ioctl(fd, TIOCMGET, &flags) < 0){
perror("TIOCMGET failed in init \n");
return -1;
}
flags &= ~TIOCM_RTS;
if (ioctl(fd, TIOCMSET, &flags) < 0){
perror("TIOCMSET failed in init: HW Flow-off error \n");
return -1;
}

return 0;
}

static int qcom_uart_post(int fd, struct uart_t *u, struct termios *ti)
{
int flags = 0;

if (ioctl(fd, TIOCMGET, &flags) < 0){
perror("TIOCMGET failed in post \n");
return -1;
}
flags &= ~TIOCM_RTS;
if (ioctl(fd, TIOCMSET, &flags) < 0){
perror("TIOCMSET failed in post: HW Flow-on error \n");
return -1;
}
return 0;
}

struct uart_t uart[] = {
{ "any", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200,
FLOW_CTL, DISABLE_PM, NULL, NULL },
Expand Down Expand Up @@ -1137,6 +1169,9 @@ struct uart_t uart[] = {
{ "qualcomm", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200,
FLOW_CTL, DISABLE_PM, NULL, qualcomm, NULL },

{ "qualcomm-ibs", 0x0000, 0x0000, HCI_UART_IBS, 115200, 115200,
FLOW_CTL, DISABLE_PM, NULL, qcom_uart_init, qcom_uart_post },

{ NULL, 0 }
};

Expand Down
7 changes: 4 additions & 3 deletions tools/hciattach.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2003-2010 Marcel Holtmann <marcel@holtmann.org>
*
* Copyright (C) 2003-2009 Marcel Holtmann <marcel@holtmann.org>
* Copyright (C) 2010, 2011 Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -38,7 +38,8 @@
#define HCI_UART_3WIRE 2
#define HCI_UART_H4DS 3
#define HCI_UART_LL 4
#define HCI_UART_ATH3K 5
#define HCI_UART_IBS 5
#define HCI_UART_ATH3K 6

#define HCI_UART_RAW_DEVICE 0

Expand Down

0 comments on commit f107594

Please sign in to comment.