Skip to content

Commit 5364a0b

Browse files
computersforpeaceholtmann
authored andcommitted
arm64: dts: rockchip: move QCA6174A wakeup pin into its USB node
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. Signed-off-by: Brian Norris <[email protected]> Reviewed-by: Matthias Kaehlcke <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 7d19261 commit 5364a0b

File tree

3 files changed

+42
-30
lines changed

3 files changed

+42
-30
lines changed

arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,19 @@
200200
pinctrl-0 = <&bl_en>;
201201
pwm-delay-us = <10000>;
202202
};
203+
204+
gpio_keys: gpio-keys {
205+
compatible = "gpio-keys";
206+
pinctrl-names = "default";
207+
pinctrl-0 = <&bt_host_wake_l>;
208+
209+
wake_on_bt: wake-on-bt {
210+
label = "Wake-on-Bluetooth";
211+
gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
212+
linux,code = <KEY_WAKEUP>;
213+
wakeup-source;
214+
};
215+
};
203216
};
204217

205218
&ppvar_bigcpu {

arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,21 @@
175175
pinctrl-0 = <&dmic_en>;
176176
wakeup-delay-ms = <250>;
177177
};
178+
179+
gpio_keys: gpio-keys {
180+
compatible = "gpio-keys";
181+
pinctrl-names = "default";
182+
pinctrl-0 = <&pen_eject_odl>;
183+
184+
pen-insert {
185+
label = "Pen Insert";
186+
/* Insert = low, eject = high */
187+
gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
188+
linux,code = <SW_PEN_INSERTED>;
189+
linux,input-type = <EV_SW>;
190+
wakeup-source;
191+
};
192+
};
178193
};
179194

180195
/* pp900_s0 aliases */
@@ -328,20 +343,6 @@ camera: &i2c7 {
328343
<400000000>;
329344
};
330345

331-
&gpio_keys {
332-
pinctrl-names = "default";
333-
pinctrl-0 = <&bt_host_wake_l>, <&pen_eject_odl>;
334-
335-
pen-insert {
336-
label = "Pen Insert";
337-
/* Insert = low, eject = high */
338-
gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
339-
linux,code = <SW_PEN_INSERTED>;
340-
linux,input-type = <EV_SW>;
341-
wakeup-source;
342-
};
343-
};
344-
345346
&i2c_tunnel {
346347
google,remote-bus = <0>;
347348
};
@@ -437,8 +438,19 @@ camera: &i2c7 {
437438
status = "okay";
438439
};
439440

440-
&wake_on_bt {
441-
gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
441+
&usb_host0_ohci {
442+
#address-cells = <1>;
443+
#size-cells = <0>;
444+
445+
qca_bt: bluetooth@1 {
446+
compatible = "usbcf3,e300", "usb4ca,301a";
447+
reg = <1>;
448+
pinctrl-names = "default";
449+
pinctrl-0 = <&bt_host_wake_l>;
450+
interrupt-parent = <&gpio1>;
451+
interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
452+
interrupt-names = "wakeup";
453+
};
442454
};
443455

444456
/* PINCTRL OVERRIDES */
@@ -455,7 +467,7 @@ camera: &i2c7 {
455467
};
456468

457469
&bt_host_wake_l {
458-
rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_up>;
470+
rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_none>;
459471
};
460472

461473
&ec_ap_int_l {

arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -269,19 +269,6 @@
269269
#clock-cells = <0>;
270270
};
271271

272-
gpio_keys: gpio-keys {
273-
compatible = "gpio-keys";
274-
pinctrl-names = "default";
275-
pinctrl-0 = <&bt_host_wake_l>;
276-
277-
wake_on_bt: wake-on-bt {
278-
label = "Wake-on-Bluetooth";
279-
gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
280-
linux,code = <KEY_WAKEUP>;
281-
wakeup-source;
282-
};
283-
};
284-
285272
max98357a: max98357a {
286273
compatible = "maxim,max98357a";
287274
pinctrl-names = "default";

0 commit comments

Comments
 (0)