1. 25 1月, 2018 4 次提交
  2. 22 1月, 2018 1 次提交
  3. 18 1月, 2018 1 次提交
    • J
      Bluetooth: btbcm: Add entry for BCM4343A0 UART bluetooth · d456f678
      Jörg Krause 提交于
      This patch adds the device ID for the bluetooth chip used in the
      AMPAK AP6212 WiFi+Bluetooth module. The AP6212 is used on several
      BananaPi boards, e.g. M2-Ultra.
      
      The AP6212 is a combo module, where the WiFi chip is identified as
      BCM43430A0 whereas the Bluetooth chip identifies itself as 4343A0. Note,
      the missing '0' before the 'A0'.
      
      The AP6212 needs a firmware blob. Loading the provided firmware file
      from the BananaPi vendor, the adapter name is printed as
      'BCM4343A0 26MHz AP6212_CL1-0061':
      
      '''
      hci0:	Type: Primary  Bus: UART
      	BD Address: 43:43:A0:12:1F:AC  ACL MTU: 1021:8  SCO MTU: 64:1
      	UP RUNNING
      	RX bytes:3076 acl:0 sco:0 events:278 errors:0
      	TX bytes:39726 acl:0 sco:0 commands:279 errors:0
      	Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
      	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
      	Link policy: RSWITCH SNIFF
      	Link mode: SLAVE ACCEPT
      	Name: 'BCM4343A0 26MHz AP6212_CL1-0061'
      	Class: 0x000000
      	Service Classes: Unspecified
      	Device Class: Miscellaneous,
      	HCI Version: 4.1 (0x7)  Revision: 0xf2
      	LMP Version: 4.1 (0x7)  Subversion: 0x2122
      	Manufacturer: Broadcom Corporation (15)
      '''
      Signed-off-by: NJörg Krause <joerg.krause@embedded.rocks>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      d456f678
  4. 11 1月, 2018 13 次提交
    • L
      Bluetooth: btbcm: Fix sleep mode struct ordering · ff875960
      Lukas Wunner 提交于
      According to the documentation for Laird SD40 radio modules (which use
      the BCM4329 chipset), the order of the Enable_BREAK_To_Host and
      Pulsed_HOST_WAKE parameters in the sleep mode struct is reversed
      vis-à-vis our struct declaration.  See page 46 of this PDF:
      
      http://cdn.lairdtech.com/home/brandworld/files/Application%20Note%20-%2040%20Series%20Bluetooth.pdf
      
      The documentation is dated Oct 2015, so fairly recent, making it appear
      more likely that the documentation is correct and our code is wrong.
      Amend our code to be in congruence with the documentation.
      
      Cc: Sue White <sue.white@lairdtech.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      ff875960
    • L
      Bluetooth: hci_bcm: Sleep instead of spinning · e4b9e5b8
      Lukas Wunner 提交于
      The driver calls mdelay(15) in the ->suspend, ->resume, ->runtime_suspend
      and ->runtime_resume hook, however spinning for such a long period of
      time is discouraged as per Documentation/timers/timers-howto.txt.
      
      The use of mdelay() seems unnecessary, it is allowed to sleep in the
      system sleep and runtime PM hooks (with the exception of ->suspend_noirq
      and ->resume_noirq) and the driver itself also does not rely on a
      non-sleeping ->runtime_resume as the only place where a synchronous
      resume is performed, in bcm_dequeue(), is called from a work item in
      hci_ldisc.c and hci_serdev.c.
      
      So replace the mdelay(15) with msleep(15).
      
      Note that the delay is inserted after asserting or deasserting the
      device wake pin, but in bcm_gpio_set_power() that pin is asserted or
      deasserted *without* observing a delay.  It is thus unclear if the delay
      is necessary at all.  It is likewise unclear why it is exactly 15 ms,
      the commit introducing it, 118612fb ("Bluetooth: hci_bcm: Add
      suspend/resume PM functions"), does not provide a rationale.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Suggested-and-reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      e4b9e5b8
    • L
      Bluetooth: hci_bcm: Silence IRQ printk · 5954cdf1
      Lukas Wunner 提交于
      The host wake IRQ is optional, but if none is found, "BCM irq: -22" is
      logged which may irritate users.  This is really a debug message, so use
      dev_dbg() instead of dev_info().  If users are interested in the IRQ,
      they can always consult /proc/interrupts.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      5954cdf1
    • L
      Bluetooth: hci_bcm: Support Apple GPIO handling · 4c33162c
      Lukas Wunner 提交于
      Enable Bluetooth on the following Macs which provide custom ACPI methods
      to toggle the GPIOs for device wake and shutdown instead of accessing
      the pins directly:
      
          MacBook8,1     2015  12"
          MacBook9,1     2016  12"
          MacBook10,1    2017  12"
          MacBookPro13,1 2016  13"
          MacBookPro13,2 2016  13" with Touch Bar
          MacBookPro13,3 2016  15" with Touch Bar
          MacBookPro14,1 2017  13"
          MacBookPro14,2 2017  13" with Touch Bar
          MacBookPro14,3 2017  15" with Touch Bar
      
      On the MacBook8,1 Bluetooth is muxed with a second device (a debug port
      on the SSD) under the control of PCH GPIO 36.  Because serdev cannot
      deal with multiple slaves yet, it is currently necessary to patch the
      DSDT and remove the SSDC device.
      
      The custom ACPI methods are called:
      
          BTLP (Low Power) takes one argument, toggles device wake GPIO
          BTPU (Power Up) tells SMC to drive shutdown GPIO high
          BTPD (Power Down) tells SMC to drive shutdown GPIO low
          BTRS (Reset) calls BTPD followed by BTPU
          BTRB unknown, not present on all MacBooks
      
      Search for the BTLP, BTPU and BTPD methods on ->probe and cache them in
      struct bcm_device if the machine is a Mac.
      
      Additionally, set the init_speed based on a custom device property
      provided by Apple in lieu of _CRS resources.  The Broadcom UART's speed
      is fixed on Apple Macs:  Any attempt to change it results in Bluetooth
      status code 0x0c and bcm_set_baudrate() thus always returns -EBUSY.
      By setting only the init_speed and leaving oper_speed at zero, we can
      achieve that the host UART's speed is adjusted but the Broadcom UART's
      speed is left as is.
      
      The host wake pin goes into the SMC which handles it independently
      of the OS, so there's no IRQ for it.
      
      Thanks to Ronald Tschalär who did extensive debugging and testing of
      this patch and contributed fixes.
      
      ACPI snippet containing the custom methods and device properties
      (taken from a MacBook8,1):
      
          Method (BTLP, 1, Serialized)
          {
              If (LEqual (Arg0, 0x00))
              {
                  Store (0x01, GD54) /* set PCH GPIO 54 direction to input */
              }
      
              If (LEqual (Arg0, 0x01))
              {
                  Store (0x00, GD54) /* set PCH GPIO 54 direction to output */
                  Store (0x00, GP54) /* set PCH GPIO 54 value to low */
              }
          }
      
          Method (BTPU, 0, Serialized)
          {
              Store (0x01, \_SB.PCI0.LPCB.EC.BTPC)
              Sleep (0x0A)
          }
      
          Method (BTPD, 0, Serialized)
          {
              Store (0x00, \_SB.PCI0.LPCB.EC.BTPC)
              Sleep (0x0A)
          }
      
          Method (BTRS, 0, Serialized)
          {
              BTPD ()
              BTPU ()
          }
      
          Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
          {
              If (LEqual (Arg0, ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b")))
              {
                  Store (Package (0x08)
                      {
                          "baud",
                          Buffer (0x08)
                          { 0xC0, 0xC6, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00 },
      
                          "parity",
                          Buffer (0x08)
                          { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
      
                          "dataBits",
                          Buffer (0x08)
                          { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
      
                          "stopBits",
                          Buffer (0x08)
                          { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
                      }, Local0)
                  DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                  Return (Local0)
              }
              Return (0x00)
          }
      
      Link: https://github.com/Dunedan/mbp-2016-linux/issues/29
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=110901Reported-by: NLeif Liddy <leif.liddy@gmail.com>
      Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Cc: Loic Poulain <loic.poulain@linaro.org>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Tested-by: Max Shavrick <mxms@me.com>                     [MacBook8,1]
      Tested-by: Leif Liddy <leif.liddy@gmail.com>              [MacBook9,1]
      Tested-by: Daniel Roschka <danielroschka@phoenitydawn.de> [MacBookPro13,2]
      Tested-by: Ronald Tschalär <ronald@innovation.ch>         [MacBookPro13,3]
      Tested-by: Peter Y. Chuang <peteryuchuang@gmail.com>      [MacBookPro14,1]
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NRonald Tschalär <ronald@innovation.ch>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      4c33162c
    • L
      Bluetooth: hci_bcm: Handle errors properly · 8bfa7e1e
      Lukas Wunner 提交于
      A significant portion of this driver lacks error handling.  As a first
      step, add error paths to bcm_gpio_set_power(), bcm_open(), bcm_close(),
      bcm_suspend_device(), bcm_resume_device(), bcm_resume(), bcm_probe() and
      bcm_serdev_probe().  (I've also scrutinized bcm_suspend() but think it's
      fine as is.)
      
      Those are all the functions accessing the device wake and shutdown GPIO.
      On Apple Macs the pins are accessed through ACPI methods, which may fail
      for various reasons, hence proper error handling is necessary.  Non-Macs
      access the pins directly, which may fail as well but the GPIO core does
      not yet pass back errors to consumers.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      8bfa7e1e
    • L
      Bluetooth: hci_bcm: Add callbacks to toggle GPIOs · 8353b4a6
      Lukas Wunner 提交于
      MacBooks provides custom ACPI methods to toggle the GPIOs for device
      wake and shutdown instead of accessing the pins directly.  Prepare for
      their support by adding callbacks to toggle the GPIOs, which on non-Macs
      do nothing more but call gpiod_set_value().
      
      No functional change intended.
      Suggested-and-reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      8353b4a6
    • L
    • L
      Bluetooth: hci_bcm: Invalidate IRQ on request failure · 4dc27330
      Lukas Wunner 提交于
      If devm_request_irq() fails, the driver bails out of bcm_request_irq()
      but continues to ->setup the device (because the IRQ is optional).
      
      The driver subsequently calls devm_free_irq(), enable_irq_wake() and
      disable_irq_wake() on the IRQ even though requesting it failed.
      
      Avoid by invalidating the IRQ on request failure.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      4dc27330
    • L
      Bluetooth: hci_bcm: Fix unbalanced pm_runtime_disable() · f4cf6b7e
      Lukas Wunner 提交于
      On ->setup, pm_runtime_enable() is only called if a valid IRQ was found,
      but on ->close(), pm_runtime_disable() is called unconditionally.
      Disablement of runtime PM is recorded in a counter, so every
      pm_runtime_disable() needs to be balanced.  Fix it.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Reported-and-reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      f4cf6b7e
    • L
      Bluetooth: hci_bcm: Fix race on close · 54ba69f9
      Lukas Wunner 提交于
      Upon ->close, the driver powers the Bluetooth controller down, deasserts
      the device wake pin, updates the runtime PM status to "suspended" and
      finally frees the IRQ.
      
      Because the IRQ is freed last, a runtime resume can take place after
      the controller was powered down.  The impact is not grave, the worst
      thing that can happen is that the device wake pin is reasserted (should
      have no effect while the regulator is off) and that setting the runtime
      PM status to "suspended" does not reflect reality.
      
      Still, it's wrong, so free the IRQ first.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      54ba69f9
    • L
      Bluetooth: hci_bcm: Clean up unnecessary #ifdef · 6d83f1ee
      Lukas Wunner 提交于
      pm_runtime_disable() and pm_runtime_set_suspended() are replaced with
      empty inlines if CONFIG_PM is disabled, so there's no need to #ifdef
      them.
      
      device_init_wakeup() is likewise replaced with an inline, though it's
      not empty, but it and devm_free_irq() can be made conditional on
      IS_ENABLED(CONFIG_PM), which is preferable to #ifdef as per section 20
      of Documentation/process/coding-style.rst.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      6d83f1ee
    • R
      Bluetooth: hci_bcm: Validate IRQ before using it · 4a59f1fa
      Ronald Tschalär 提交于
      The ->close, ->suspend and ->resume hooks assume presence of a valid IRQ
      if the device is wakeup capable.  However it's entirely possible that
      wakeup was enabled by some other entity besides this driver and in this
      case the user will get a WARN splat if no valid IRQ was found.  Avoid by
      checking if the IRQ is valid, i.e. > 0.
      
      Case in point:  On recent MacBook Pros, the Bluetooth device lacks an
      IRQ (because host wakeup is handled by the SMC, independently of the
      operating system), but it does possess a _PRW method (which specifies
      the SMC's GPE as wake event).  The ACPI core therefore automatically
      marks the physical Bluetooth device wakeup capable upon binding it to
      its ACPI companion:
      
      device_set_wakeup_capable+0x96/0xb0
      acpi_bind_one+0x28a/0x310
      acpi_platform_notify+0x20/0xa0
      device_add+0x215/0x690
      serdev_device_add+0x57/0xf0
      acpi_serdev_add_device+0xc9/0x110
      acpi_ns_walk_namespace+0x131/0x280
      acpi_walk_namespace+0xf5/0x13d
      serdev_controller_add+0x6f/0x110
      serdev_tty_port_register+0x98/0xf0
      tty_port_register_device_attr_serdev+0x3a/0x70
      uart_add_one_port+0x268/0x500
      serial8250_register_8250_port+0x32e/0x490
      dw8250_probe+0x46c/0x720
      platform_drv_probe+0x35/0x90
      driver_probe_device+0x300/0x450
      bus_for_each_drv+0x67/0xb0
      __device_attach+0xde/0x160
      bus_probe_device+0x9c/0xb0
      device_add+0x448/0x690
      platform_device_add+0x10e/0x260
      mfd_add_device+0x392/0x4c0
      mfd_add_devices+0xb1/0x110
      intel_lpss_probe+0x2a9/0x610 [intel_lpss]
      intel_lpss_pci_probe+0x7a/0xa8 [intel_lpss_pci]
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NRonald Tschalär <ronald@innovation.ch>
      [lukas: fix up ->suspend and ->resume as well, add commit message]
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      4a59f1fa
    • L
      Bluetooth: hci_bcm: Mandate presence of shutdown and device wake GPIO · 3e81a4ca
      Lukas Wunner 提交于
      Commit 0395ffc1 ("Bluetooth: hci_bcm: Add PM for BCM devices")
      amended this driver to request a shutdown and device wake GPIO on probe,
      but mandated that only one of them need to be present:
      
      	/* Make sure at-least one of the GPIO is defined and that
      	 * a name is specified for this instance
      	 */
      	if ((!dev->device_wakeup && !dev->shutdown) || !dev->name) {
      		dev_err(&pdev->dev, "invalid platform data\n");
      		return -EINVAL;
      	}
      
      However the same commit added a call to bcm_gpio_set_power() to the
      ->probe hook, which unconditionally accesses *both* GPIOs.  Luckily,
      the resulting NULL pointer deref was never reported, suggesting there's
      no machine where either GPIO is missing.
      
      Commit 8a920568 ("Bluetooth: hci_bcm: Add (runtime)pm support to the
      serdev driver") removed the check whether at least one of the GPIOs is
      present without specifying a reason.
      
      Because commit 62aaefa7 ("Bluetooth: hci_bcm: improve use of gpios
      API") refactored the driver to use devm_gpiod_get_optional() instead of
      devm_gpiod_get(), one is now tempted to believe that the driver doesn't
      require *any* of the two GPIOs.
      
      Which is wrong, the driver still requires both GPIOs to avoid a NULL
      pointer deref.  To this end, establish the status quo ante and request
      the GPIOs with devm_gpiod_get() again.  Bail out of ->probe if either
      of them is missing.
      
      Oddly enough, whereas bcm_gpio_set_power() accesses the device wake pin
      unconditionally, bcm_suspend_device() and bcm_resume_device() do check
      for its presence before accessing it.  Those checks are superfluous,
      so remove them.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Cc: Loic Poulain <loic.poulain@linaro.org>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      3e81a4ca
  5. 09 1月, 2018 6 次提交
    • H
      Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version · 61f5acea
      Hans de Goede 提交于
      Commit 7d06d589 ("Revert "Bluetooth: btusb: fix QCA...suspend/resume"")
      removed the setting of the BTUSB_RESET_RESUME quirk for QCA Rome devices,
      instead favoring adding USB_QUIRK_RESET_RESUME quirks in usb/core/quirks.c.
      
      This was done because the DIY BTUSB_RESET_RESUME reset-resume handling
      has several issues (see the original commit message). An added advantage
      of moving over to the USB-core reset-resume handling is that it also
      disables autosuspend for these devices, which is similarly broken on these.
      
      But there are 2 issues with this approach:
      1) It leaves the broken DIY BTUSB_RESET_RESUME code in place for Realtek
         devices.
      2) Sofar only 2 of the 10 QCA devices known to the btusb code have been
         added to usb/core/quirks.c and if we fix the Realtek case the same way
         we need to add an additional 14 entries. So in essence we need to
         duplicate a large part of the usb_device_id table in btusb.c in
         usb/core/quirks.c and manually keep them in sync.
      
      This commit instead restores setting a reset-resume quirk for QCA devices
      in the btusb.c code, avoiding the duplicate usb_device_id table problem.
      
      This commit avoids the problems with the original DIY BTUSB_RESET_RESUME
      code by simply setting the USB_QUIRK_RESET_RESUME quirk directly on the
      usb_device.
      
      This commit also moves the BTUSB_REALTEK case over to directly setting the
      USB_QUIRK_RESET_RESUME on the usb_device and removes the now unused
      BTUSB_RESET_RESUME code.
      
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514836
      Fixes: 7d06d589 ("Revert "Bluetooth: btusb: fix QCA...suspend/resume"")
      Cc: stable@vger.kernel.org
      Cc: Leif Liddy <leif.linux@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Brian Norris <briannorris@chromium.org>
      Cc: Daniel Drake <drake@endlessm.com>
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      61f5acea
    • C
      Bluetooth: btintel: make array 'param' static, shrinks object size · 948c7ca0
      Colin Ian King 提交于
      Don't populate the const read-only array 'param' on the stack but instead
      make it static. Makes the object code smaller by nearly 20 bytes:
      
      Before:
         text	   data	    bss	    dec	    hex	filename
        11605	   2629	     64	  14298	   37da	linux/drivers/bluetooth/btintel.o
      
      After:
         text	   data	    bss	    dec	    hex	filename
        11531	   2685	     64	  14280	   37c8	linux/drivers/bluetooth/btintel.o
      
      (gcc version 7.2.0 x86_64)
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      948c7ca0
    • C
      Bluetooth: bpa10x: make array 'req' static, shrinks object size · cca32837
      Colin Ian King 提交于
      Don't populate the const read-only array 'req' on the stack but instead
      make it static. Makes the object code smaller by over 40 bytes:
      
      Before:
         text	   data	    bss	    dec	    hex	filename
         8497	   3408	    128	  12033	   2f01	linux/drivers/bluetooth/bpa10x.o
      
      After:
         text	   data	    bss	    dec	    hex	filename
         8366	   3496	    128	  11990	   2ed6	linux/drivers/bluetooth/bpa10x.o
      
      (gcc version 7.2.0 x86_64)
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      cca32837
    • L
      Bluetooth: Depend on rather than select GPIOLIB · a3a446c7
      Lukas Wunner 提交于
      Commit 27378f4c ("Bluetooth: Avoid WARN splat due to missing
      GPIOLIB") amended Kconfig to select GPIOLIB if BT_HCIUART_NOKIA,
      BT_HCIUART_INTEL or BT_HCIUART_BCM is enabled since all three drivers
      require it to function.
      
      The diagnosis was correct but the treatment was not.  As stated in
      Documentation/gpio/consumer.txt:
      
          Guidelines for GPIOs consumers
          ==============================
      
          Drivers that can't work without standard GPIO calls should have
          Kconfig entries that depend on GPIOLIB.
                               ^^^^^^^^^
      Fix it.
      Reported-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      a3a446c7
    • A
      Bluetooth: hciuart: add nvmem dependency · b71b25fe
      Arnd Bergmann 提交于
      When the hci support is built-in, but mvmem is a loadable module, we
      get a link failure:
      
      drivers/bluetooth/hci_ll.o: In function `hci_ti_probe':
      hci_ll.c:(.text+0x226): undefined reference to `nvmem_cell_get'
      hci_ll.c:(.text+0x238): undefined reference to `nvmem_cell_read'
      hci_ll.c:(.text+0x244): undefined reference to `nvmem_cell_put'
      
      This adds another Kconfig dependency to enforce valid configurations.
      
      Fixes: 0e58d0cd ("Bluetooth: hci_ll: Add optional nvmem BD address source")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      b71b25fe
    • A
      Bluetooth: btusb: Add support for 0cf3:e010 · e5a49ee9
      AceLan Kao 提交于
      Device 0cf3:e010 is one of the QCA ROME family.
      
      T:  Bus=01 Lev=01 Prnt=01 Port=13 Cnt=03 Dev#=  4 Spd=12  MxCh= 0
      D:  Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=0cf3 ProdID=e010 Rev=00.01
      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
      I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      Signed-off-by: NAceLan Kao <acelan.kao@canonical.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      e5a49ee9
  6. 27 12月, 2017 4 次提交
    • K
      Revert "Bluetooth: btusb: fix QCA Rome suspend/resume" · 7d06d589
      Kai-Heng Feng 提交于
      This reverts commit fd865802.
      
      This commit causes a regression on some QCA ROME chips. The USB device
      reset happens in btusb_open(), hence firmware loading gets interrupted.
      
      Furthermore, this commit stops working after commit
      ("a0085f25 Bluetooth: btusb: driver to
      enable the usb-wakeup feature"). Reset-resume quirk only gets enabled in
      btusb_suspend() when it's not a wakeup source.
      
      If we really want to reset the USB device, we need to do it before
      btusb_open(). Let's handle it in drivers/usb/core/quirks.c.
      
      Cc: stable@vger.kernel.org
      Cc: Leif Liddy <leif.linux@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Brian Norris <briannorris@chromium.org>
      Cc: Daniel Drake <drake@endlessm.com>
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Reviewed-by: NBrian Norris <briannorris@chromium.org>
      Tested-by: NBrian Norris <briannorris@chromium.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      7d06d589
    • L
      Bluetooth: hci_bcm: Streamline runtime PM code · 43fff768
      Lukas Wunner 提交于
      This driver seeks to force the Bluetooth device on for the duration of
      5 seconds when the Bluetooth device has woken the host and after a
      complete packet has been received.  It does that by calling:
      
          pm_runtime_get();
          pm_runtime_mark_last_busy();
          pm_runtime_put_autosuspend();
      
      The same can be achieved more succinctly with:
      
          pm_request_resume();
      
      That's because after runtime resuming the device, rpm_resume() invokes
      pm_runtime_mark_last_busy() followed by rpm_idle(), which will cause
      the device to be suspended after expiration of the autosuspend_delay.
      
      No functional change intended.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      43fff768
    • L
      Bluetooth: Avoid WARN splat due to missing GPIOLIB · 27378f4c
      Lukas Wunner 提交于
      Loading hci_bcm with CONFIG_GPIOLIB=n results in the following splat
      when calling gpiod_to_irq() from bcm_get_resources():
      
          WARNING: CPU: 0 PID: 1006 at ./include/linux/gpio/consumer.h:450 bcm_get_resources+0x50/0x80
          CPU: 0 PID: 1006 Comm: kworker/u8:4 Tainted: G       A         4.15.0-rc4custom+ #4
          Hardware name: Apple Inc. MacBook8,1/Mac-BE0E8AC46FE800CC, BIOS MB81.88Z.0168.B00.1708080033 08/08/2017
          Call Trace:
          bcm_serdev_probe+0x8b/0xc0
          driver_probe_device+0x202/0x310
          __driver_attach+0x85/0x90
          ? driver_probe_device+0x310/0x310
          bus_for_each_dev+0x57/0x80
          async_run_entry_fn+0x2c/0xd0
          process_one_work+0x1d2/0x3d0
          worker_thread+0x26/0x3c0
          ? process_one_work+0x3d0/0x3d0
          kthread+0x10c/0x130
          ? kthread_create_on_node+0x40/0x40
          ret_from_fork+0x1f/0x30
      
      We could call gpiod_to_irq() only if IS_ENABLED(CONFIG_GPIOLIB) but
      without GPIOLIB, the driver's power saving features can't be used,
      so selecting GPIOLIB seems more appropriate.
      
      The same issue is present in hci_intel.c and hci_nokia.c, fix those up
      as well.
      Reported-by: NMax Shavrick <mxms@me.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      27378f4c
    • I
      Bluetooth: Add a new 04ca:3015 QCA_ROME device · 0a03f98b
      Ioan Moldovan 提交于
      This patch adds the 04ca:3015 (from a QCA9377 board) Bluetooth device
      to the btusb blacklist and makes the kernel use the btqca module
      instead of btusb. The patch is necessary because, without it the
      04ca:3015 device defaults to using the btusb driver, which makes the
      WIFI side of the QCA9377 board unusable (obtains 0 MBps in speedtest,
      when the 04ca:3015 bluetooth is used with an audio headset).
      
      /sys/kernel/debug/usb/devices:
      
          T:  Bus=01 Lev=01 Prnt=01 Port=04 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
          D:  Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
          P:  Vendor=04ca ProdID=3015 Rev= 0.01
          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=  16 Ivl=1ms
          E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
          E:  Ad=02(O) 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=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
          E:  Ad=03(O) 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=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
          E:  Ad=03(O) 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=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
          E:  Ad=03(O) 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=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
          E:  Ad=03(O) 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=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
          E:  Ad=03(O) 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=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
          E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      Signed-off-by: NIoan Moldovan <ioan.moldovan1999@gmail.com>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      0a03f98b
  7. 13 12月, 2017 11 次提交