From: Andy Green <andy.green@linaro.org>
To: Roger Quadros <rogerq@ti.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Greg KH <gregkh@linuxfoundation.org>,
linux-omap@vger.kernel.org, keshava_mgowda@ti.com,
linux-usb@vger.kernel.org, balbi@ti.com
Subject: Re: [RFC PATCH 1/5] drivers : introduce device_path api
Date: Wed, 28 Nov 2012 19:47:41 +0800 [thread overview]
Message-ID: <50B5F9DD.5060308@linaro.org> (raw)
In-Reply-To: <50B5F1DB.8090502@ti.com>
On 11/28/2012 07:13 PM, the mail apparently from Roger Quadros included:
> On 11/27/2012 09:22 PM, Andy Green wrote:
>> On 11/28/2012 02:09 AM, the mail apparently from Alan Stern included:
>>> On Wed, 28 Nov 2012, Andy Green wrote:
>>>
>>>>> Greg's advice was simply not to rely on pathnames in sysfs because they
>>>>> aren't fixed in stone. That leaves plenty of other ways to approach
>>>>> this problem.
>>>>
>>>> It's sage advice, but there is zero code provided in my patches that
>>>> "relies on pathnames in sysfs".
>>>
>>> In your 1/5 patch, _device_path_generate() concatenates device name
>>> strings, starting from a device root and separating elements with '/'
>>> characters. Isn't that the same as a sysfs pathname?
>>
>> It's nothing to do with sysfs... yes some unrelated bits of sysfs also
>> walk the device path. If we want to talk about how fragile the device
>> path is as an id scheme over time we need to talk about likelihood of
>> individual device names changing, not "sysfs". Anyway -->
>>
>>>>> Basically, what you want is for something related to device A (the
>>>>> regulator or the GPIO) to happen whenever device B (the ehci-omap.0
>>>>> platform device) is bound to a driver. The most straightforward way to
>>>>> arrange this is for A's driver to have a callback that is invoked
>>>>> whenever B is bound or unbound. The most straightforward way to
>>>>> arrange _that_ is to allow each platform_device to have a list of
>>>>> callbacks.
>>>>
>>>> Sorry I didn't really understand this proposal yet. You want "A", the
>>>> regulator, driver to grow a callback function that gets called when the
>>>> targeted platform_device ("B", ehci-omap.0) probe happens. Could you
>>>> expand what the callback prototype or new members in the struct might
>>>> look like? It's your tuple thing or we pass it an opaque pointer that
>>>> is the struct regulator * or suchlike?
>>>
>>> Well, it won't be exactly the same as the tuple thing because no
>>> strings will be involved, but it would be similar. The callback would
>>> receive an opaque pointer (presumably to the regulator) and a device
>>> pointer (the B device).
>>
>> OK. So I try to sketch it out iteractively to try to get in sync:
>>
>> device.h:
>>
>> enum asset_event {
>> AE_PROBED,
>> AE_REMOVED
>> };
>>
>> struct device_asset {
>> char *name; /* name of regulator, clock, etc */
>> void *asset; /* regulator, clock, etc */
>> int (*handler)(struct device *dev_owner, enum asset_event
>> asset_event, struct device_asset *asset);
>> };
>>
>> struct device {
>> ...
>> struct device_asset *assets;
>> ...
>> };
>>
>>
>> drivers/base/dd.c | really_probe():
>>
>> ...
>> struct device_asset *asset;
>> ...
>> asset = dev->assets;
>> while (asset && asset->name) {
>> if (asset->handler(dev, AE_PROBED, asset)) {
>> /* clean up and bail */
>> }
>> asset++;
>> }
>>
>> /* do probe */
>> ...
>>
>>
>> drivers/base/dd.c | __device_release_driver: (is this really the best
>> place to oppose probe()?)
>>
>> ...
>> struct device_asset *asset;
>> ...
>>
>> /* call device ->remove() */
>> ...
>> asset = dev->assets;
>> while (asset && asset->name) {
>> asset->handler(dev, AE_REMOVED, asset);
>> asset++;
>> }
>> ...
>>
>>
>> board file:
>>
>> static struct regulator myreg = {
>> .name = "mydevice-regulator",
>> };
>>
>> static struct device_asset mydevice_assets[] = {
>> {
>> .name = "mydevice-regulator",
>> .handler = regulator_default_asset_handler,
>> },
>> { }
>> };
>>
>> static struct platform_device mydevice = {
>> ...
>> .dev = {
>> .assets = mydevice_assets,
>> },
>> ...
>> };
>>
>
> From Pandaboard's point of view, is mydevice supposed to be referring to
> ehci-omap, LAN95xx or something else?
>
> Strictly speaking, the regulator doesn't belongs neither to ehci-omap
> nor LAN95xx. It belongs to a power domain on the board. And user should
> have control to switch it OFF when required without hampering operation
> of ehci-omap, so that the other USB ports are still usable.
I'd prefer to deal with that after a try#1 with regulator, I didn't see
any code about power domain in there right now. There's a lot to get
consensus on already with this series.
Notice that these assets are generic, I will provide clk and regulator
handlers with try#1, and working examples for Panda case with both, but
presumably power domain can fold into it as well.
Since I am on usb-next and there's nothing to be seen about power
domains, what is the situation with that support?
-Andy
--
Andy Green | TI Landing Team Leader
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106 -
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-11-28 11:47 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-26 12:45 [RFC PATCH 0/5] Device Paths introduced and applied to generic hub and panda Andy Green
2012-11-26 12:45 ` [RFC PATCH 1/5] drivers : introduce device_path api Andy Green
2012-11-26 19:12 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1211261348310.2168-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-26 23:26 ` Andy Green
[not found] ` <20121126124534.18106.44137.stgit-Ak/hGR4SqtBG2qbu2SEcwgC/G2K4zDHf@public.gmane.org>
2012-11-26 19:16 ` Greg KH
[not found] ` <20121126191612.GA11239-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-11-26 23:28 ` Andy Green
2012-11-26 19:22 ` Greg KH
2012-11-26 19:27 ` Greg KH
2012-11-26 21:07 ` Alan Stern
2012-11-26 22:50 ` Greg KH
[not found] ` <Pine.LNX.4.44L0.1211261555400.2168-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-27 0:02 ` Andy Green
[not found] ` <50B40320.2020206-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-27 16:37 ` Alan Stern
2012-11-27 17:44 ` Andy Green
[not found] ` <50B4FBE9.5080301-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-27 18:09 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1211271253230.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-27 19:22 ` Andy Green
2012-11-27 20:10 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1211271446430.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-28 2:30 ` Andy Green
[not found] ` <50B51313.2060003-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-28 11:13 ` Roger Quadros
2012-11-28 11:47 ` Andy Green [this message]
2012-11-28 12:45 ` Roger Quadros
2012-11-28 16:43 ` Alan Stern
2012-11-29 2:05 ` Ming Lei
2012-11-29 17:05 ` Alan Stern
2012-11-27 3:41 ` Ming Lei
2012-11-27 16:30 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1211271119380.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-27 17:02 ` Greg KH
2012-12-01 7:49 ` Jassi Brar
2012-12-01 8:37 ` Andy Green
[not found] ` <50B9C1B0.3080605-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-12-01 18:08 ` Jassi Brar
[not found] ` <CABb+yY3TC3z+jRU91KGX+FKLtJ3ZXUp55-wM_KjxiYuVZ+LL+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-05 14:09 ` Roger Quadros
[not found] ` <50BF55B3.1030205-l0cyMroinI0@public.gmane.org>
2012-12-06 14:34 ` Jassi Brar
2012-12-10 9:48 ` Roger Quadros
[not found] ` <50C5B003.9060904-l0cyMroinI0@public.gmane.org>
2012-12-10 14:36 ` Felipe Balbi
2012-12-11 9:12 ` Jassi Brar
[not found] ` <CABb+yY3u2QB0JqXrznDGHXqH3crkYk54whC0GTwkBHqjdEzhbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-11 10:01 ` Roger Quadros
[not found] ` <50C70495.40500-l0cyMroinI0@public.gmane.org>
2012-12-11 10:09 ` Felipe Balbi
2012-11-27 17:22 ` Ming Lei
2012-11-27 17:55 ` Andy Green
[not found] ` <50B4FE7D.9030505-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-27 23:06 ` Ming Lei
2012-11-28 1:16 ` Ming Lei
2012-11-26 23:47 ` Andy Green
[not found] ` <20121126123427.18106.4112.stgit-Ak/hGR4SqtBG2qbu2SEcwgC/G2K4zDHf@public.gmane.org>
2012-11-26 12:45 ` [RFC PATCH 2/5] usb: omap ehci: remove all regulator control from ehci omap Andy Green
2012-11-26 12:45 ` [RFC PATCH 3/5] usb: hub: add device_path regulator control to generic hub Andy Green
2012-11-26 19:23 ` Greg KH
2012-11-26 12:45 ` [RFC PATCH 4/5] omap4: panda: add smsc95xx regulator and reset dependent on root hub Andy Green
2012-11-26 16:20 ` Roger Quadros
2012-11-27 0:17 ` Andy Green
2012-11-26 12:45 ` [RFC PATCH 5/5] config omap2plus add ehci bits Andy Green
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=50B5F9DD.5060308@linaro.org \
--to=andy.green@linaro.org \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=keshava_mgowda@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rogerq@ti.com \
--cc=stern@rowland.harvard.edu \
/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).