Skip to contentSkip to conversation

Bluetooth: Support SCO over HCI for Atheros AR300x Bluetooth device

PATCH In review Suraj Sumangala 4 participants 4 messages May 20, 2011 – May 31, 2011 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Support SCO over HCI for Atheros AR300x Bluetooth device

This patch adds SCO over HCI support to Atheros AR300x HCI transport driver.

---
 drivers/bluetooth/hci_ath.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/bluetooth/hci_ath.c +7 -7
index 4093935..8e15c31 100644
@@ -162,11 +162,6 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
 {
 	struct ath_struct *ath = hu->priv;
 
-	if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
-		kfree_skb(skb);
-		return 0;
-	}
-
 	/*
 	 * Update power management enable flag with parameters of
 	 * HCI sleep enable vendor specific HCI command.
@@ -184,9 +179,14 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
 	memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
 
 	skb_queue_tail(&ath->txq, skb);
-	set_bit(HCI_UART_SENDING, &hu->tx_state);
 
-	schedule_work(&ath->ctxtsw);
+	if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
+		clear_bit(HCI_UART_SENDING, &hu->tx_state);
+		hci_uart_tx_wakeup(hu);
+	} else {
+		set_bit(HCI_UART_SENDING, &hu->tx_state);
+		schedule_work(&ath->ctxtsw);
+	}
 
 	return 0;
 }
Signature · 1 line
1.7.0.4
#1 lore raw

Hi Suraj,

Quoted 25 lines · Suraj Sumangala

This patch adds SCO over HCI support to Atheros AR300x HCI transport driver.

---
 drivers/bluetooth/hci_ath.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/bluetooth/hci_ath.c +0 -5
index 4093935..8e15c31 100644
@@ -162,11 +162,6 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
 {
 	struct ath_struct *ath = hu->priv;
 
-	if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
-		kfree_skb(skb);
-		return 0;
-	}
-
 	/*
 	 * Update power management enable flag with parameters of
 	 * HCI sleep enable vendor specific HCI command.

drivers/bluetooth/hci_ath.c static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb) · line 185

Quoted 9 lines
drivers/bluetooth/hci_ath.c +3 -2
@@ -184,9 +179,14 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
 	memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
 
 	skb_queue_tail(&ath->txq, skb);
-	set_bit(HCI_UART_SENDING, &hu->tx_state);
 
-	schedule_work(&ath->ctxtsw);
+	if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
+		clear_bit(HCI_UART_SENDING, &hu->tx_state);
+		hci_uart_tx_wakeup(hu);

We can't do that, prioritize SCO over HCI Events. This can lead to weird sync problems, so please remove this and send me a new patch.

Signature · 2 lines
Gustavo F. Padovan
http://profusion.mobi
#2 lore raw

Hi Gustavo,
________________________________________
From: Gustavo F. Padovan [[email protected]] on behalf of Gustavo F. Padovan [[email protected]]
Sent: Tuesday, May 31, 2011 12:32 AM
To: Sumangala, Suraj
Cc: [email protected]; Somi Ramasamy Mothilal, JothiKumar
Subject: Re: [PATCH] Bluetooth: Support SCO over HCI for Atheros AR300x Bluetooth device

Hi Suraj,

Quoted 25 lines · Suraj Sumangala

This patch adds SCO over HCI support to Atheros AR300x HCI transport driver.

---
 drivers/bluetooth/hci_ath.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/bluetooth/hci_ath.c +0 -5
index 4093935..8e15c31 100644
@@ -162,11 +162,6 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
 {
      struct ath_struct *ath = hu->priv;
 
-     if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
-             kfree_skb(skb);
-             return 0;
-     }
-
      /*
       * Update power management enable flag with parameters of
       * HCI sleep enable vendor specific HCI command.

drivers/bluetooth/hci_ath.c static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb) · line 185

Quoted 9 lines
drivers/bluetooth/hci_ath.c +3 -2
@@ -184,9 +179,14 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
      memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
 
      skb_queue_tail(&ath->txq, skb);
-     set_bit(HCI_UART_SENDING, &hu->tx_state);
 
-     schedule_work(&ath->ctxtsw);
+     if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
+             clear_bit(HCI_UART_SENDING, &hu->tx_state);
+             hci_uart_tx_wakeup(hu);

We can't do that, prioritize SCO over HCI Events. This can lead to weird sync problems, so please remove this and send me a new patch.

The reason why I went with this approach was
1. In the schedule_work path, we were doing some power management logic which was relevent only for ACL packets.
2. Without this somehow the SCO audio quality was bad and the controller team mention that they were not getting SCO packets in this rate.

Any suggestions from you?

Regards
Suraj

maintainer
#3 lore raw

Hi Suraj,

Quoted 40 lines · Suraj Sumangala
Quoted 26 lines

This patch adds SCO over HCI support to Atheros AR300x HCI transport driver.

---
 drivers/bluetooth/hci_ath.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/bluetooth/hci_ath.c +0 -5
index 4093935..8e15c31 100644
@@ -162,11 +162,6 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
 {
      struct ath_struct *ath = hu->priv;
 
-     if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
-             kfree_skb(skb);
-             return 0;
-     }
-
      /*
       * Update power management enable flag with parameters of
       * HCI sleep enable vendor specific HCI command.

drivers/bluetooth/hci_ath.c static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb) · line 185

Quoted 9 lines
drivers/bluetooth/hci_ath.c +3 -2
@@ -184,9 +179,14 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
      memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
 
      skb_queue_tail(&ath->txq, skb);
-     set_bit(HCI_UART_SENDING, &hu->tx_state);
 
-     schedule_work(&ath->ctxtsw);
+     if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
+             clear_bit(HCI_UART_SENDING, &hu->tx_state);
+             hci_uart_tx_wakeup(hu);

We can't do that, prioritize SCO over HCI Events. This can lead to weird sync problems, so please remove this and send me a new patch.

Quoted 3 lines

The reason why I went with this approach was
1. In the schedule_work path, we were doing some power management logic which was relevent only for ACL packets.
2. Without this somehow the SCO audio quality was bad and the controller team mention that they were not getting SCO packets in this rate.

you might actually have to re-design your driver then. Since essentially you need to ensure that events like HCI_Conn_Complete arrive in the proper order to make sure that ACL and SCO handles are properly available before ACL or SCO packets are send.

This has been always the problem. Especially with USB endpoints where SCO packets and ACL packets are on different endpoints. Getting the order right is pretty tricky.

In addition you have the completed packet events that need to be handled properly. Otherwise you might screw up the flow control.

Regards

Marcel