Bluetooth: btusb: Use an error label for error paths
Subsystems (4)
PATCH v4 1/3 Bluetooth: btusb: Use an error label for error paths
Use a label to remove the repetetive cleanup, for error cases.
---
v4: same as v3
v3: Added Brian's "Reviewed-by"
v2: same as v1
drivers/bluetooth/btusb.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/bluetooth/btusb.c +9 -10
@@ -2991,18 +2991,15 @@ static int btusb_probe(struct usb_interface *intf, err =usb_set_interface (data->udev,0 ,0 );if (err <0 ) {BT_ERR ("failed to set interface 0, alt 0 %d" , err); -hci_free_dev (hdev); -return err; + goto out_free_dev; } }if (data->isoc) { err =usb_driver_claim_interface (&btusb_driver, data->isoc, data); -if (err <0 ) { -hci_free_dev (hdev); -return err; - } +if (err <0 ) + goto out_free_dev; }#ifdef CONFIG_BT_HCIBTUSB_BCM
@@ -3016,14 +3013,16 @@ static int btusb_probe(struct usb_interface *intf,#endif err =hci_register_dev (hdev); -if (err <0 ) { -hci_free_dev (hdev); -return err; - } +if (err <0 ) + goto out_free_dev;usb_set_intfdata (intf, data);return 0 ; + +out_free_dev: +hci_free_dev (hdev); +return err; }static void btusb_disconnect (struct usb_interface *intf)
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v4 2/3 Bluetooth: btusb: Add out-of-band wakeup support
Some onboard BT chips (e.g. Marvell 8997) contain a wakeup pin that can be connected to a gpio on the CPU side, and can be used to wakeup the host out-of-band. This can be useful in situations where the in-band wakeup is not possible or not preferable (e.g. the in-band wakeup may require the USB host controller to remain active, and hence consuming more system power during system sleep).
The oob gpio interrupt to be used for wakeup on the CPU side, is read from the device tree node, (using standard interrupt descriptors). A devcie tree binding document is also added for the driver. The compatible string is in compliance with Documentation/devicetree/bindings/usb/usb-device.txt
---
v4: Move the set_bit(BTUSB_OOB_WAKE_DISABLED,..) call to the beginning of
btusb_config_oob_wake() - caught by Brian.
v3: Add Brian's "Reviewed-by"
v2: * Use interrupt-names ("wakeup") instead of assuming first interrupt.
* Leave it on device tree to specify IRQ flags (level /edge triggered)
* Mark the device as non wakeable on exit.
Documentation/devicetree/bindings/net/btusb.txt | 40 ++++++++++++ drivers/bluetooth/btusb.c | 84 +++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/btusb.txt
Documentation/devicetree/bindings/net/btusb.txt new file +40 -0
@@ -0,0 +1,40 @@ +Generic Bluetooth controller over USB (btusb driver) +--------------------------------------------------- + +Required properties: + + - compatible : should comply with the format "usbVID,PID" specified in + Documentation/devicetree/bindings/usb/usb-device.txt + At the time of writing, the only OF supported devices + (more may be added later) are: + + "usb1286,204e" (Marvell 8997) + +Optional properties: + + - interrupt-parent: phandle of the parent interrupt controller + - interrupt-names: (see below) + - interrupts : The interrupt specified by the name "wakeup" is the interrupt + that shall be used for out-of-band wake-on-bt. Driver will + request this interrupt for wakeup. During system suspend, the + irq will be enabled so that the bluetooth chip can wakeup host + platform out of band. During system resume, the irq will be + disabled to make sure unnecessary interrupt is not received. + +Example: + +Following example uses irq pin number 3 of gpio0 for out of band wake-on-bt: + +&usb_host1_ehci { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + mvl_bt1: bt@1 { + compatible = "usb1286,204e"; + reg = <1>; + interrupt-parent = <&gpio0>; + interrupt-name = "wakeup"; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + }; +};
drivers/bluetooth/btusb.c +84 -0
132 lines not on this page · raw message
Signature · 1 line
2.8.0.rc3.226.g39d4020
Re: [PATCH v4 2/3] Bluetooth: btusb: Add out-of-band wakeup support
Quoted 23 lines · Rajat Jain
Some onboard BT chips (e.g. Marvell 8997) contain a wakeup pin that can be connected to a gpio on the CPU side, and can be used to wakeup the host out-of-band. This can be useful in situations where the in-band wakeup is not possible or not preferable (e.g. the in-band wakeup may require the USB host controller to remain active, and hence consuming more system power during system sleep).
The oob gpio interrupt to be used for wakeup on the CPU side, is read from the device tree node, (using standard interrupt descriptors). A devcie tree binding document is also added for the driver. The compatible string is in compliance with
Documentation/devicetree/bindings/usb/usb-device.txtSigned-off-by Rajat Jain <[email protected]>Reviewed-by Brian Norris <[email protected]>---
v4: Move theset_bit(BTUSB_OOB_WAKE_DISABLED,..)call to the beginning of
btusb_config_oob_wake()- caught by Brian.
v3: Add Brian's "Reviewed-by"
v2: * Use interrupt-names ("wakeup") instead of assuming first interrupt.
* Leave it on device tree to specify IRQ flags (level /edge triggered)
* Mark the device as non wakeable on exit.
Quoted 1 line
Documentation/devicetree/bindings/net/btusb.txt | 40 ++++++++++++
Quoted 3 lines
drivers/bluetooth/btusb.c | 84 +++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/btusb.txt
PATCH v4 3/3 Bluetooth: btusb: Configure Marvell to use one of the pins for oob wakeup
In reply to Rajat JainThe Marvell devices may have many gpio pins, and hence for wakeup on these out-of-band pins, the chip needs to be told which pin is to be used for wakeup, using an hci command.
Thus, we read the pin number etc from the device tree node and send a command to the chip.
---
v4: same as v3
v3: * remove the Marvell specific id table and check
* Add reference to marvell-bt-8xxx.txt in btusb.txt
* Add "Reviewed-by" and "Acked-by"
v2: Fix the binding document to specify to use "wakeup" interrupt-name
Documentation/devicetree/bindings/net/btusb.txt | 3 ++
.../{marvell-bt-sd8xxx.txt => marvell-bt-8xxx.txt} | 46 +++++++++++++++----
drivers/bluetooth/btusb.c | 51 ++++++++++++++++++++++
3 files changed, 92 insertions(+), 8 deletions(-)
rename Documentation/devicetree/bindings/net/{marvell-bt-sd8xxx.txt => marvell-bt-8xxx.txt} (50%)Documentation/devicetree/bindings/net/btusb.txt +3 -0
@@ -10,6 +10,9 @@ Required properties: "usb1286,204e" (Marvell 8997) +Also, vendors that use btusb may have device additional properties, e.g: +Documentation/devicetree/bindings/net/marvell-bt-8xxx.txt + Optional properties: - interrupt-parent: phandle of the parent interrupt controller
Documentation/devicetree/bindings/net/marvell-bt-8xxx.txt renamed from Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt +38 -8
74 lines not on this page · raw message
drivers/bluetooth/btusb.c +51 -0
63 lines not on this page · raw message
Signature · 1 line
2.8.0.rc3.226.g39d4020