1. 22 Jul, 2022 27 commits
    • Hilda Wu's avatar
      Bluetooth: btusb: Add Realtek RTL8852C support ID 0x13D3:0x3586 · 6ad353df
      Hilda Wu authored
      Add the support ID(0x13D3, 0x3586) to usb_device_id table for
      Realtek RTL8852C.
      
      The device info from /sys/kernel/debug/usb/devices as below.
      
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
      D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=13d3 ProdID=3586 Rev= 0.00
      S:  Manufacturer=Realtek
      S:  Product=Bluetooth Radio
      S:  SerialNumber=00e04c000001
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 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
      Signed-off-by: default avatarHilda Wu <hildawu@realtek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      6ad353df
    • Hilda Wu's avatar
      Bluetooth: btusb: Add Realtek RTL8852C support ID 0x13D3:0x3587 · 8f0054dd
      Hilda Wu authored
      Add the support ID(0x13D3, 0x3587) to usb_device_id table for
      Realtek RTL8852C.
      
      The device info from /sys/kernel/debug/usb/devices as below.
      
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
      D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=13d3 ProdID=3587 Rev= 0.00
      S:  Manufacturer=Realtek
      S:  Product=Bluetooth Radio
      S:  SerialNumber=00e04c000001
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 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
      Signed-off-by: default avatarHilda Wu <hildawu@realtek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      8f0054dd
    • Hilda Wu's avatar
      Bluetooth: btusb: Add Realtek RTL8852C support ID 0x0CB8:0xC558 · 5b75ee37
      Hilda Wu authored
      Add the support ID(0x0CB8, 0xC558) to usb_device_id table for
      Realtek RTL8852C.
      
      The device info from /sys/kernel/debug/usb/devices as below.
      
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
      D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=0cb8 ProdID=c558 Rev= 0.00
      S:  Manufacturer=Realtek
      S:  Product=Bluetooth Radio
      S:  SerialNumber=00e04c000001
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 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
      Signed-off-by: default avatarHilda Wu <hildawu@realtek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      5b75ee37
    • Hilda Wu's avatar
      Bluetooth: btusb: Add Realtek RTL8852C support ID 0x04C5:0x1675 · 893fa8bc
      Hilda Wu authored
      Add the support ID(0x04c5, 0x1675) to usb_device_id table for
      Realtek RTL8852C.
      
      The device info from /sys/kernel/debug/usb/devices as below.
      
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
      D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=04c5 ProdID=1675 Rev= 0.00
      S:  Manufacturer=Realtek
      S:  Product=Bluetooth Radio
      S:  SerialNumber=00e04c000001
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 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
      Signed-off-by: default avatarHilda Wu <hildawu@realtek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      893fa8bc
    • Hilda Wu's avatar
      Bluetooth: btusb: Add Realtek RTL8852C support ID 0x04CA:0x4007 · c379c96c
      Hilda Wu authored
      Add the support ID(0x04CA, 0x4007) to usb_device_id table for
      Realtek RTL8852C.
      
      The device info from /sys/kernel/debug/usb/devices as below.
      
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
      D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=04ca ProdID=4007 Rev= 0.00
      S:  Manufacturer=Realtek
      S:  Product=Bluetooth Radio
      S:  SerialNumber=00e04c000001
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 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
      Signed-off-by: default avatarHilda Wu <hildawu@realtek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      c379c96c
    • Ying Hsu's avatar
      Bluetooth: Add default wakeup callback for HCI UART driver · bee5395c
      Ying Hsu authored
      Bluetooth HCI devices indicate if they are able to wakeup in the wakeup
      callback since 'commit 4539ca67 ("Bluetooth: Rename driver
      .prevent_wake to .wakeup")'. This patch adds a default wakeup callback
      for Bluetooth HCI UAR devices. It assumes Bluetooth HCI UART devices are
      wakeable for backward compatibility. For those who need a customized
      behavior, one can override it before calling hci_uart_register_device().
      
      Fixes: 4539ca67 ("Bluetooth: Rename driver .prevent_wake to .wakeup")
      Signed-off-by: default avatarYing Hsu <yinghsu@chromium.org>
      Reviewed-by: default avatarAlain Michaud <alainm@chromium.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      bee5395c
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Don't remove connected devices from accept list · 6828b583
      Luiz Augusto von Dentz authored
      These devices are likely going to be reprogrammed when disconnected so
      this avoid a whole bunch of commands attempt to remove and the add back
      to the list.
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Tested-by: default avatarZhengping Jiang <jiangzp@google.com>
      6828b583
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Fix not updating privacy_mode · 0900b1c6
      Luiz Augusto von Dentz authored
      When programming a new entry into the resolving list it shall default
      to network mode since the params may contain the mode programmed when
      the device was last added to the resolving list.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=209745
      Fixes: 853b70b5 ("Bluetooth: hci_sync: Set Privacy Mode when updating the resolving list")
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Tested-by: default avatarZhengping Jiang <jiangzp@google.com>
      0900b1c6
    • Tamas Koczka's avatar
      Bluetooth: Collect kcov coverage from hci_rx_work · 9f30de9e
      Tamas Koczka authored
      Annotate hci_rx_work() with kcov_remote_start() and kcov_remote_stop()
      calls, so remote KCOV coverage is collected while processing the rx_q
      queue which is the main incoming Bluetooth packet queue.
      
      Coverage is associated with the thread which created the packet skb.
      
      The collected extra coverage helps kernel fuzzing efforts in finding
      vulnerabilities.
      
      This change only has effect if the kernel is compiled with CONFIG_KCOV,
      otherwise kcov_ functions don't do anything.
      Signed-off-by: default avatarTamas Koczka <poprdi@google.com>
      Tested-by: default avatarAleksandr Nogikh <nogikh@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      9f30de9e
    • Zhengping Jiang's avatar
      Bluetooth: hci_sync: Fix resuming scan after suspend resume · 68253f3c
      Zhengping Jiang authored
      After resuming, remove setting scanning_paused to false, because it is
      checked and set to false in hci_resume_scan_sync. Also move setting
      the value to false before updating passive scan, because the value is
      used when resuming passive scan.
      
      Fixes: 3b420553 (Bluetooth: hci_sync: Fix attempting to suspend with
      unfiltered passive scan)
      Signed-off-by: default avatarZhengping Jiang <jiangzp@google.com>
      Reviewed-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      68253f3c
    • Sean Wang's avatar
      Bluetooth: btmtksdio: Add in-band wakeup support · df332800
      Sean Wang authored
      Commit ce64b3e9 ("Bluetooth: mt7921s: Support wake on bluetooth")
      adds the wake on bluethooth via a dedicated GPIO.
      
      Extend the wake-on-bluetooth to use the SDIO DAT1 pin (in-band wakeup),
      when supported by the SDIO host driver.
      Co-developed-by: default avatarYake Yang <yake.yang@mediatek.com>
      Signed-off-by: default avatarYake Yang <yake.yang@mediatek.com>
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      df332800
    • Zhengping Jiang's avatar
      Bluetooth: mgmt: Fix refresh cached connection info · d7b2fdfb
      Zhengping Jiang authored
      Set the connection data before calling get_conn_info_sync, so it can be
      verified the connection is still connected, before refreshing cached
      values.
      
      Fixes: 47db6b42 ("Bluetooth: hci_sync: Convert MGMT_OP_GET_CONN_INFO")
      Signed-off-by: default avatarZhengping Jiang <jiangzp@google.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      d7b2fdfb
    • Luiz Augusto von Dentz's avatar
      Bluetooth: HCI: Fix not always setting Scan Response/Advertising Data · 34a718bc
      Luiz Augusto von Dentz authored
      The scan response and advertising data needs to be tracked on a per
      instance (adv_info) since when these instaces are removed so are their
      data, to fix that new flags are introduced which is used to mark when
      the data changes and then checked to confirm when the data needs to be
      synced with the controller.
      Tested-by: default avatarTedd Ho-Jeong An <tedd.an@intel.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      34a718bc
    • Luiz Augusto von Dentz's avatar
      Bluetooth: eir: Fix using strlen with hdev->{dev_name,short_name} · dd7b8cdd
      Luiz Augusto von Dentz authored
      Both dev_name and short_name are not guaranteed to be NULL terminated so
      this instead use strnlen and then attempt to determine if the resulting
      string needs to be truncated or not.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216018Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      dd7b8cdd
    • Xiaohui Zhang's avatar
      Bluetooth: use memset avoid memory leaks · a5133fe8
      Xiaohui Zhang authored
      Similar to the handling of l2cap_ecred_connect in commit d3715b23
      ("Bluetooth: use memset avoid memory leaks"), we thought a patch
      might be needed here as well.
      
      Use memset to initialize structs to prevent memory leaks
      in l2cap_le_connect
      Signed-off-by: default avatarXiaohui Zhang <xiaohuizhang@ruc.edu.cn>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      a5133fe8
    • Dan Carpenter's avatar
      Bluetooth: fix an error code in hci_register_dev() · 91117864
      Dan Carpenter authored
      Preserve the error code from hci_register_suspend_notifier().  Don't
      return success.
      
      Fixes: d6bb2a91f95b ("Bluetooth: Unregister suspend with userchannel")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      91117864
    • Ahmad Fatoum's avatar
      Bluetooth: hci_bcm: Add BCM4349B1 variant · 4f17c2b6
      Ahmad Fatoum authored
      The BCM4349B1, aka CYW/BCM89359, is a WiFi+BT chip and its Bluetooth
      portion can be controlled over serial.
      
      Two subversions are added for the chip, because ROM firmware reports
      002.002.013 (at least for the chips I have here), while depending on
      patchram firmware revision, either 002.002.013 or 002.002.014 is
      reported.
      Signed-off-by: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      4f17c2b6
    • Ahmad Fatoum's avatar
      dt-bindings: bluetooth: broadcom: Add BCM4349B1 DT binding · 88b65887
      Ahmad Fatoum authored
      The BCM4349B1, aka CYW/BCM89359, is a WiFi+BT chip and its Bluetooth
      portion can be controlled over serial.
      Extend the binding with its DT compatible.
      Acked-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      88b65887
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Unregister suspend with userchannel · 359ee4f8
      Abhishek Pandit-Subedi authored
      When HCI_USERCHANNEL is used, unregister the suspend notifier when
      binding and register when releasing. The userchannel socket should be
      left alone after open is completed.
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      359ee4f8
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Fix index added after unregister · 0acef50b
      Abhishek Pandit-Subedi authored
      When a userchannel socket is released, we should check whether the hdev
      is already unregistered before sending out an IndexAdded.
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      0acef50b
    • Schspa Shi's avatar
      Bluetooth: When HCI work queue is drained, only queue chained work · 877afada
      Schspa Shi authored
      The HCI command, event, and data packet processing workqueue is drained
      to avoid deadlock in commit
      76727c02 ("Bluetooth: Call drain_workqueue() before resetting state").
      
      There is another delayed work, which will queue command to this drained
      workqueue. Which results in the following error report:
      
      Bluetooth: hci2: command 0x040f tx timeout
      WARNING: CPU: 1 PID: 18374 at kernel/workqueue.c:1438 __queue_work+0xdad/0x1140
      Workqueue: events hci_cmd_timeout
      RIP: 0010:__queue_work+0xdad/0x1140
      RSP: 0000:ffffc90002cffc60 EFLAGS: 00010093
      RAX: 0000000000000000 RBX: ffff8880b9d3ec00 RCX: 0000000000000000
      RDX: ffff888024ba0000 RSI: ffffffff814e048d RDI: ffff8880b9d3ec08
      RBP: 0000000000000008 R08: 0000000000000000 R09: 00000000b9d39700
      R10: ffffffff814f73c6 R11: 0000000000000000 R12: ffff88807cce4c60
      R13: 0000000000000000 R14: ffff8880796d8800 R15: ffff8880796d8800
      FS:  0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 000000c0174b4000 CR3: 000000007cae9000 CR4: 00000000003506e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       ? queue_work_on+0xcb/0x110
       ? lockdep_hardirqs_off+0x90/0xd0
       queue_work_on+0xee/0x110
       process_one_work+0x996/0x1610
       ? pwq_dec_nr_in_flight+0x2a0/0x2a0
       ? rwlock_bug.part.0+0x90/0x90
       ? _raw_spin_lock_irq+0x41/0x50
       worker_thread+0x665/0x1080
       ? process_one_work+0x1610/0x1610
       kthread+0x2e9/0x3a0
       ? kthread_complete_and_exit+0x40/0x40
       ret_from_fork+0x1f/0x30
       </TASK>
      
      To fix this, we can add a new HCI_DRAIN_WQ flag, and don't queue the
      timeout workqueue while command workqueue is draining.
      
      Fixes: 76727c02 ("Bluetooth: Call drain_workqueue() before resetting state")
      Reported-by: syzbot+63bed493aebbf6872647@syzkaller.appspotmail.com
      Signed-off-by: default avatarSchspa Shi <schspa@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      877afada
    • Jiasheng Jiang's avatar
      Bluetooth: hci_intel: Add check for platform_driver_register · ab2d2a98
      Jiasheng Jiang authored
      As platform_driver_register() could fail, it should be better
      to deal with the return value in order to maintain the code
      consisitency.
      
      Fixes: 1ab1f239 ("Bluetooth: hci_intel: Add support for platform driver")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      ab2d2a98
    • Alain Michaud's avatar
      Bluetooth: clear the temporary linkkey in hci_conn_cleanup · 629f66aa
      Alain Michaud authored
      If a hardware error occurs and the connections are flushed without a
      disconnection_complete event being signaled, the temporary linkkeys are
      not flushed.
      
      This change ensures that any outstanding flushable linkkeys are flushed
      when the connection are flushed from the hash table.
      
      Additionally, this also makes use of test_and_clear_bit to avoid
      multiple attempts to delete the link key that's already been flushed.
      Signed-off-by: default avatarAlain Michaud <alainm@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      629f66aa
    • Hakan Jansson's avatar
      Bluetooth: hci_bcm: Add support for FW loading in autobaud mode · af35e28f
      Hakan Jansson authored
      Use the presence of a DT property, "brcm,requires-autobaud-mode", to enable
      startup in autobaud mode. If the property is present, the device is started
      in autobaud mode by asserting RTS (BT_UART_CTS_N) prior to powering on the
      device.
      
      Also prevent the use of unsupported commands for devices started in
      autobaud mode. Only a limited subset of HCI commands are supported in
      autobaud mode.
      
      Some devices (e.g. CYW5557x) require autobaud mode to enable FW loading.
      Autobaud mode can also be required on some boards where the controller
      device is using a non-standard baud rate in normal mode when first powered
      on.
      Signed-off-by: default avatarHakan Jansson <hakan.jansson@infineon.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      af35e28f
    • Hakan Jansson's avatar
      dt-bindings: net: broadcom-bluetooth: Add property for autobaud mode · 0b4de252
      Hakan Jansson authored
      Add property, "brcm,requires-autobaud-mode", to enable autobaud mode
      selection.
      
      Some devices (e.g. CYW5557x) require autobaud mode to enable FW loading.
      Autobaud mode can also be required on some boards where the controller
      device is using a non-standard baud rate when first powered on.
      Signed-off-by: default avatarHakan Jansson <hakan.jansson@infineon.com>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      0b4de252
    • Sai Teja Aluvala's avatar
      Bluetooth: hci_qca: Return wakeup for qca_wakeup · bde63e9e
      Sai Teja Aluvala authored
      This fixes the return value of qca_wakeup(), since
      .wakeup work inversely with original .prevent_wake.
      
      Fixes: 4539ca67 (Bluetooth: Rename driver .prevent_wake to .wakeup)
      Signed-off-by: default avatarSai Teja Aluvala <quic_saluvala@quicinc.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      bde63e9e
    • Aaron Ma's avatar
      Bluetooth: btusb: Add support of IMC Networks PID 0x3568 · c69ecb0e
      Aaron Ma authored
      It is 13d3:3568 for MediaTek MT7922 USB Bluetooth chip.
      
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=13d3 ProdID=3568 Rev=01.00
      S:  Manufacturer=MediaTek Inc.
      S:  Product=Wireless_Device
      S:  SerialNumber=...
      C:  #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=125us
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 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#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
      E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
      E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
      Signed-off-by: default avatarAaron Ma <aaron.ma@canonical.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      c69ecb0e
  2. 21 Jul, 2022 13 commits