From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Evan Green <evgreen@google.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Oliver Neukum <oneukum@suse.com>,
linux-usb@vger.kernel.org, "Srivastava,
Shobhit" <shobhit.srivastava@intel.com>
Subject: Re: [RFC PATCH 0/1] hibernate and roothub port power
Date: Tue, 14 Jun 2022 13:07:26 +0300 [thread overview]
Message-ID: <a5e9da68-fcf8-a89d-8e52-9798bc929170@linux.intel.com> (raw)
In-Reply-To: <CAE=gft6GEV58buVgErAD2O+SHJBbf+KubiBge_y4NXYaojnKAw@mail.gmail.com>
On 9.6.2022 18.08, Evan Green wrote:
> On Thu, Jun 9, 2022 at 12:58 AM Mathias Nyman
> <mathias.nyman@linux.intel.com> wrote:
>>
>> On 8.6.2022 16.43, Alan Stern wrote:
>>> On Wed, Jun 08, 2022 at 02:47:22PM +0300, Mathias Nyman wrote:
>>>> On 8.6.2022 11.19, Oliver Neukum wrote:
>>>>>
>>>>>
>>>>> On 07.06.22 15:58, Mathias Nyman wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>> In shutdown (S5), with xHCI as host, this can be solved fairly easily
>>>>>> by turning off roothub port power in the .shutdown path.
>>>>>
>>>>> That would suck for the people who charge their phone from their
>>>>> computer.
>>>>
>>>> Good point.
>>>> My guess is that xHC port power bits won't actually turn off VBus for those
>>>> Sleep-and-charge, or Always-on ports.
>>>> VBus is allowed to be on even if port is in power-off state, but usb link state
>>>> should be forced to ss.Disabled from other states, like U3.
>>>>
>>>> Need to try it out, it's possible this turns off VBus for some usb-A ports
>>>> on some older systems that earlier (accidentally?) supplied VBus on
>>>> "normal" ports after shutdown.
>>>
>>> How about turning off port power _only_ in the shutdown or unbind path,
>>> and setting the port link states to ss.Disabled in the poweroff or
>>> poweroff_noirq stage of hibernation (if wakeup is disabled)? Would that
>>> solve the problem of the firmware needing to time out on reboot?
>>>
>>
>> That would be optimal, but unfortunately xHCI doesn't support setting link
>> state directly to ss.Disabled. Only way is to clear port power (PP) bit.
>>
>> To avoid turning off VBus in hibernate we could limit port power bit clearing
>> to xHC hosts that don't have the Port Power Control (PPC) capability flag.
>>
>> We know these xHC hosts don't control power switches, and clearing PP won't turn
>> off VBus (xhci 5.4.8, PORTRSC)
>>
>> This could be a solution for some hosts, but probably not cover all.
>> Not sure if the hardware this was reported on has PPC flag set.
>
> It appears it does not, HCCPARAMS1 for both USB controllers seems to
> be 0x20007fc1 (missing bit 3). You can check my work in case I made an
> error here: https://pastebin.com/9raZc63N
> -Evan
Thanks, good to know.
So if disabling ports in hibernate doesn't work then we could turn off port power for
hosts with PPC==0. It should at least solve the issue for this particular system,
and not change current VBus policy in hibernate.
-Mathias
next prev parent reply other threads:[~2022-06-14 10:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 13:58 [RFC PATCH 0/1] hibernate and roothub port power Mathias Nyman
2022-06-07 13:58 ` [RFC PATCH 1/1] xhci: pci: power off roothub ports in hibernate poweroff_late stage Mathias Nyman
2022-06-08 8:19 ` [RFC PATCH 0/1] hibernate and roothub port power Oliver Neukum
2022-06-08 11:47 ` Mathias Nyman
2022-06-08 13:43 ` Alan Stern
2022-06-09 7:59 ` Mathias Nyman
2022-06-09 13:48 ` Alan Stern
2022-06-10 10:30 ` Mathias Nyman
2022-06-09 15:08 ` Evan Green
2022-06-14 10:07 ` Mathias Nyman [this message]
2022-07-20 21:53 ` Evan Green
2022-08-09 13:49 ` Mathias Nyman
2022-08-15 19:01 ` Evan Green
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=a5e9da68-fcf8-a89d-8e52-9798bc929170@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=evgreen@google.com \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=shobhit.srivastava@intel.com \
--cc=stern@rowland.harvard.edu \
/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).