Re: [PATCH v4 1/2] dt-bindings: usb: Add binding for discrete onboard USB hubs
From: Matthias Kaehlcke
Date: Wed Oct 07 2020 - 12:03:42 EST
On Tue, Oct 06, 2020 at 09:00:23PM -0400, Alan Stern wrote:
> On Tue, Oct 06, 2020 at 12:25:36PM -0700, Matthias Kaehlcke wrote:
> > On Tue, Oct 06, 2020 at 01:15:24PM -0400, Alan Stern wrote:
> > > You don't need a platform device or a new driver to do this. The code
> > > can go in the existing hub driver.
> >
> > Maybe. IIUC currently USB drivers don't support/use suspend_late. Could that
> > be added? It would simplify matters, otherwise all hubs need to know their
> > peers and check in suspend if they are the last hub standing, only then the
> > power can be switched off. It would be simpler if a single instance (e.g. the
> > hub with the DT entries) is in control.
>
> Adding suspend_late would be a little painful. But you don't really
> need it; you just need to make the "master" hub wait for its peer to
> suspend, which is easy to do.
Ok, I wasn't sure if the hubs suspend asynchronously from each other. If they
do it should indeed not be a problem to have the "master" wait for its peers.
> And hubs would need to know their peers in any case, because you have to
> check if any devices attached to the peer have wakeup enabled.
My concern was about all hubs (including 'secondaries') having to know their
peers and check on each other, in the scenario we are now talking about only
the "master" hub needs to know and check on its peers, which is fine.
> > > Incidentally, the peering information is already present in sysfs,
> > > although it is associated with a device's port on its upstream hub
> > > rather than with the device itself.
> >
> > That might also help the hub driver to determine its peers without needing the
> > 'companion-hubs' property.
>
> It wouldn't hurt to have that property anyway. The determination of
> peer ports doesn't always work right, because it depends on information
> provided by the firmware and that information isn't always correct.
Good to know, then we should certainly have it.