From: Lukas Wunner <lukas@wunner.de>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Frederic Danis <frederic.danis.oss@gmail.com>,
Loic Poulain <loic.poulain@linaro.org>,
Max Shavrick <mxms@me.com>, Leif Liddy <leif.liddy@gmail.com>,
Daniel Roschka <danielroschka@phoenitydawn.de>,
Ronald Tschalaer <ronald@innovation.ch>,
"Peter Y. Chuang" <peteryuchuang@gmail.com>,
linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2 03/10] Bluetooth: hci_bcm: Enable runtime PM despite absence of IRQ
Date: Wed, 3 Jan 2018 00:36:48 +0100 [thread overview]
Message-ID: <20180102233648.GA15299@wunner.de> (raw)
In-Reply-To: <ffd03fb7-6caa-8128-03ba-fc4cb63328ea@redhat.com>
On Tue, Jan 02, 2018 at 08:17:24PM +0100, Hans de Goede wrote:
> On 02-01-18 20:08, Lukas Wunner wrote:
> > Currently runtime PM is only enabled if a valid host wake IRQ was found.
> >
> > However it is used in ways which seem unrelated to host wake:
> > E.g., runtime PM is used to force the Bluetooth device on for 5 sec
> > after a complete packet has been received.
> >
> > Afford this functionality to devices which lack an IRQ by moving the
> > code to enable runtime PM from bcm_request_irq() to bcm_setup().
>
> Hmm, this seems to not make much sense. If runtime_pm is not enabled
> (no host wake irq) then the device never runtime suspends, so there
> is no need to force the device on when we're sending / after a
> complete packet has been received.
>
> That you give "after a complete packet has been received" as condition
> example illustrates nicely why I believe this commit is a bad idea,
> if say a bluetooth keyboard wants to send a keypress HID report after
> the runtime pm timeout has elapsed, how are we going to receive that
> report since we're runtime suspended and there is no host wake irq
> to tell us to wakeup the UART and enable receiving on it again?
The host UART on MacBooks apparently never runtime suspends, so this
couldn't have been observed during testing:
They use either 8250_lpss.c (which has no runtime PM callbacks)
or 8250_dw.c (which disables the clock during runtime suspend,
but the MacBooks use a fixed rate clock which can't be disabled).
Moreover intel_lpss_suspend() excludes the UART from being put
into reset.
But the objection is valid so I withdraw this patch.
On MacBooks the host wake pin is ORed with the wake pin of the trackpad
and keyboard and goes into the SMC. I think it is only meant to be
used to wake the system from sleep and not to provide an interrupt
at runtime. In theory we could request the SMC's GPE but we couldn't
tell if the interrupt was sent by the trackpad/keyboard or by the
Bluetooth controller, or was caused by something else entirely.
So it's probably better not to use runtime PM at all. Let me rework
patch [10/10] and remove this hunk:
+ /* Macs wire the host wake pin to the System Management Controller,
+ * which handles wakeup independently of the operating system.
+ */
+ if (x86_apple_machine) {
+ err = 0;
+ goto unlock;
+ }
+
I notice that command 0xfc27 is used to write the sleep_params.
Does anyone know the command to read them so that we can check the
defaults Apple is using and find out if they can be optimized?
> I don't see how runtime pm can work without a host-wake IRQ,
> so IMHO this commit is wrong. Tip when testing this, make sure
> that you don't have the bluetooth config panel of e.g. gnome3
> open as that continuously scans for new devices, so runtime pm
> never kicks in. I've had a bad configured host IRQ pin on some
> ASUS laptops using serdev bcm bt and the only way a bt keyboard
> would work reliable was to keep the config panel open...
I don't have one of these MacBooks, I'm submitting patches on
behalf of others, but I'm told that having the gnome panel open
leads to choppy audio on these machines. Is that normal?
The Bluetooth controllers are fixed to a baudrate of 3 Mbit
on these machines.
Thanks,
Lukas
next prev parent reply other threads:[~2018-01-02 23:36 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-02 19:08 [PATCH v2 00/10] Bluetooth on 2015+ MacBook (Pro) Lukas Wunner
2018-01-02 19:08 ` [PATCH v2 03/10] Bluetooth: hci_bcm: Enable runtime PM despite absence of IRQ Lukas Wunner
2018-01-02 19:17 ` Hans de Goede
2018-01-02 23:36 ` Lukas Wunner [this message]
2018-01-03 8:07 ` Hans de Goede
2018-01-03 13:34 ` Lukas Wunner
2018-01-03 12:34 ` Marcel Holtmann
2018-01-03 13:22 ` Lukas Wunner
2018-01-03 13:29 ` Marcel Holtmann
2018-01-03 13:34 ` Lukas Wunner
2018-01-02 19:08 ` [PATCH v2 10/10] Bluetooth: hci_bcm: Support Apple GPIO handling Lukas Wunner
2018-01-03 12:55 ` Marcel Holtmann
2018-01-03 16:12 ` Andy Shevchenko
2018-01-02 19:08 ` [PATCH v2 08/10] Bluetooth: hci_bcm: Document struct bcm_device Lukas Wunner
2018-01-02 19:08 ` [PATCH v2 02/10] Bluetooth: hci_bcm: Mandate presence of shutdown and device wake GPIO Lukas Wunner
2018-01-03 12:55 ` Marcel Holtmann
2018-01-02 19:08 ` [PATCH v2 01/10] Bluetooth: Depend on rather than select GPIOLIB Lukas Wunner
2018-01-03 7:52 ` Linus Walleij
2018-01-05 18:27 ` Marcel Holtmann
2018-01-02 19:08 ` [PATCH v2 05/10] Bluetooth: hci_bcm: Add helper to toggle device wake GPIO Lukas Wunner
2018-01-03 13:06 ` Andy Shevchenko
2018-01-02 19:08 ` [PATCH v2 09/10] Bluetooth: hci_bcm: Handle errors properly Lukas Wunner
2018-01-03 16:08 ` Andy Shevchenko
2018-01-03 18:54 ` Lukas Wunner
2018-01-03 19:08 ` Andy Shevchenko
2018-01-02 19:08 ` [PATCH v2 04/10] Bluetooth: hci_bcm: Validate IRQ before using it Lukas Wunner
2018-01-02 19:08 ` [PATCH v2 07/10] Bluetooth: hci_bcm: Clean up unnecessary #ifdef Lukas Wunner
2018-01-02 19:08 ` [PATCH v2 06/10] Bluetooth: hci_bcm: Silence IRQ printk Lukas Wunner
2018-01-03 13:08 ` Andy Shevchenko
2018-01-03 13:56 ` Lukas Wunner
2018-01-03 16:05 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180102233648.GA15299@wunner.de \
--to=lukas@wunner.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=danielroschka@phoenitydawn.de \
--cc=frederic.danis.oss@gmail.com \
--cc=hdegoede@redhat.com \
--cc=johan.hedberg@gmail.com \
--cc=leif.liddy@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=marcel@holtmann.org \
--cc=mika.westerberg@linux.intel.com \
--cc=mxms@me.com \
--cc=peteryuchuang@gmail.com \
--cc=ronald@innovation.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).