[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201005191812.GB4135817@google.com>
Date: Mon, 5 Oct 2020 12:18:12 -0700
From: Matthias Kaehlcke <mka@...omium.org>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Rob Herring <robh@...nel.org>,
Doug Anderson <dianders@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Frank Rowand <frowand.list@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linux USB List <linux-usb@...r.kernel.org>,
Bastien Nocera <hadess@...ess.net>,
Stephen Boyd <swboyd@...omium.org>,
Ravi Chandra Sadineni <ravisadineni@...omium.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>, Peter Chen <peter.chen@....com>
Subject: Re: [PATCH v4 1/2] dt-bindings: usb: Add binding for discrete
onboard USB hubs
On Mon, Oct 05, 2020 at 12:15:27PM -0400, Alan Stern wrote:
> On Mon, Oct 05, 2020 at 09:06:55AM -0700, Matthias Kaehlcke wrote:
> > On Sat, Oct 03, 2020 at 08:41:42AM -0400, Alan Stern wrote:
> > > The decision to enable the power regulator at system startup would be
> > > kernel policy, not a part of the DT description. But there ought to be
> > > a standard way of recognizing which resource requirements of this sort
> > > should be handled at startup. Then there could be a special module (in
> > > the driver model core? -- that doesn't really seem appropriate) which
> > > would search through the whole DT database for resources of this kind
> > > and enable them.
> >
> > This might work for some cases that only have a single resource or multiple
> > resources but no timing/sequencing requirements. For the more complex cases
> > it would probably end up in something similar to the pwrseq series
> > (https://lore.kernel.org/patchwork/project/lkml/list/?series=314989&state=%2A&archive=both),
> > which was nack-ed by Rafael, Rob also expressed he didn't want to go
> > down that road.
> >
> > It seems to me that initialization of the resources needs to be done by
> > the/a driver for the device, which knows about the sequencing requirements.
> > Potentially this could be done in a pre-probe function that you brought up
> > earlier.
>
> One of the important points of my suggestion was that the resource init
> should be done _outside_ of the device's driver, precisely because the
> driver module might not even be loaded until the resources are set up
> and the device is discovered.
>
> The conclusion is that we need to have code that is aware of some
> detailed needs of a specific device but is not part of the device's
> driver. I'm not sure what the best way to implement this would be.
Wouldn't it be possible to load the module when the DT specifies that
the device exists? For USB the kernel would need the VID/PID to identify
the module, these could be extracted from the compatible string.
Having the initialization code outside of the driver could lead to code
duplication, since the driver might want to power the device down in
certain situations (e.g. system suspend).
Powered by blists - more mailing lists