Skip to contentSkip to conversation

Bluetooth: btusb: add QCA6174A compatible properties

PATCH In review Brian Norris 4 participants 9 messages Feb 22, 2019 – Mar 26, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 Bluetooth: btusb: add QCA6174A compatible properties

We may need to specify a GPIO wake pin for this device, so add a compatible property for it.

There are at least to USB PID/VID variations of this chip: one with a Lite-On ID and one with an Atheros ID.

---
v2:
* drop leading zeroes from VID, per documented binding

---
 drivers/bluetooth/btusb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
index 470ee68555d9..54cb5f583b1d 100644
@@ -2862,6 +2862,8 @@ static irqreturn_t btusb_oob_wake_handler(int irq, void *priv)
 
 static const struct of_device_id btusb_match_table[] = {
 	{ .compatible = "usb1286,204e" },
+	{ .compatible = "usbcf3,e300" }, /* QCA6174A */
+	{ .compatible = "usb4ca,301a" }, /* QCA6174A (Lite-On) */
 	{ }
 };
 MODULE_DEVICE_TABLE(of, btusb_match_table);
Signature · 1 line
2.21.0.rc0.258.g878e2cd30e-goog
#1 lore raw

PATCH v2 2/3 dt-bindings: net: btusb: add QCA6174A IDs

There are two USB PID/VID variations I've seen for this chip, and I want to utilize the 'interrupts' property defined here already.

---
v2:
* drop leading zeroes from VID

---
 Documentation/devicetree/bindings/net/btusb.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/btusb.txt +3 -0
index 37d67926dd6d..b1ad6ee68e90 100644
@@ -9,6 +9,9 @@ Required properties:
 		 (more may be added later) are:
 
 		  "usb1286,204e" (Marvell 8997)
+		  "usbcf3,e300" (Qualcomm QCA6174A)
+		  "usb4ca,301a" (Qualcomm QCA6174A (Lite-On))
+
 
 Also, vendors that use btusb may have device additional properties, e.g:
 Documentation/devicetree/bindings/net/marvell-bt-8xxx.txt
Signature · 1 line
2.21.0.rc0.258.g878e2cd30e-goog
maintainer Reviewed-by on v2 2/3
#2 lore raw

Re: [PATCH v2 2/3] dt-bindings: net: btusb: add QCA6174A IDs

Quoted 12 lines · Brian Norris

There are two USB PID/VID variations I've seen for this chip, and I want to utilize the 'interrupts' property defined here already.

---
v2:
* drop leading zeroes from VID

---
 Documentation/devicetree/bindings/net/btusb.txt | 3 +++
 1 file changed, 3 insertions(+)
#3 lore raw

PATCH v2 3/3 arm64: dts: rockchip: move QCA6174A wakeup pin into its USB node

In reply to Brian Norris

Currently, we don't coordinate BT USB activity with our handling of the BT out-of-band wake pin, and instead just use gpio-keys. That causes problems because we have no way of distinguishing wake activity due to a BT device (e.g., mouse) vs. the BT controller (e.g., re-configuring wake mask before suspend). This can cause spurious wake events just because we, for instance, try to reconfigure the host controller's event mask before suspending.

We can avoid these synchronization problems by handling the BT wake pin directly in the btusb driver -- for all activity up until BT controller suspend(), we simply listen to normal USB activity (e.g., to know the difference between device and host activity); once we're really ready to suspend the host controller, there should be no more host activity, and only *then* do we unmask the GPIO interrupt.

This is already supported by btusb; we just need to describe the wake pin in the right node.

We list 2 compatible properties, since both PID/VID pairs show up on Scarlet devices, and they're both essentially identical QCA6174A-based modules.

Also note that the polarity was wrong before: Qualcomm implemented WAKE as active high, not active low. We only got away with this because gpio-keys always reconfigured us as bi-directional edge-triggered.

Finally, we have an external pull-up and a level-shifter on this line (we didn't notice Qualcomm's polarity in the initial design), so we can't do pull-down. Switch to pull-none.

---
v2:
* drop leading zeroes from VID
* rename 'bt' node to 'bluetooth'

---
 .../dts/rockchip/rk3399-gru-chromebook.dtsi   | 13 ++++++
 .../boot/dts/rockchip/rk3399-gru-scarlet.dtsi | 46 ++++++++++++-------
 arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi  | 13 ------
 3 files changed, 42 insertions(+), 30 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi +13 -0
index c400be64170e..931640e9aed4 100644
@@ -200,6 +200,19 @@
 		pinctrl-0 = <&bl_en>;
 		pwm-delay-us = <10000>;
 	};
+
+	gpio_keys: gpio-keys {
+		compatible = "gpio-keys";
+		pinctrl-names = "default";
+		pinctrl-0 = <&bt_host_wake_l>;
+
+		wake_on_bt: wake-on-bt {
+			label = "Wake-on-Bluetooth";
+			gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WAKEUP>;
+			wakeup-source;
+		};
+	};
 };
 
 &ppvar_bigcpu {
arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi +29 -17

70 lines not on this page · raw message

arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +0 -13
index ea607a601a86..da03fa9c5662 100644
@@ -269,19 +269,6 @@
 		#clock-cells = <0>;
 	};
 
