mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"MyungJoo Ham" <myungjoo.ham@gmail.com>,
	linux-kernel@vger.kernel.org,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Mike Lockwood" <lockwood@android.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Kyungmin Park" <kyungmin.park@samsung.com>,
	"Donggeun Kim" <dg77.kim@samsung.com>, "Greg KH" <gregkh@suse.de>,
	"Grant Likely" <grant.likely@secretlab.ca>,
	"Kalle Komierowski" <karl.komierowski@stericsson.com>,
	"Johan PALSSON" <johan.palsson@stericsson.com>,
	"Daniel WILLERUD" <daniel.willerud@stericsson.com>
Subject: Re: [RFC PATCH 0/3] introduce: Multistate Switch Class
Date: Tue, 6 Dec 2011 06:38:34 +1100	[thread overview]
Message-ID: <20111206063834.3f66b3e0@notabene.brown> (raw)
In-Reply-To: <20111205120608.GI11150@opensource.wolfsonmicro.com>

[-- Attachment #1: Type: text/plain, Size: 5244 bytes --]

On Mon, 5 Dec 2011 12:06:08 +0000 Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:

> On Mon, Dec 05, 2011 at 02:04:13PM +1100, NeilBrown wrote:
> > On Thu, 1 Dec 2011 11:34:50 +0000 Mark Brown
> 
> > > We really want something a bit more involved in the USB frameworks for
> > > the specific example of USB stuff (which is being worked on) - ideally
> > > we should be communicating information about how much current the host
> > > allows to be drawn throughout the system.
> 
> > Sounds like a job for the 'regulator' framework - but that is a guess based
> > on not looking very deeply, so I'm probably wrong :-)
> 
> The regulator framework might be used to implement the current limits
> but it understands nothing about the sematics of what it's doing, it
> just understands things at the level of setting values.  Something would
> need to sit above it to plug into USB.
> 
> > > I think we do want something which lets us say "this is a cable of
> > > type X" so that we can report the difference between otherwise identical
> > > cables as in the car/desktop dock example I mentioned above.
> 
> > I think you are saying that you might have two "cables" which connect up the
> > same sets of signals but are "different" somehow.  One connects to a car,
> > the other to a desk-top dock.
> > How is that difference detected by the hardware?  Presumably some switch?
> > So this is just one more binary switch to export to who-ever needs to know
> > (presumably user-space) ???
> 
> Implementations vary - it may involve something like reading an ID chip
> over some bus, for example.  It's definitely not a binary switch, it
> needs to have more values than that.

Ahh..
So to try to restate the requirements:

 A "cable-port" can detect when a "cable" in inserted (or removed) and can
 determine the "cable-type" which comprises:
   - a "cable-name" which is an arbitrary label interpreted in the context of
     the particular port
   - 1 or more "cable-function" flags which indicate what functions the 
     cable support.  A given port has a fixed set of "cable-functions" and 
     for any given cable it will report true/false (present/absent, on/off)
     for each cable-function.

 This full "cable-type" needs to be presented to user-space, and individual
 cable-functions may need to be communicated to specific drivers to trigger a
 'probe' function.

Questions:
  1/ Do we need to communicate anything to drivers apart from "cable-detect"?
     i.e. are they quite cable of probing and identifying, or do they need to
     be told what to look for?
  2/ Does it hurt to simply wake up all drivers that might be listening on
     the cable or do we need individual wake-ups (notifiers) for each
     cable-function?
  3/ Does anything in the kernel care about the cable-name, or is that only
     interesting to user-space?

I think that the "cable-functions" might still be best represented by virtual
GPIOs, but the cable-name is certainly more than that.

To me this does sound like it might want a 'cable-port' device and it should
generate 'change' uevents when a new cable appears.  The change from no-cable
to cable-X does seem quite a significant change affecting possible multiple
subsystems so a uevent seems to me to be justified.


> 
> > My GTA04 has a wifi chip connected to an mmc port.  The wifi chip has a
> > separate regulator that can be powered up/down independently of everything
> > else.
> > So when I apply power I need a way to tell the mmc driver to scan the bus.
> > It expects this information to come via a GPIO which has an associated IRQ.
> > But I don't have a physical gpio to give it.
> 
> > So this is a case where one driver (the rfkill driver) needs to signal
> > another driver (the mmc driver) to tell it that a new device has become
> > available.  It hasn't been plugged in via a cable, it has be turned-on via a
> > regulator, but it is conceptually very similar.
> 
> This is a very common situation.  The solution we've mostly been going
> for for soldered down components is actually rather different, though -
> in general it's much nicer for userspace if the device is presented as
> always there rather than doing the hotplug thing and we just power it up
> as needed.
> 
> Due to the existing rfkill implementations I guess the network stack is
> already happy with the probe/remove model but that's not universally
> true.  Even with userspace understanding things this would for example
> also mean that we'd be able to keep the WiFi powered down when we just
> happen not to be using it without having to use the rfkill switch.
> 
> > I wrote a virtual gpio chip which I call gpio-inout because it provides pairs
> > of gpios, an output paired with an input.  When the output is changed it
> > triggers an interrupt associated with the input, and the output is always
> > readable by the input.
> 
> For the implementation I suggest above (which the core can't really cope
> with yet but anyway) I'd be using a regulator.

Brilliant!  That might solve another related problem I've been having.  Time
to learn even more about regulators.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2011-12-05 19:38 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24  2:03 MyungJoo Ham
2011-11-25 14:02 ` Arnd Bergmann
2011-11-26  5:46   ` MyungJoo Ham
2011-11-26 13:23   ` Kyungmin Park
2011-11-27 22:43   ` Linus Walleij
2011-11-27 23:08     ` Greg KH
2011-11-28  0:09       ` Dmitry Torokhov
2011-11-28  0:19         ` Greg KH
2011-11-28  9:03           ` Dmitry Torokhov
2011-11-28  1:31       ` NeilBrown
2011-11-28  7:27         ` Greg KH
2011-11-28  9:04           ` Dmitry Torokhov
2011-11-30  6:35             ` Greg KH
2011-11-30  6:58               ` MyungJoo Ham
2011-11-30  9:46                 ` Mark Brown
2011-11-30 13:28               ` Linus Walleij
2011-11-30 23:04                 ` NeilBrown
2011-12-01 13:38                   ` Linus Walleij
2011-11-28 13:04           ` Linus Walleij
2011-11-28 15:09             ` Morten CHRISTIANSEN
2011-11-30  6:34               ` Greg KH
2011-11-28 17:53     ` Arnd Bergmann
2011-11-29  9:11       ` MyungJoo Ham
2011-11-29  9:45         ` Linus Walleij
2011-11-29 13:59         ` Arnd Bergmann
2011-11-29 17:05           ` Dmitry Torokhov
2011-11-30  2:58         ` NeilBrown
2011-11-30  6:40           ` MyungJoo Ham
2011-11-30 22:56             ` NeilBrown
2011-11-30 23:17               ` Mark Brown
2011-11-30 23:25                 ` Dmitry Torokhov
2011-12-01  4:51                   ` MyungJoo Ham
2011-12-01  5:21                   ` NeilBrown
2011-12-01 11:34                     ` Mark Brown
2011-12-05  3:04                       ` NeilBrown
2011-12-05 12:06                         ` Mark Brown
2011-12-05 19:38                           ` NeilBrown [this message]
2011-12-05 19:45                             ` Mark Brown
2011-12-01  4:46               ` MyungJoo Ham
2011-12-07  9:31       ` Linus Walleij
2011-12-08  4:42         ` Kyungmin Park
2011-11-26 15:32 ` Greg KH
2011-11-29  8:18   ` MyungJoo Ham
2011-11-28 18:23 ` 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=20111206063834.3f66b3e0@notabene.brown \
    --to=neilb@suse.de \
    --cc=arnd@arndb.de \
    --cc=arve@android.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=daniel.willerud@stericsson.com \
    --cc=dg77.kim@samsung.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=grant.likely@secretlab.ca \
    --cc=gregkh@suse.de \
    --cc=johan.palsson@stericsson.com \
    --cc=karl.komierowski@stericsson.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lockwood@android.com \
    --cc=myungjoo.ham@gmail.com \
    /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

Powered by JetHome