Skip to contentSkip to conversation

Bluetooth: decode btmrvl MODULE_BRINGUP_REG response correctly

PATCH In review Bing Zhao 2 participants 6 messages Mar 3, 2010 – Mar 9, 2010 Bluetooth drivers

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/3 Bluetooth: decode btmrvl MODULE_BRINGUP_REG response correctly

btmrvl MODULE_BRINGUP_REQ command response returns success with either 0x00 or 0x0c.

---
 drivers/bluetooth/btmrvl_drv.h  |    5 ++++-
 drivers/bluetooth/btmrvl_main.c |    6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/bluetooth/btmrvl_drv.h +4 -1
index 523d197..bdf5187 100644
@@ -87,8 +87,11 @@ struct btmrvl_private {
 #define BT_CMD_HOST_SLEEP_ENABLE	0x5A
 #define BT_CMD_MODULE_CFG_REQ		0x5B
 
-/* Sub-commands: Module Bringup/Shutdown Request */
+/* Sub-commands: Module Bringup/Shutdown Request/Response */
 #define MODULE_BRINGUP_REQ		0xF1
+#define MODULE_BROUGHT_UP		0x00
+#define MODULE_ALREADY_UP		0x0C
+
 #define MODULE_SHUTDOWN_REQ		0xF2
 
 #define BT_EVENT_POWER_STATE		0x20
drivers/bluetooth/btmrvl_main.c +4 -2
index 53a43ad..31e7412 100644
@@ -112,8 +112,10 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
 	case BT_CMD_MODULE_CFG_REQ:
 		if (priv->btmrvl_dev.sendcmdflag &&
 				event->data[1] == MODULE_BRINGUP_REQ) {
-			BT_DBG("EVENT:%s", (event->data[2]) ?
-				"Bring-up failed" : "Bring-up succeed");
+			BT_DBG("EVENT:%s",
+				((event->data[2] == MODULE_BROUGHT_UP) ||
+				(event->data[2] == MODULE_ALREADY_UP)) ?
+				"Bring-up succeed" : "Bring-up failed");
 		} else if (priv->btmrvl_dev.sendcmdflag &&
 				event->data[1] == MODULE_SHUTDOWN_REQ) {
 			BT_DBG("EVENT:%s", (event->data[2]) ?
Signature · 1 line
1.5.3.6
author
#1 lore raw

PATCH 2/3 Bluetooth: separate btmrvl_register_hdev() from btmrvl_add_card()

Move btmrvl hdev registration code out of btmrvl_add_card(). New function btmrvl_register_hdev() is added.

---
 drivers/bluetooth/btmrvl_drv.h  |    1 +
 drivers/bluetooth/btmrvl_main.c |   75 ++++++++++++++++++++++----------------
 drivers/bluetooth/btmrvl_sdio.c |    7 +++-
 3 files changed, 50 insertions(+), 33 deletions(-)
drivers/bluetooth/btmrvl_drv.h +1 -0
index bdf5187..ec8ac5e 100644
@@ -125,6 +125,7 @@ struct btmrvl_event {
 
 /* Prototype of global function */
 
+int btmrvl_register_hdev(struct btmrvl_private *priv);
 struct btmrvl_private *btmrvl_add_card(void *card);
 int btmrvl_remove_card(struct btmrvl_private *priv);
 
drivers/bluetooth/btmrvl_main.c +43 -32

112 lines not on this page · raw message

drivers/bluetooth/btmrvl_sdio.c +6 -1
index 94f1f55..874a5e8 100644
@@ -930,7 +930,12 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
 	priv->hw_host_to_card = btmrvl_sdio_host_to_card;
 	priv->hw_wakeup_firmware = btmrvl_sdio_wakeup_fw;
 
-	btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
+	if (btmrvl_register_hdev(priv)) {
+		BT_ERR("Register hdev failed!");
+		ret = -ENODEV;
+		goto disable_host_int;
+	}
+
 	priv->btmrvl_dev.psmode = 1;
 	btmrvl_enable_ps(priv);
 
Signature · 1 line
1.5.3.6
maintainer
#2 lore raw

Re: [PATCH 2/3] Bluetooth: separate btmrvl_register_hdev() from btmrvl_add_card()

Hi Bing,

Quoted 2 lines

Move btmrvl hdev registration code out of btmrvl_add_card(). New function btmrvl_register_hdev() is added.

patch has been applied. Thanks.

Regards

Marcel

author
#3 lore raw

PATCH 3/3 Bluetooth: set hdev->dev_type based on Marvell device type

In reply to Bing Zhao

Get the device type from MODULE_BRINGUP_REQ command response.

---
 drivers/bluetooth/btmrvl_drv.h  |    2 ++
 drivers/bluetooth/btmrvl_main.c |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
drivers/bluetooth/btmrvl_drv.h +2 -0
index ec8ac5e..bd91652 100644
@@ -41,6 +41,8 @@ struct btmrvl_device {
 	void *card;
 	struct hci_dev *hcidev;
 
+	u8 dev_type;
+
 	u8 tx_dnld_rdy;
 
 	u8 psmode;
drivers/bluetooth/btmrvl_main.c +9 -0
index 277cb10..956f40c 100644
@@ -116,6 +116,13 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
 				((event->data[2] == MODULE_BROUGHT_UP) ||
 				(event->data[2] == MODULE_ALREADY_UP)) ?
 				"Bring-up succeed" : "Bring-up failed");
+
+			if (event->length > 3)
+				priv->btmrvl_dev.dev_type = event->data[3];
+			else
+				priv->btmrvl_dev.dev_type = HCI_BREDR;
+
+			BT_DBG("dev_type: %d", priv->btmrvl_dev.dev_type);
 		} else if (priv->btmrvl_dev.sendcmdflag &&
 				event->data[1] == MODULE_SHUTDOWN_REQ) {
 			BT_DBG("EVENT:%s", (event->data[2]) ?
@@ -549,6 +556,8 @@ int btmrvl_register_hdev(struct btmrvl_private *priv)
 
 	btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
 
+	hdev->dev_type = priv->btmrvl_dev.dev_type;
+
 	ret = hci_register_dev(hdev);
 	if (ret < 0) {
 		BT_ERR("Can not register HCI device");
Signature · 1 line
1.5.3.6
maintainer
#4 lore raw

Re: [PATCH 3/3] Bluetooth: set hdev->dev_type based on Marvell device type

Hi Bing,

Quoted 1 line

Get the device type from MODULE_BRINGUP_REQ command response.

patch has been applied. Thanks.

Regards

Marcel

maintainer
#5 lore raw
In reply to Bing Zhao

Hi Bing,

Quoted 2 lines

btmrvl MODULE_BRINGUP_REQ command response returns success with either 0x00 or 0x0c.

patch has been applied. Thanks.

Regards

Marcel