Bluetooth: btmrvl: indicate pscan scheduling instant in a debug event
authorBing Zhao <bzhao@marvell.com>
Mon, 31 Mar 2014 21:41:44 +0000 (14:41 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:54 +0000 (17:42 +0200)
A vendor specific command is sent to firmware during
initialization to enable this feature. This command is for
SD8897 only.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btmrvl_drv.h
drivers/bluetooth/btmrvl_main.c
drivers/bluetooth/btmrvl_sdio.c
drivers/bluetooth/btmrvl_sdio.h

index dc79f88f8717f478c8d8ab6d0a7d45849f772ac1..4c313e73df831d88af6620f0f7e8a3ad34b38c94 100644 (file)
@@ -89,6 +89,7 @@ struct btmrvl_private {
 #define MRVL_VENDOR_PKT                        0xFE
 
 /* Vendor specific Bluetooth commands */
+#define BT_CMD_PSCAN_WIN_REPORT_ENABLE 0xFC03
 #define BT_CMD_AUTO_SLEEP_MODE         0xFC23
 #define BT_CMD_HOST_SLEEP_CONFIG       0xFC59
 #define BT_CMD_HOST_SLEEP_ENABLE       0xFC5A
index e9dbddb0b8f1efb1f15ede65f50d80390ca370c3..d35f2e189a6d4a98c057bd1536ec7159e17a97fe 100644 (file)
@@ -214,6 +214,23 @@ int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, u8 subcmd)
 }
 EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd);
 
+int btmrvl_pscan_window_reporting(struct btmrvl_private *priv, u8 subcmd)
+{
+       struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
+       int ret;
+
+       if (!card->support_pscan_win_report)
+               return 0;
+
+       ret = btmrvl_send_sync_cmd(priv, BT_CMD_PSCAN_WIN_REPORT_ENABLE,
+                                  &subcmd, 1);
+       if (ret)
+               BT_ERR("PSCAN_WIN_REPORT_ENABLE command failed: %#x", ret);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(btmrvl_pscan_window_reporting);
+
 int btmrvl_send_hscfg_cmd(struct btmrvl_private *priv)
 {
        int ret;
@@ -489,6 +506,8 @@ static int btmrvl_setup(struct hci_dev *hdev)
 
        btmrvl_cal_data_dt(priv);
 
+       btmrvl_pscan_window_reporting(priv, 0x01);
+
        priv->btmrvl_dev.psmode = 1;
        btmrvl_enable_ps(priv);
 
index 9dedca516ff50567a278fb9a511dbcdfd7a1980c..efff06438b024cc2829777e2df7d3788cc9566ed 100644 (file)
@@ -108,6 +108,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8688 = {
        .helper         = "mrvl/sd8688_helper.bin",
        .firmware       = "mrvl/sd8688.bin",
        .reg            = &btmrvl_reg_8688,
+       .support_pscan_win_report = false,
        .sd_blksz_fw_dl = 64,
 };
 
@@ -115,6 +116,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8787 = {
        .helper         = NULL,
        .firmware       = "mrvl/sd8787_uapsta.bin",
        .reg            = &btmrvl_reg_87xx,
+       .support_pscan_win_report = false,
        .sd_blksz_fw_dl = 256,
 };
 
@@ -122,6 +124,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8797 = {
        .helper         = NULL,
        .firmware       = "mrvl/sd8797_uapsta.bin",
        .reg            = &btmrvl_reg_87xx,
+       .support_pscan_win_report = false,
        .sd_blksz_fw_dl = 256,
 };
 
@@ -129,6 +132,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8897 = {
        .helper         = NULL,
        .firmware       = "mrvl/sd8897_uapsta.bin",
        .reg            = &btmrvl_reg_88xx,
+       .support_pscan_win_report = true,
        .sd_blksz_fw_dl = 256,
 };
 
@@ -1067,6 +1071,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
                card->firmware = data->firmware;
                card->reg = data->reg;
                card->sd_blksz_fw_dl = data->sd_blksz_fw_dl;
+               card->support_pscan_win_report = data->support_pscan_win_report;
        }
 
        if (btmrvl_sdio_register_dev(card) < 0) {
index d4dd3b0fa53d16d68da0101494e43ca4664716c2..453559f98a75e4a895bf1a1086e1d5e754c2509a 100644 (file)
@@ -89,6 +89,7 @@ struct btmrvl_sdio_card {
        const char *helper;
        const char *firmware;
        const struct btmrvl_sdio_card_reg *reg;
+       bool support_pscan_win_report;
        u16 sd_blksz_fw_dl;
        u8 rx_unit;
        struct btmrvl_private *priv;
@@ -98,6 +99,7 @@ struct btmrvl_sdio_device {
        const char *helper;
        const char *firmware;
        const struct btmrvl_sdio_card_reg *reg;
+       const bool support_pscan_win_report;
        u16 sd_blksz_fw_dl;
 };