From: NeilBrown <neilb@suse.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <rob.herring@calxeda.com>,
devicetree@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: Strange location and name for platform devices when device-tree is used.
Date: Fri, 1 Nov 2013 16:03:29 +1100 [thread overview]
Message-ID: <20131101160329.37f3707b@notabene.brown> (raw)
In-Reply-To: <1383280054.28909.30.camel@pasglop>
[-- Attachment #1: Type: text/plain, Size: 3627 bytes --]
On Fri, 01 Nov 2013 15:27:34 +1100 Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Fri, 2013-11-01 at 15:22 +1100, Benjamin Herrenschmidt wrote:
> > On Fri, 2013-11-01 at 14:59 +1100, NeilBrown wrote:
> > > and I wonder how relevant it still is in this context. As platform devices
> > > are all in the root of the device-tree and hence are siblings, they must have
> > > unique names in the device-tree and so the platform devices created from
> > > them will also have unique names -- won't they?
> >
> > I agree about /sys/devices -> /sys/devices/platform, that makes more
> > sense
> >
> > The problem with names is that we don't *know* that your devices are
> > at the root and unique. They don't have to be. I have platforms that
> > have several "chips" each containing all the same devices. They need to
> > be de-duped.
> >
> > Maybe the right approach is to build the de-duplication in sysfs
> > itself ?
Do you mean we could allow multiple devices on the one bus to have the same
name, but get sysfs to notice and de-duplicate by mangling one name? I don't
think I like that but I might have misunderstood.
On my device I seem to have some platform devices registered through
device-tree, and some registered through platform_device_add (e.g.
'alarmtimer'). Guaranteeing they remain disjoint sets if the kernel is
allowed to evolve independently of the devicetree might be tricky....
Maybe we need "/sys/devices/platform" and "/sys/devices/dt_platform" ??
Hoping someone who understands the device model better than me will help.
>
> BTW. How come you have devices at the root of the tree without "reg" ?
> It's fairly fishy ...
>
> The root of the tree is supposed to represent the processor address
> space, and has #address-cells/#size-cells set appropriately. Any MMIO
> mapped device shall thus have a "reg" property and a unit address.
>
> Only "container" nodes (such as /cpus or /chosen) or virtual devices
> (such as a node used to representing the collection of bits & pieces
> that makes the audio infrastructure) and are thus not per-se MMIO mapped
> entities can ommit the "reg" properties.
>
> In the case of pwm, it looks like there's another device providing a pwm
> capability, in which case your backlight would indeed be a "virtual
> device" (basically non-mmio device not hanging off any bus). Or it could
> have been represented as a child of pwm if that had been defined that
> way, I am not familiar with the pwm bindings.
The 'backlight' device is a virtual device. It uses a 'pwm' device to
provide the variable brightness to the back light.
The 'pwm' device itself is virtual, making use of a 'dmtimer' to provide the
timing... The timer device (timer11 in omap3.dtsi) has a 'reg' property.
A random example from current mainline is
arch/arm/boot/dts/am335x-evmsk.dts
which has 'backlight' as a virtual device compatible with pwm-backlight.
It also has 'gpio-keys', 'gpio-leds', and 'regulator-fixed' compatible
virtual devices. They seem fairly common.
Thanks,
NeilBrown
>
> Cheers,
> Ben.
>
> > Cheers,
> > Ben.
> >
> > > Any help understanding and/or fixing this discrepancy greatly appreciated.
> > >
> > > The change of name is particularly annoying to me because one of my platform
> > > devices is a pwm_bl.c backlight. With a boardfile I
> > > get /sys/class/pwm_backlight. With devicetree the best I can get
> > > is /sys/class/pwm_backlight.23 (or similar). It would be really nice to have
> > > a more stable and sensible name here.
> >
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2013-11-01 5:03 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 3:59 Strange location and name for platform devices when device-tree is used NeilBrown
2013-11-01 3:59 ` NeilBrown
2013-11-01 4:22 ` Benjamin Herrenschmidt
2013-11-01 4:27 ` Benjamin Herrenschmidt
2013-11-01 5:03 ` NeilBrown [this message]
2013-11-01 5:08 ` Benjamin Herrenschmidt
2013-11-01 18:04 ` Grant Likely
2013-11-01 18:04 ` Grant Likely
2013-11-01 20:33 ` Benjamin Herrenschmidt
2013-11-15 7:37 ` Grant Likely
2013-11-15 7:37 ` Grant Likely
[not found] ` <20131101180459.81793C40A28-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-01 20:48 ` Greg Kroah-Hartman
2013-11-01 20:48 ` Greg Kroah-Hartman
2013-11-01 20:47 ` Greg Kroah-Hartman
2013-11-01 20:47 ` Greg Kroah-Hartman
[not found] ` <20131101204749.GA19662-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-11-01 23:09 ` Benjamin Herrenschmidt
2013-11-01 23:09 ` Benjamin Herrenschmidt
2013-11-02 15:58 ` Greg Kroah-Hartman
2013-11-02 15:58 ` Greg Kroah-Hartman
[not found] ` <20131102155824.GG23938-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-11-02 20:22 ` Benjamin Herrenschmidt
2013-11-02 20:22 ` Benjamin Herrenschmidt
2013-11-02 20:40 ` Greg Kroah-Hartman
2013-11-02 20:40 ` Greg Kroah-Hartman
[not found] ` <20131102204021.GA13994-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-11-03 21:12 ` Benjamin Herrenschmidt
2013-11-03 21:12 ` Benjamin Herrenschmidt
2013-11-03 21:09 ` NeilBrown
2013-11-01 23:10 ` Benjamin Herrenschmidt
2013-11-01 23:10 ` Benjamin Herrenschmidt
2013-11-01 23:45 ` NeilBrown
2013-11-01 23:45 ` NeilBrown
[not found] ` <20131102104505.34105cbb-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2013-11-04 8:56 ` Thierry Reding
2013-11-04 8:56 ` Thierry Reding
2013-11-15 7:44 ` Grant Likely
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=20131101160329.37f3707b@notabene.brown \
--to=neilb@suse.de \
--cc=benh@kernel.crashing.org \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.