[SRU OEM-B][PATCH 0/3] Redpine: Fix HCI command timeout after resume from S4

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU OEM-B][PATCH 0/3] Redpine: Fix HCI command timeout after resume from S4

Shrirang Bagul
BugLink: http://bugs.launchpad.net/bugs/1772626

BT on Redpine RS9113 Wifi+BT combo device stops working after the system
resumes from S4. The command:
$ hciconfig -a

fails with error:
Can't read local name on hci0: Connection timed out (110)

This patch series fixes the BT hci issues after resume from S4.

These patches are already verified by CE-QA with a test kernel based on
Ubuntu-oem-4.15.0-1005.8. Regression potential is minimal becasue, for now
this Wifi+BT card is available only on Dell Edge 300x IoT Gateways.

Ganapathi Raju (3):
  UBUNTU: SAUCE: Bluetooth: btrsi: add hci detach for hibernation and poweroff
  UBUNTU: SAUCE: Bluetooth:btrsi: add null check in hci send and recv functions
  UBUNTU: SAUCE: Bluetooth:btrsi: fix bt cmd timeout issue

 drivers/bluetooth/btrsi.c               | 18 +++++++++++++++++-
 drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 +++++++++++++++++++--
 2 files changed, 36 insertions(+), 3 deletions(-)

--
2.17.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU OEM-B][PATCH 1/3] UBUNTU: SAUCE: Bluetooth: btrsi: add hci detach for hibernation and poweroff

Shrirang Bagul
From: Ganapathi Raju <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1772626

As we missed to detach HCI, while entering power off or hibernation,
an extra hci interface gets created whenever system is woken up, to
avoid this we added hci_detach() in rsi_disconnect(), rsi_freeze(),
and rsi_shutdown() functions which are invoked for these tests.
This patch fixes the issue

Signed-off-by: Ganapathi Raju <[hidden email]>
Signed-off-by: Shrirang Bagul <[hidden email]>
---
 drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index 27e2b07ef9c7..a38580ef3c27 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -1142,7 +1142,12 @@ static void rsi_disconnect(struct sdio_func *pfunction)
 
  rsi_mac80211_detach(adapter);
  mdelay(10);
-
+#ifdef CONFIG_RSI_COEX
+ if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
+ rsi_bt_ops.detach(adapter->priv->bt_adapter);
+ adapter->priv->bt_adapter = NULL;
+ }
+#endif
  /* Reset Chip */
  rsi_reset_chip(adapter);
 
@@ -1325,6 +1330,13 @@ static int rsi_freeze(struct device *dev)
  rsi_dbg(ERR_ZONE,
  "##### Device can not wake up through WLAN\n");
 
+#ifdef CONFIG_RSI_COEX
+ if (common->coex_mode > 1 && common->bt_adapter) {
+ rsi_bt_ops.detach(common->bt_adapter);
+ common->bt_adapter = NULL;
+ }
+#endif
+
  ret = rsi_sdio_disable_interrupts(pfunction);
 
  if (sdev->write_fail)
@@ -1371,7 +1383,12 @@ static void rsi_shutdown(struct device *dev)
 
  if (rsi_config_wowlan(adapter, wowlan))
  rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n");
-
+#ifdef CONFIG_RSI_COEX
+ if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
+ rsi_bt_ops.detach(adapter->priv->bt_adapter);
+ adapter->priv->bt_adapter = NULL;
+ }
+#endif
  rsi_sdio_disable_interrupts(sdev->pfunction);
 
  if (sdev->write_fail)
--
2.17.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU OEM-B][PATCH 2/3] UBUNTU: SAUCE: Bluetooth:btrsi: add null check in hci send and recv functions

Shrirang Bagul
In reply to this post by Shrirang Bagul
From: Ganapathi Raju <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1772626

During power save S3 and S4 stress tests driver sometimes crashes
because of accessing the hdev pointer in rsi_hci_recv_pkt() and
rsi_hci_send_pkt() which is NULL. Fixed by adding NULL check
before accessing hdev in these functions.

Signed-off-by: Ganapathi Raju <[hidden email]>
Signed-off-by: Shrirang Bagul <[hidden email]>
---
 drivers/bluetooth/btrsi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/bluetooth/btrsi.c b/drivers/bluetooth/btrsi.c
index 5034325e417c..5dfb2f462f42 100644
--- a/drivers/bluetooth/btrsi.c
+++ b/drivers/bluetooth/btrsi.c
@@ -51,6 +51,9 @@ static int rsi_hci_send_pkt(struct hci_dev *hdev, struct sk_buff *skb)
  struct rsi_hci_adapter *h_adapter = hci_get_drvdata(hdev);
  struct sk_buff *new_skb = NULL;
 
