Re: [RFC PATCH 0/1] hibernate and roothub port power

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 9, 2022 at 6:47 AM Mathias Nyman
<mathias.nyman@xxxxxxxxxxxxxxx> wrote:
>
> On 21.7.2022 0.53, Evan Green wrote:
> > On Tue, Jun 14, 2022 at 3:06 AM Mathias Nyman
> > <mathias.nyman@xxxxxxxxxxxxxxx> wrote:
> >>
> >> On 9.6.2022 18.08, Evan Green wrote:
> >>> On Thu, Jun 9, 2022 at 12:58 AM Mathias Nyman
> >>> <mathias.nyman@xxxxxxxxxxxxxxx> 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.
> >
> > Did a new version of this ever make it out?
> > -Evan
>
> started writing a patch before vacation that sets port link to ss.Disabled instead of
> turning off power power.
>
> Still has some FIXME lines and extra prints, but should be testable.
> pushed to a fix_port_disable_s4 topic branch on top of 5.19:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git fix_port_disable_s4
> https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/?h=fix_port_disable_s4

Thanks! I was OOO last week, but I'm back and should be able to give
it a try shortly.

>
> There was also one reported regression with powering off ports in shutdown S5, probably need
> to sort that out before pushing this.

Uh oh, I was just made aware of a regression as well on 4.19 that got
narrowed down to that. I'm trying to learn more now.

>
> Thanks
> -Mathias



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux