From: Suraj Sumangala <suraj@atheros.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: <Jothikumar.Mothilal@Atheros.com>, Suraj Sumangala <suraj@atheros.com>
Subject: [PATCH 2/2] Bluetooth: support to send power management enable during hci open
Date: Tue, 21 Sep 2010 19:03:01 +0530 [thread overview]
Message-ID: <1285075981-8941-2-git-send-email-suraj@atheros.com> (raw)
In-Reply-To: <1285075981-8941-1-git-send-email-suraj@atheros.com>
This patch enables HCI_UART_ATH3K transport driver to support
sending Vendor specific hci commands during hci open
to enable or disable power management feature.
Signed-off-by: Suraj Sumangala <suraj@atheros.com>
---
drivers/bluetooth/hci_ath.c | 59 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c
index 6a160c1..d4b0653 100644
--- a/drivers/bluetooth/hci_ath.c
+++ b/drivers/bluetooth/hci_ath.c
@@ -49,6 +49,37 @@ struct ath_struct {
struct work_struct ctxtsw;
};
+/* Form HCI command */
+static struct sk_buff *form_hci_cmd(struct hci_dev *hdev, __u16 opcode,
+ __u32 plen, void *param)
+{
+ int len = HCI_COMMAND_HDR_SIZE + plen;
+ struct hci_command_hdr *hdr;
+ struct sk_buff *skb;
+
+ BT_DBG("%s opcode 0x%x plen %d", hdev->name, opcode, plen);
+
+ skb = bt_skb_alloc(len, GFP_ATOMIC);
+ if (!skb) {
+ BT_ERR("%s no memory for command", hdev->name);
+ return NULL;
+ }
+
+ hdr = (struct hci_command_hdr *) skb_put(skb, HCI_COMMAND_HDR_SIZE);
+ hdr->opcode = cpu_to_le16(opcode);
+ hdr->plen = plen;
+
+ if (plen)
+ memcpy(skb_put(skb, plen), param, plen);
+
+ BT_DBG("skb len %d", skb->len);
+
+ bt_cb(skb)->pkt_type = HCI_COMMAND_PKT;
+ skb->dev = (void *) hdev;
+
+ return skb;
+}
+
static int ath_wakeup_ar3k(struct tty_struct *tty)
{
struct termios settings;
@@ -81,6 +112,26 @@ static int ath_wakeup_ar3k(struct tty_struct *tty)
return status;
}
+#define HCI_OP_SLEEP_SET 0xFC04
+static void ath_hci_init_driver(struct hci_uart *hu)
+{
+ struct ath_struct *ath = hu->priv;
+ struct hci_dev *hdev = hu->hdev;
+ struct sk_buff *skb;
+
+ if (!hdev)
+ return;
+
+ if (!ath)
+ return;
+
+ skb = form_hci_cmd(hdev, HCI_OP_SLEEP_SET, 1, &ath->cur_sleep);
+ if (!skb)
+ return;
+
+ skb_queue_head(&hdev->driver_init, skb);
+}
+
static void ath_hci_uart_work(struct work_struct *work)
{
int status;
@@ -126,6 +177,13 @@ static int ath_open(struct hci_uart *hu)
return 0;
}
+static int ath_hci_open(struct hci_uart *hu)
+{
+ ath_hci_init_driver(hu);
+
+ return 0;
+}
+
/* Flush protocol data */
static int ath_flush(struct hci_uart *hu)
{
@@ -210,6 +268,7 @@ static int ath_recv(struct hci_uart *hu, void *data, int count)
static struct hci_uart_proto athp = {
.id = HCI_UART_ATH3K,
.open = ath_open,
+ .hci_open = ath_hci_open,
.close = ath_close,
.recv = ath_recv,
.enqueue = ath_enqueue,
--
1.7.0.4
next prev parent reply other threads:[~2010-09-21 13:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-21 13:33 [PATCH 1/2] Bluetooth: hci open callback for hci UART transport driver Suraj Sumangala
2010-09-21 13:33 ` Suraj Sumangala [this message]
2010-09-21 19:52 ` [PATCH 2/2] Bluetooth: support to send power management enable during hci open Pavan Savoy
2010-09-22 4:01 ` Suraj Sumangala
2010-09-22 21:22 ` Pavan Savoy
2010-09-23 4:13 ` Suraj Sumangala
2010-09-30 8:31 ` [PATCH 1/2] Bluetooth: hci open callback for hci UART transport driver Suraj Sumangala
2010-10-04 17:29 ` Suraj Sumangala
2010-10-05 9:27 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1285075981-8941-2-git-send-email-suraj@atheros.com \
--to=suraj@atheros.com \
--cc=Jothikumar.Mothilal@Atheros.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).