+ if (!h_adapter->hdev)
+ return -ENODEV;
+
  switch (hci_skb_pkt_type(skb)) {
  case HCI_COMMAND_PKT:
  hdev->stat.cmd_tx++;
@@ -84,6 +87,9 @@ static int rsi_hci_recv_pkt(void *priv, const u8 *pkt)
  struct sk_buff *skb;
  int pkt_len = get_unaligned_le16(pkt) & 0x0fff;
 
+ if (!h_adapter->hdev)
+ return -ENODEV;
+
  skb = dev_alloc_skb(pkt_len);
  if (!skb)
  return -ENOMEM;
--
2.17.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU OEM-B][PATCH 3/3] UBUNTU: SAUCE: Bluetooth:btrsi: fix bt cmd timeout issue

Shrirang Bagul
In reply to this post by Shrirang Bagul
From: Ganapathi Raju <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1772626

Sometimes data is coming with unaligned address from kernel BT stack,
if unaligned address is passed, some data in payload is stripped when
packet is loaded to firmware. Fixed this by moving the data to
aligned address.

Signed-off-by: Ganapathi Raju <[hidden email]>
Signed-off-by: Shrirang Bagul <[hidden email]>
---
 drivers/bluetooth/btrsi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btrsi.c b/drivers/bluetooth/btrsi.c
index 5dfb2f462f42..3ef62b906576 100644
--- a/drivers/bluetooth/btrsi.c
+++ b/drivers/bluetooth/btrsi.c
@@ -22,8 +22,9 @@
 #include <net/rsi_91x.h>
 #include <net/genetlink.h>
 
-#define RSI_HEADROOM_FOR_BT_HAL 16
+#define RSI_SDIO_DMA_ALIGN 8
 #define RSI_FRAME_DESC_SIZE 16
+#define RSI_HEADROOM_FOR_BT_HAL (RSI_FRAME_DESC_SIZE + RSI_SDIO_DMA_ALIGN)
 
 struct rsi_hci_adapter {
  void *priv;
@@ -74,6 +75,15 @@ static int rsi_hci_send_pkt(struct hci_dev *hdev, struct sk_buff *skb)
  bt_cb(new_skb)->pkt_type = hci_skb_pkt_type(skb);
  kfree_skb(skb);
  skb = new_skb;
+ if (!IS_ALIGNED((unsigned long)skb->data, RSI_SDIO_DMA_ALIGN)) {
+ u8 *skb_data = skb->data;
+ int skb_len = skb->len;
+
+ skb_push(skb, RSI_SDIO_DMA_ALIGN);
+ skb_pull(skb, PTR_ALIGN(skb->data,
+ RSI_SDIO_DMA_ALIGN) - skb->data);
+ memmove(skb->data, skb_data, skb_len);
+ }
  }
 
  return h_adapter->proto_ops->coex_send_pkt(h_adapter->priv, skb,
--
2.17.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [SRU OEM-B][PATCH 0/3] Redpine: Fix HCI command timeout after resume from S4

Timo Aaltonen-6
In reply to this post by Shrirang Bagul
On 22.05.2018 13:49, Shrirang Bagul wrote:

> BugLink: http://bugs.launchpad.net/bugs/1772626
>
> BT on Redpine RS9113 Wifi+BT combo device stops working after the system
> resumes from S4. The command:
> $ hciconfig -a
>
> fails with error:
> Can't read local name on hci0: Connection timed out (110)
>
> This patch series fixes the BT hci issues after resume from S4.
>
> These patches are already verified by CE-QA with a test kernel based on
> Ubuntu-oem-4.15.0-1005.8. Regression potential is minimal becasue, for now
> this Wifi+BT card is available only on Dell Edge 300x IoT Gateways.
>
> Ganapathi Raju (3):
>   UBUNTU: SAUCE: Bluetooth: btrsi: add hci detach for hibernation and poweroff
>   UBUNTU: SAUCE: Bluetooth:btrsi: add null check in hci send and recv functions
>   UBUNTU: SAUCE: Bluetooth:btrsi: fix bt cmd timeout issue
>
>  drivers/bluetooth/btrsi.c               | 18 +++++++++++++++++-
>  drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 +++++++++++++++++++--
>  2 files changed, 36 insertions(+), 3 deletions(-)
>

applied to bionic/oem-next, thanks


--
t

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team