1. 25 Sep, 2020 5 commits
  2. 20 Sep, 2020 4 commits
  3. 14 Sep, 2020 3 commits
  4. 13 Sep, 2020 6 commits
    • Kiran K's avatar
      Bluetooth: btintel: Refactor firmware download function · e9117215
      Kiran K authored
      Split firmware download code into two functions - one to download
      header and other to download payload. This patch enhances readability
      and reusabiltiy of code
      Signed-off-by: default avatarKiran K <kiran.k@intel.com>
      Reviewed-by: default avatarChethan T N <chethan.tumkur.narayan@intel.com>
      Reviewed-by: default avatarSathish Narasimman <Sathish.Narasimman@intel.com>
      Reviewed-by: default avatarSrivatsa Ravishankar <ravishankar.srivatsa@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      e9117215
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Emit controller suspend and resume events · 2f20216c
      Abhishek Pandit-Subedi authored
      Emit controller suspend and resume events when we are ready for suspend
      and we've resumed from suspend.
      
      The controller suspend event will report whatever suspend state was
      successfully entered. The controller resume event will check the first
      HCI event that was received after we finished preparing for suspend and,
      if it was a connection event, store the address of the peer that caused
      the event. If it was not a connection event, we mark the wake reason as
      an unexpected event.
      
      Here is a sample btmon trace with these events:
      
      @ MGMT Event: Controller Suspended (0x002d) plen 1
              Suspend state: Page scanning and/or passive scanning (2)
      
      @ MGMT Event: Controller Resumed (0x002e) plen 8
              Wake reason: Remote wake due to peer device connection (2)
              LE Address: CD:F3:CD:13:C5:9A (OUI CD-F3-CD)
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      2f20216c
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Add suspend reason for device disconnect · f0cfc486
      Abhishek Pandit-Subedi authored
      Update device disconnect event with reason 0x5 to indicate that device
      disconnected because the controller is suspending.
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
      Reviewed-by: default avatarSonny Sasaka <sonnysasaka@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      f0cfc486
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Add mgmt suspend and resume events · 346ce5b7
      Abhishek Pandit-Subedi authored
      Add the controller suspend and resume events, which will signal when
      Bluetooth has completed preparing for suspend and when it's ready for
      resume.
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
      Reviewed-by: default avatarSonny Sasaka <sonnysasaka@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      346ce5b7
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Set ext scan response only when it exists · 6baf8a6a
      Abhishek Pandit-Subedi authored
      Only set extended scan response only when it exists. Otherwise, clear
      the scan response data.
      
      Per the core spec v5.2, Vol 4, Part E, 7.8.55
      
      If the advertising set is non-scannable and the Host uses this command
      other than to discard existing data, the Controller shall return the
      error code Invalid HCI Command Parameters (0x12).
      
      On WCN3991, the controller correctly responds with Invalid Parameters
      when this is sent.  That error causes __hci_req_hci_power_on to fail
      with -EINVAL and LE devices can't connect because background scanning
      isn't configured.
      
      Here is an hci trace of where this issue occurs during power on:
      
      < HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen 25
              Handle: 0x00
              Properties: 0x0010
                Use legacy advertising PDUs: ADV_NONCONN_IND
              Min advertising interval: 181.250 msec (0x0122)
              Max advertising interval: 181.250 msec (0x0122)
              Channel map: 37, 38, 39 (0x07)
              Own address type: Random (0x01)
              Peer address type: Public (0x00)
              Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
              Filter policy: Allow Scan Request from Any, Allow Connect...
              TX power: 127 dbm (0x7f)
              Primary PHY: LE 1M (0x01)
              Secondary max skip: 0x00
              Secondary PHY: LE 1M (0x01)
              SID: 0x00
              Scan request notifications: Disabled (0x00)
      > HCI Event: Command Complete (0x0e) plen 5
            LE Set Extended Advertising Parameters (0x08|0x0036) ncmd 1
              Status: Success (0x00)
              TX power (selected): 9 dbm (0x09)
      < HCI Command: LE Set Advertising Set Random Address (0x08|0x0035) plen 7
              Advertising handle: 0x00
              Advertising random address: 08:FD:55:ED:22:28 (OUI 08-FD-55)
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Advertising Set Random Address (0x08|0x0035) ncmd
              Status: Success (0x00)
      < HCI Command: LE Set Extended Scan Response Data (0x08|0x0038) plen 35
              Handle: 0x00
              Operation: Complete scan response data (0x03)
              Fragment preference: Minimize fragmentation (0x01)
              Data length: 0x0d
              Name (short): Chromebook
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Extended Scan Response Data (0x08|0x0038) ncmd 1
              Status: Invalid HCI Command Parameters (0x12)
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarDaniel Winkler <danielwinkler@google.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      6baf8a6a
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Only mark socket zapped after unlocking · 20ae4089
      Abhishek Pandit-Subedi authored
      Since l2cap_sock_teardown_cb doesn't acquire the channel lock before
      setting the socket as zapped, it could potentially race with
      l2cap_sock_release which frees the socket. Thus, wait until the cleanup
      is complete before marking the socket as zapped.
      
      This race was reproduced on a JBL GO speaker after the remote device
      rejected L2CAP connection due to resource unavailability.
      
      Here is a dmesg log with debug logs from a repro of this bug:
      [ 3465.424086] Bluetooth: hci_core.c:hci_acldata_packet() hci0 len 16 handle 0x0003 flags 0x0002
      [ 3465.424090] Bluetooth: hci_conn.c:hci_conn_enter_active_mode() hcon 00000000cfedd07d mode 0
      [ 3465.424094] Bluetooth: l2cap_core.c:l2cap_recv_acldata() conn 000000007eae8952 len 16 flags 0x2
      [ 3465.424098] Bluetooth: l2cap_core.c:l2cap_recv_frame() len 12, cid 0x0001
      [ 3465.424102] Bluetooth: l2cap_core.c:l2cap_raw_recv() conn 000000007eae8952
      [ 3465.424175] Bluetooth: l2cap_core.c:l2cap_sig_channel() code 0x03 len 8 id 0x0c
      [ 3465.424180] Bluetooth: l2cap_core.c:l2cap_connect_create_rsp() dcid 0x0045 scid 0x0000 result 0x02 status 0x00
      [ 3465.424189] Bluetooth: l2cap_core.c:l2cap_chan_put() chan 000000006acf9bff orig refcnt 4
      [ 3465.424196] Bluetooth: l2cap_core.c:l2cap_chan_del() chan 000000006acf9bff, conn 000000007eae8952, err 111, state BT_CONNECT
      [ 3465.424203] Bluetooth: l2cap_sock.c:l2cap_sock_teardown_cb() chan 000000006acf9bff state BT_CONNECT
      [ 3465.424221] Bluetooth: l2cap_core.c:l2cap_chan_put() chan 000000006acf9bff orig refcnt 3
      [ 3465.424226] Bluetooth: hci_core.h:hci_conn_drop() hcon 00000000cfedd07d orig refcnt 6
      [ 3465.424234] BUG: spinlock bad magic on CPU#2, kworker/u17:0/159
      [ 3465.425626] Bluetooth: hci_sock.c:hci_sock_sendmsg() sock 000000002bb0cb64 sk 00000000a7964053
      [ 3465.430330]  lock: 0xffffff804410aac0, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
      [ 3465.430332] Causing a watchdog bite!
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reported-by: default avatarBalakrishna Godavarthi <bgodavar@codeaurora.org>
      Reviewed-by: default avatarManish Mandlik <mmandlik@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      20ae4089
  5. 11 Sep, 2020 12 commits
  6. 01 Sep, 2020 1 commit
  7. 31 Aug, 2020 2 commits
  8. 02 Aug, 2020 3 commits
  9. 01 Aug, 2020 4 commits