1. May 15, 2020
  2. May 14, 2020
  3. May 13, 2020
    • Archie Pusaka's avatar
      Bluetooth: L2CAP: add support for waiting disconnection resp · 5b440676
      Archie Pusaka authored
      
      
      Whenever we disconnect a L2CAP connection, we would immediately
      report a disconnection event (EPOLLHUP) to the upper layer, without
      waiting for the response of the other device.
      
      This patch offers an option to wait until we receive a disconnection
      response before reporting disconnection event, by using the "how"
      parameter in l2cap_sock_shutdown(). Therefore, upper layer can opt
      to wait for disconnection response by shutdown(sock, SHUT_WR).
      
      This can be used to enforce proper disconnection order in HID,
      where the disconnection of the interrupt channel must be complete
      before attempting to disconnect the control channel.
      
      Signed-off-by: default avatarArchie Pusaka <apusaka@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      5b440676
    • Sonny Sasaka's avatar
      Bluetooth: Handle Inquiry Cancel error after Inquiry Complete · adf1d692
      Sonny Sasaka authored
      
      
      After sending Inquiry Cancel command to the controller, it is possible
      that Inquiry Complete event comes before Inquiry Cancel command complete
      event. In this case the Inquiry Cancel command will have status of
      Command Disallowed since there is no Inquiry session to be cancelled.
      This case should not be treated as error, otherwise we can reach an
      inconsistent state.
      
      Example of a btmon trace when this happened:
      
      < HCI Command: Inquiry Cancel (0x01|0x0002) plen 0
      > HCI Event: Inquiry Complete (0x01) plen 1
              Status: Success (0x00)
      > HCI Event: Command Complete (0x0e) plen 4
            Inquiry Cancel (0x01|0x0002) ncmd 1
              Status: Command Disallowed (0x0c)
      
      Signed-off-by: default avatarSonny Sasaka <sonnysasaka@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      adf1d692
    • Rikard Falkeborn's avatar
      Bluetooth: serdev: Constify serdev_device_ops · 608c39f4
      Rikard Falkeborn authored
      
      
      serdev_device_ops is not modified and can be const. Also, remove the
      unneeded declaration of it.
      
      Output from the file command before and after:
      
      Before:
         text    data     bss     dec     hex filename
         7192    2408     192    9792    2640 drivers/bluetooth/hci_serdev.o
      
      After:
         text    data     bss     dec     hex filename
         7256    2344     192    9792    2640 drivers/bluetooth/hci_serdev.o
      
      Signed-off-by: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      608c39f4
    • Raghuram Hegde's avatar
      Bluetooth: btusb: Add support for Intel Bluetooth Device Typhoon Peak (8087:0032) · 875e1675
      Raghuram Hegde authored
      
      
      Device from /sys/kernel/debug/usb/devices:
      
      T:  Bus=01 Lev=01 Prnt=01 Port=13 Cnt=02 Dev#=  3 Spd=12   MxCh= 0
      D:  Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=8087 ProdID=0032 Rev= 0.00
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
      
      Signed-off-by: default avatarRaghuram Hegde <raghuram.hegde@intel.com>
      Signed-off-by: default avatarChethan T N <chethan.tumkur.narayan@intel.com>
      Signed-off-by: default avatarAmit K Bag <amit.k.bag@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      875e1675
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: btusb: Implement hdev->prevent_wake · b7d0bf11
      Abhishek Pandit-Subedi authored
      
      
      Implement the prevent_wake hook by checking device_may_wakeup on the usb
      interface. This prevents the Bluetooth core from enabling scanning when
      the device isn't expected to wake from suspend.
      
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarAlain Michaud <alainm@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      b7d0bf11
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Add hook for driver to prevent wake from suspend · 81dafad5
      Abhishek Pandit-Subedi authored
      
      
      Let drivers have a hook to disable configuring scanning during suspend.
      Drivers should use the device_may_wakeup function call to determine
      whether hci should be configured for wakeup.
      
      For example, an implementation for btusb may look like the following:
      
        bool btusb_prevent_wake(struct hci_dev *hdev)
        {
              struct btusb_data *data = hci_get_drvdata(hdev);
              return !device_may_wakeup(&data->udev->dev);
        }
      
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarAlain Michaud <alainm@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      81dafad5