-	gpio_keys: gpio-keys {
-		compatible = "gpio-keys";
-		pinctrl-names = "default";
-		pinctrl-0 = <&bt_host_wake_l>;
-
-		wake_on_bt: wake-on-bt {
-			label = "Wake-on-Bluetooth";
-			gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_WAKEUP>;
-			wakeup-source;
-		};
-	};
-
 	max98357a: max98357a {
 		compatible = "maxim,max98357a";
 		pinctrl-names = "default";
Signature · 1 line
2.21.0.rc0.258.g878e2cd30e-goog
maintainer
#4 lore raw
In reply to Brian Norris

Hi Brian,

Quoted 20 lines

We may need to specify a GPIO wake pin for this device, so add a compatible property for it.

There are at least to USB PID/VID variations of this chip: one with a Lite-On ID and one with an Atheros ID.

---
v2:
* drop leading zeroes from VID, per documented binding
---
drivers/bluetooth/btusb.c | 2 ++

1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +0 -0
index 470ee68555d9..54cb5f583b1d 100644

drivers/bluetooth/btusb.c static irqreturn_t btusb_oob_wake_handler(int irq, void *priv) · line 2866

Quoted 5 lines
drivers/bluetooth/btusb.c +2 -0
@@ -2862,6 +2862,8 @@ static irqreturn_t btusb_oob_wake_handler(int irq, void *priv)
 
 static const struct of_device_id btusb_match_table[] = {
 	{ .compatible = "usb1286,204e" },
+	{ .compatible = "usbcf3,e300" }, /* QCA6174A */
+	{ .compatible = "usb4ca,301a" }, /* QCA6174A (Lite-On) */

are these really proper .compatible USB VID?PID strings. I think they are one letter short.

Regards

Marcel

#5 lore raw
Quoted 23 lines · Marcel Holtmann

Hi Brian,

Quoted 21 lines

We may need to specify a GPIO wake pin for this device, so add a compatible property for it.

There are at least to USB PID/VID variations of this chip: one with a Lite-On ID and one with an Atheros ID.

---
v2:
* drop leading zeroes from VID, per documented binding
---
drivers/bluetooth/btusb.c | 2 ++

1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +0 -0
index 470ee68555d9..54cb5f583b1d 100644
@@ -2862,6 +2862,8 @@ static irqreturn_t btusb_oob_wake_handler(int irq, void *priv)
 
Quoted 6 lines

drivers/bluetooth/btusb.c static irqreturn_t btusb_oob_wake_handler(int irq, void *priv) · line 2866

Quoted 4 lines
drivers/bluetooth/btusb.c +2 -0
 static const struct of_device_id btusb_match_table[] = {
 	{ .compatible = "usb1286,204e" },
+	{ .compatible = "usbcf3,e300" }, /* QCA6174A */
+	{ .compatible = "usb4ca,301a" }, /* QCA6174A (Lite-On) */

are these really proper .compatible USB VID?PID strings. I think they are one letter short.

Yup - however weird it may end up looking, the usb-device binding says "...with leading zeros suppressed". Blame Open Firmware, I guess ;)

Robin.

maintainer
#6 lore raw
In reply to Brian Norris

Hi Brian,

Quoted 6 lines

We may need to specify a GPIO wake pin for this device, so add a compatible property for it.

There are at least to USB PID/VID variations of this chip: one with a Lite-On ID and one with an Atheros ID.

Quoted 8 lines

---
v2:
* drop leading zeroes from VID, per documented binding
---
drivers/bluetooth/btusb.c | 2 ++

1 file changed, 2 insertions(+)

all 3 patches have been applied to bluetooth-next tree.

Regards

Marcel

#7 lore raw

Hi Marcel,

Quoted 15 lines · Marcel Holtmann
Quoted 6 lines

We may need to specify a GPIO wake pin for this device, so add a compatible property for it.

There are at least to USB PID/VID variations of this chip: one with a Lite-On ID and one with an Atheros ID.

Quoted 8 lines

---
v2:
* drop leading zeroes from VID, per documented binding
---
drivers/bluetooth/btusb.c | 2 ++

1 file changed, 2 insertions(+)
Quoted 1 line

all 3 patches have been applied to bluetooth-next tree.

Thanks! I failed to repeat my comment from v1:

"""
This patch is also required to make this stable, but since it's not really tied to the device tree, and it's an existing bug, I sent it separately:

https://lore.kernel.org/patchwork/patch/1044896/
Subject: Bluetooth: btusb: request wake pin with NOAUTOEN
"""

Can you take this one too? Otherwise Scarlet will be less stable (possible interrupt storm at boot).

Regards,
Brian

#8 lore raw
Quoted 10 lines · Brian Norris
Quoted 1 line · Marcel Holtmann

all 3 patches have been applied to bluetooth-next tree.

Thanks! I failed to repeat my comment from v1:

"""
This patch is also required to make this stable, but since it's not really tied to the device tree, and it's an existing bug, I sent it separately:

Quoted 6 lines

https://lore.kernel.org/patchwork/patch/1044896/
Subject: Bluetooth: btusb: request wake pin with NOAUTOEN
"""

Can you take this one too? Otherwise Scarlet will be less stable (possible interrupt storm at boot).

Ping? RK3399/Scarlet is currently in bad shape on v5.1-rc2, since it doesn't have the interrupt storm fix.

I'll ping on that patch directly too.

Brian