public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Enable auto sleep mode for btmrvl driver
@ 2009-09-29  2:50 Bing Zhao
  2009-09-29  4:14 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Bing Zhao @ 2009-09-29  2:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bing Zhao, Amitkumar Karwar

From: Amitkumar Karwar <akarwar@marvell.com>

The auto sleep mode for btmrvl driver is not enabled by default.
This patch enables auto sleep mode when card is probed.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
 drivers/bluetooth/btmrvl_drv.h  |    1 +
 drivers/bluetooth/btmrvl_main.c |   56 +++++++++++++++++++++++---------------
 drivers/bluetooth/btmrvl_sdio.c |    2 +
 3 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h
index 411c7a7..523d197 100644
--- a/drivers/bluetooth/btmrvl_drv.h
+++ b/drivers/bluetooth/btmrvl_drv.h
@@ -131,6 +131,7 @@ void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb);
 int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb);
 
 int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd);
+int btmrvl_enable_ps(struct btmrvl_private *priv);
 int btmrvl_prepare_command(struct btmrvl_private *priv);
 
 #ifdef CONFIG_DEBUG_FS
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index e605563..43b5b68 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -189,6 +189,39 @@ int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd)
 }
 EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd);
 
+int btmrvl_enable_ps(struct btmrvl_private *priv)
+{
+	struct sk_buff *skb;
+	struct btmrvl_cmd *cmd;
+	int ret = 0;
+
+	skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC);
+	if (skb == NULL) {
+		BT_ERR("No free skb");
+		return -ENOMEM;
+	}
+
+	cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd));
+	cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF,
+					BT_CMD_AUTO_SLEEP_MODE));
+	cmd->length = 1;
+
+	if (priv->btmrvl_dev.psmode)
+		cmd->data[0] = BT_PS_ENABLE;
+	else
+		cmd->data[0] = BT_PS_DISABLE;
+
+	bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT;
+
+	skb->dev = (void *) priv->btmrvl_dev.hcidev;
+	skb_queue_head(&priv->adapter->tx_queue, skb);
+
+	BT_DBG("Queue PSMODE Command:%d", cmd->data[0]);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(btmrvl_enable_ps);
+
 static int btmrvl_enable_hs(struct btmrvl_private *priv)
 {
 	struct sk_buff *skb;
@@ -258,28 +291,7 @@ int btmrvl_prepare_command(struct btmrvl_private *priv)
 
 	if (priv->btmrvl_dev.pscmd) {
 		priv->btmrvl_dev.pscmd = 0;
-
-		skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC);
-		if (skb == NULL) {
-			BT_ERR("No free skb");
-			return -ENOMEM;
-		}
-
-		cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd));
-		cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF, BT_CMD_AUTO_SLEEP_MODE));
-		cmd->length = 1;
-
-		if (priv->btmrvl_dev.psmode)
-			cmd->data[0] = BT_PS_ENABLE;
-		else
-			cmd->data[0] = BT_PS_DISABLE;
-
-		bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT;
-
-		skb->dev = (void *) priv->btmrvl_dev.hcidev;
-		skb_queue_head(&priv->adapter->tx_queue, skb);
-
-		BT_DBG("Queue PSMODE Command:%d", cmd->data[0]);
+		btmrvl_enable_ps(priv);
 	}
 
 	if (priv->btmrvl_dev.hscmd) {
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 5b33b85..d6aaf51 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -930,6 +930,8 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
 	priv->hw_wakeup_firmware = btmrvl_sdio_wakeup_fw;
 
 	btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
+	priv->btmrvl_dev.psmode = 1;
+	btmrvl_enable_ps(priv);
 
 	return 0;
 
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Bluetooth: Enable auto sleep mode for btmrvl driver
  2009-09-29  2:50 [PATCH] Bluetooth: Enable auto sleep mode for btmrvl driver Bing Zhao
@ 2009-09-29  4:14 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2009-09-29  4:14 UTC (permalink / raw)
  To: Bing Zhao; +Cc: linux-bluetooth, Amitkumar Karwar

Hi Bing,

> From: Amitkumar Karwar <akarwar@marvell.com>
> 
> The auto sleep mode for btmrvl driver is not enabled by default.
> This patch enables auto sleep mode when card is probed.
> 
> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
> Signed-off-by: Bing Zhao <bzhao@marvell.com>
> ---
>  drivers/bluetooth/btmrvl_drv.h  |    1 +
>  drivers/bluetooth/btmrvl_main.c |   56 +++++++++++++++++++++++---------------
>  drivers/bluetooth/btmrvl_sdio.c |    2 +
>  3 files changed, 37 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h
> index 411c7a7..523d197 100644
> --- a/drivers/bluetooth/btmrvl_drv.h
> +++ b/drivers/bluetooth/btmrvl_drv.h
> @@ -131,6 +131,7 @@ void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb);
>  int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb);
>  
>  int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd);
> +int btmrvl_enable_ps(struct btmrvl_private *priv);
>  int btmrvl_prepare_command(struct btmrvl_private *priv);
>  
>  #ifdef CONFIG_DEBUG_FS
> diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
> index e605563..43b5b68 100644
> --- a/drivers/bluetooth/btmrvl_main.c
> +++ b/drivers/bluetooth/btmrvl_main.c
> @@ -189,6 +189,39 @@ int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd)
>  }
>  EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd);
>  
> +int btmrvl_enable_ps(struct btmrvl_private *priv)
> +{
> +	struct sk_buff *skb;
> +	struct btmrvl_cmd *cmd;
> +	int ret = 0;
> +
> +	skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC);
> +	if (skb == NULL) {
> +		BT_ERR("No free skb");
> +		return -ENOMEM;
> +	}
> +
> +	cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd));
> +	cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF,
> +					BT_CMD_AUTO_SLEEP_MODE));
> +	cmd->length = 1;
> +
> +	if (priv->btmrvl_dev.psmode)
> +		cmd->data[0] = BT_PS_ENABLE;
> +	else
> +		cmd->data[0] = BT_PS_DISABLE;
> +
> +	bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT;
> +
> +	skb->dev = (void *) priv->btmrvl_dev.hcidev;
> +	skb_queue_head(&priv->adapter->tx_queue, skb);
> +
> +	BT_DBG("Queue PSMODE Command:%d", cmd->data[0]);
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(btmrvl_enable_ps);

can we please stop this non-sense with int ret = 0. That variable is not
used anywhere. And if you wouldn't init it, the compiler would loudly
complain about it already.

Regards

Marcel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-29  4:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-29  2:50 [PATCH] Bluetooth: Enable auto sleep mode for btmrvl driver Bing Zhao
2009-09-29  4:14 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox