linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btusb: request wake pin with NOAUTOEN
@ 2019-02-22  0:30 Brian Norris
  2019-02-22 18:35 ` Matthias Kaehlcke
  2019-03-26 18:48 ` Brian Norris
  0 siblings, 2 replies; 4+ messages in thread
From: Brian Norris @ 2019-02-22  0:30 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg
  Cc: linux-bluetooth, linux-kernel, Matthias Kaehlcke, Rajat Jain,
	Heiko Stuebner, Brian Norris

Badly-designed systems might have (for example) active-high wake pins
that default to high (e.g., because of external pull ups) until they
have an active firmware which starts driving it low. This can cause an
interrupt storm in the time between request_irq() and disable_irq().

We don't support shared interrupts here, so let's just pre-configure the
interrupt to avoid auto-enabling it.

Fixes: fd913ef7ce61 ("Bluetooth: btusb: Add out-of-band wakeup support")
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 drivers/bluetooth/btusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 4761499db9ee..470ee68555d9 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2885,6 +2885,7 @@ static int btusb_config_oob_wake(struct hci_dev *hdev)
 		return 0;
 	}
 
+	irq_set_status_flags(irq, IRQ_NOAUTOEN);
 	ret = devm_request_irq(&hdev->dev, irq, btusb_oob_wake_handler,
 			       0, "OOB Wake-on-BT", data);
 	if (ret) {
@@ -2899,7 +2900,6 @@ static int btusb_config_oob_wake(struct hci_dev *hdev)
 	}
 
 	data->oob_wake_irq = irq;
-	disable_irq(irq);
 	bt_dev_info(hdev, "OOB Wake-on-BT configured at IRQ %u", irq);
 	return 0;
 }
-- 
2.21.0.rc0.258.g878e2cd30e-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: btusb: request wake pin with NOAUTOEN
  2019-02-22  0:30 [PATCH] Bluetooth: btusb: request wake pin with NOAUTOEN Brian Norris
@ 2019-02-22 18:35 ` Matthias Kaehlcke
  2019-03-26 18:48 ` Brian Norris
  1 sibling, 0 replies; 4+ messages in thread
From: Matthias Kaehlcke @ 2019-02-22 18:35 UTC (permalink / raw)
  To: Brian Norris
  Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth, linux-kernel,
	Rajat Jain, Heiko Stuebner

On Thu, Feb 21, 2019 at 04:30:51PM -0800, Brian Norris wrote:
> Badly-designed systems might have (for example) active-high wake pins
> that default to high (e.g., because of external pull ups) until they
> have an active firmware which starts driving it low. This can cause an
> interrupt storm in the time between request_irq() and disable_irq().
> 
> We don't support shared interrupts here, so let's just pre-configure the
> interrupt to avoid auto-enabling it.
> 
> Fixes: fd913ef7ce61 ("Bluetooth: btusb: Add out-of-band wakeup support")
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
>  drivers/bluetooth/btusb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 4761499db9ee..470ee68555d9 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -2885,6 +2885,7 @@ static int btusb_config_oob_wake(struct hci_dev *hdev)
>  		return 0;
>  	}
>  
> +	irq_set_status_flags(irq, IRQ_NOAUTOEN);
>  	ret = devm_request_irq(&hdev->dev, irq, btusb_oob_wake_handler,
>  			       0, "OOB Wake-on-BT", data);
>  	if (ret) {
> @@ -2899,7 +2900,6 @@ static int btusb_config_oob_wake(struct hci_dev *hdev)
>  	}
>  
>  	data->oob_wake_irq = irq;
> -	disable_irq(irq);
>  	bt_dev_info(hdev, "OOB Wake-on-BT configured at IRQ %u", irq);
>  	return 0;
>  }

Reviewed-by: Matthias Kaehlcke <mka@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: btusb: request wake pin with NOAUTOEN
  2019-02-22  0:30 [PATCH] Bluetooth: btusb: request wake pin with NOAUTOEN Brian Norris
  2019-02-22 18:35 ` Matthias Kaehlcke
@ 2019-03-26 18:48 ` Brian Norris
  2019-04-01 18:07   ` Brian Norris
  1 sibling, 1 reply; 4+ messages in thread
From: Brian Norris @ 2019-03-26 18:48 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg
  Cc: Linux Bluetooth mailing list, Linux Kernel, Matthias Kaehlcke,
	Rajat Jain, Heiko Stuebner

On Thu, Feb 21, 2019 at 4:30 PM Brian Norris <briannorris@chromium.org> wrote:
>
> Badly-designed systems might have (for example) active-high wake pins
> that default to high (e.g., because of external pull ups) until they
> have an active firmware which starts driving it low. This can cause an
> interrupt storm in the time between request_irq() and disable_irq().
>
> We don't support shared interrupts here, so let's just pre-configure the
> interrupt to avoid auto-enabling it.
>
> Fixes: fd913ef7ce61 ("Bluetooth: btusb: Add out-of-band wakeup support")
> Signed-off-by: Brian Norris <briannorris@chromium.org>

Ping! v5.1 is enabling wake support on Scarlet, and without this
patch, that causes interrupt storms at boot. Please apply this patch
for v5.1-rc!

See also:
https://lkml.kernel.org/lkml/CA+ASDXMePkQDRfaSwNGnRYyGdsuvfUCXBtDK79o2mP=1hdNQUA@mail.gmail.com

Brian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: btusb: request wake pin with NOAUTOEN
  2019-03-26 18:48 ` Brian Norris
@ 2019-04-01 18:07   ` Brian Norris
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2019-04-01 18:07 UTC (permalink / raw)
  To: Andrew Morton, Marcel Holtmann
  Cc: Linux Bluetooth mailing list, Linux Kernel, Matthias Kaehlcke,
	Rajat Jain, Heiko Stuebner, Johan Hedberg

+ akpm, in case he can help out

Another week, another buggy 5.1 RC.

On Tue, Mar 26, 2019 at 11:48 AM Brian Norris <briannorris@chromium.org> wrote:
>
> On Thu, Feb 21, 2019 at 4:30 PM Brian Norris <briannorris@chromium.org> wrote:
> >
> > Badly-designed systems might have (for example) active-high wake pins
> > that default to high (e.g., because of external pull ups) until they
> > have an active firmware which starts driving it low. This can cause an
> > interrupt storm in the time between request_irq() and disable_irq().
> >
> > We don't support shared interrupts here, so let's just pre-configure the
> > interrupt to avoid auto-enabling it.
> >
> > Fixes: fd913ef7ce61 ("Bluetooth: btusb: Add out-of-band wakeup support")
> > Signed-off-by: Brian Norris <briannorris@chromium.org>
>
> Ping! v5.1 is enabling wake support on Scarlet, and without this
> patch, that causes interrupt storms at boot. Please apply this patch
> for v5.1-rc!
>
> See also:
> https://lkml.kernel.org/lkml/CA+ASDXMePkQDRfaSwNGnRYyGdsuvfUCXBtDK79o2mP=1hdNQUA@mail.gmail.com

Ping x 2!

Marcel merged my other series first, which enabled this feature,
without applying the bugfix (which was sent first). So right now, my
RK3399/Scarlet board is in very bad shape. Can somebody please merge
this bugfix for 5.1? If not, I'll probably just send Linus a pull
request myself.

Original patch link, in case this helps someone:

http://lkml.kernel.org/lkml/20190222003051.127006-1-briannorris@chromium.org
https://lore.kernel.org/patchwork/patch/1044896/

Thanks,
Brian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-01 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22  0:30 [PATCH] Bluetooth: btusb: request wake pin with NOAUTOEN Brian Norris
2019-02-22 18:35 ` Matthias Kaehlcke
2019-03-26 18:48 ` Brian Norris
2019-04-01 18:07   ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).