Skip to contentSkip to conversation

Bluetooth: btmrvl: Fix issue when btmrvl driver and firmware are cross-sending

PATCH New Bing Zhao 1 participant 1 message Nov 17, 2009 Bluetooth drivers

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 Bluetooth: btmrvl: Fix issue when btmrvl driver and firmware are cross-sending

From: Amitkumar Karwar <[email protected]>

When driver is sending a command or data and the firmware is also sending a sleep event, sometimes it is observed that driver will continue to send the command/data to firmware after processing sleep event. Once sleep event is processed driver is not supposed to send anything because firmware is in sleep state after that. Previously RX processing was done in interrupt callback handler called from MMC core. Now it is done in btmrvl driver main thread to solve the issue.

---
 drivers/bluetooth/btmrvl_drv.h  |    1 +
 drivers/bluetooth/btmrvl_main.c |    7 ++-
 drivers/bluetooth/btmrvl_sdio.c |   90 ++++++++++++++++++++------------------
 3 files changed, 53 insertions(+), 45 deletions(-)
drivers/bluetooth/btmrvl_drv.h +1 -0
index 411c7a7..2756de9 100644
@@ -73,6 +73,7 @@ struct btmrvl_private {
 	int (*hw_host_to_card) (struct btmrvl_private *priv,
 				u8 *payload, u16 nb);
 	int (*hw_wakeup_firmware) (struct btmrvl_private *priv);
+	int (*hw_get_int_status) (struct btmrvl_private *priv, u8 *ireg);
 	spinlock_t driver_lock;		/* spinlock used by driver */
 #ifdef CONFIG_DEBUG_FS
 	void *debugfs_data;
drivers/bluetooth/btmrvl_main.c +5 -2
index e605563..1fdc627 100644
@@ -448,6 +448,7 @@ static int btmrvl_service_main_thread(void *data)
 	struct btmrvl_private *priv = thread->priv;
 	struct btmrvl_adapter *adapter = priv->adapter;
 	wait_queue_t wait;
+	u8 ireg = 0;
 	struct sk_buff *skb;
 	ulong flags;
 
@@ -482,14 +483,16 @@ static int btmrvl_service_main_thread(void *data)
 		spin_lock_irqsave(&priv->driver_lock, flags);
 		if (adapter->int_count) {
 			adapter->int_count = 0;
+			spin_unlock_irqrestore(&priv->driver_lock, flags);
+			priv->hw_get_int_status(priv, &ireg);
 		} else if (adapter->ps_state == PS_SLEEP &&
 					!skb_queue_empty(&adapter->tx_queue)) {
 			spin_unlock_irqrestore(&priv->driver_lock, flags);
 			adapter->wakeup_tries++;
 			priv->hw_wakeup_firmware(priv);
 			continue;
-		}
-		spin_unlock_irqrestore(&priv->driver_lock, flags);
+		} else
+			spin_unlock_irqrestore(&priv->driver_lock, flags);
 
 		if (adapter->ps_state == PS_SLEEP)
 			continue;
drivers/bluetooth/btmrvl_sdio.c +47 -43

134 lines not on this page · raw message

Signature · 1 line
1.5.4.3