linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Felipe Balbi <balbi@ti.com>,
	Grant Likely <grant.likely@linaro.org>,
	<devicetree@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: Non-enumerable devices on USB and other enumerable buses
Date: Wed, 14 Aug 2013 15:39:20 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1308141514440.1701-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20130814184643.GL2401@sirena.org.uk>

On Wed, 14 Aug 2013, Mark Brown wrote:

> On Wed, Aug 14, 2013 at 02:35:07PM -0400, Alan Stern wrote:
> > On Wed, 14 Aug 2013, Mark Brown wrote:
> 
> > > What I'm proposing is that we have a way of telling buses that devices
> > > exist via a mechanism other than their actually being visible on the bus
> > > at the current time.  If you're doing that the driver can be running
> > > prior to the hardware being there, just like it does with all the
> > > non-enumerable buses.
> 
> > This may work for other buses, but it isn't feasible for USB.  Not only
> > do many of the drivers need to communicate with their device during
> > their probe routine, the subsystem itself needs to communicate with the
> > device before many of the important data structures can be constructed.  
> > Without these structures, the device can't be bound to a driver.  We 
> > wouldn't even know which driver to bind it to!
> 
> The identification information for the device would of course have to be
> provided as part of registering that the device was going to appear -
> I'd expect to provide the same information that's read out of the
> hardware during enumeration, with enumeration checking to see if it
> knows about the device already.

I don't see the point of all this.  Obviously the device can't be used
until it physically appears on the bus.  What benefit do you get from
registering it and making it available to userspace before that?

> > My impression is that much of what you want could be handled by a
> > platform callback invoked when a particular bus -- i.e., one whose
> > upstream controller is a particular platform device -- is registered.  
> > Is that correct?  For example, in the USB case, the on-board hub's
> > GPIOs could be set when the USB bus is registered (or perhaps when the
> > bus's root hub is registered).
> 
> That sort of bodge is probably adequate for basic "power this on" stuff
> but it's not going to scale to a general solution, especially where the
> driver wants to use some of the information at runtime.  Currently
> systems are doing things like bodging callbacks into controller drivers
> which is basically what you're talking about here.

Well, basic "power this on" stuff is pretty much all we have discussed 
in this thread so far.  What other sorts of things are going to be 
needed for a general solution?

> > > It means that there are situations where a driver wants to take the
> > > hardware offline but still offer services to userspace which will
> > > require the hardware to be brought on line again.  The fact that this is
> > > a very generic thing is exactly why I'm raising this as a generic issue.
> 
> > This is a separate issue, more or less independent of whether the
> > platform needs to carry out special actions for the device in question.  
> > If you're suggesting these off-line/on-line transitions are appropriate
> > places for a platform hook, then yes, that makes sense.
> 
> I think in the general case it's the same issue - grab all the resources
> and enable them at probe time is the simplest implementation but it's
> not the only one by a long stretch.

Now I'm getting confused.  It seems we're talking about at least three
very different things here:

     A: Devising a mechanism for platform code to do things involving
	devices that are dynamically registered on discoverable buses.

     B: Telling the subsystem and driver code for a discoverable bus
	that a particular device is present before it has been 
	detected.

     C: Implementing a mechanism whereby drivers can take a device
	off-line while still pretending to userspace that the device
	is still present, by bringing it back on-line as needed.

I don't see much connection between these things.  Perhaps you can
explain in more detail.

(BTW, it's worth mentioning that C has already been done, in the form
of runtime PM.  The difference may be that you propose to take the
device so far off-line that it disappears from the bus.  AFAICS, this
would be purely a private matter to be arranged between the subsystem
and the driver; it does not need to be handled at the level of the
device-model or PM core.)

Alan Stern


  reply	other threads:[~2013-08-14 19:39 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-11 19:08 Non-enumerable devices on USB and other enumerable buses Mark Brown
2013-08-11 22:08 ` Grant Likely
2013-08-12 14:41   ` Mark Brown
2013-08-12  1:53 ` Alan Stern
2013-08-12  9:51   ` Mark Brown
2013-08-12 11:07     ` Mark Rutland
2013-08-12 11:32       ` Mark Brown
2013-08-12 18:08       ` Stephen Warren
2013-08-12 20:38         ` Mark Brown
2013-08-12  2:02 ` Greg Kroah-Hartman
2013-08-12 11:23   ` Mark Brown
2013-08-12 20:50     ` Greg Kroah-Hartman
2013-08-12 21:40       ` Mark Brown
2013-08-13  1:04         ` Alan Stern
2013-08-14 11:38           ` Mark Brown
2013-08-14 14:27             ` Alan Stern
2013-08-14 15:39               ` Mark Brown
2013-08-14 16:14                 ` Alan Stern
2013-08-14 16:30                   ` Stephen Warren
2013-08-14 18:49                     ` Mark Brown
2013-08-14 17:30                   ` Mark Brown
2013-08-14 18:35                     ` Alan Stern
2013-08-14 18:46                       ` Mark Brown
2013-08-14 19:39                         ` Alan Stern [this message]
2013-08-14 20:16                           ` Paul Zimmerman
2013-08-14 23:59                             ` Mark Brown
2013-08-14 23:55                           ` Mark Brown
2013-08-15 14:42                             ` Alan Stern
2013-08-15 17:10                               ` Mark Brown
2013-08-15 17:55                                 ` Alan Stern
2013-08-15 19:32                                   ` Mark Brown
2013-08-15 20:42                                     ` Alan Stern
2013-08-15 22:54                                       ` Mark Brown
2013-08-16 14:42                                         ` Alan Stern
2013-08-16 18:39                                           ` Mark Brown
2013-08-16 19:27                                             ` Alan Stern
2013-08-16 20:00                                               ` Mark Brown
2013-08-16 20:39                                                 ` Alan Stern
2013-08-16 22:46                                                   ` Mark Brown
2013-08-17  1:29                                                     ` Alan Stern
2013-08-19 12:17                                                       ` Ming Lei
2013-08-19 16:01                                                         ` Mark Brown
2013-08-20 13:19                                                           ` Ming Lei
2013-08-20 15:02                                                             ` Mark Brown

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=Pine.LNX.4.44L0.1308141514440.1701-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=balbi@ti.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ian.campbell@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=swarren@wwwdotorg.org \
    /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).