[RFC PATCHv1 1/2] Export SoC info through sysfs
Linus Walleij
linus.walleij at linaro.org
Thu Mar 10 12:08:38 EST 2011
On Thu, Mar 10, 2011 at 5:32 PM, Arnd Bergmann <arnd at arndb.de> wrote:
> On Thursday 10 March 2011, Linus Walleij wrote:
>> On Thu, Mar 10, 2011 at 3:23 PM, Arnd Bergmann <arnd at arndb.de> wrote:
>> > On Thursday 10 March 2011, Linus Walleij wrote:
> Not much refactoring required there, just register one
> (platform or top-level, I don't care) device named "soc",
> and make all platform devices of the soc have a .parent
> pointer to that device.
>
> Then you can add attributes to the device.
But since the name of the top-level device name is not
subject to standardization, I suspect that an app
not knowing which SoC it is running on will indeed
need to parse through the entire sysfs/devices/*
hierarchy to see if it can find some soc name.
No easy feat, indeed libsysfs can help you.
Equal to:
x=`find /sys/devices | grep mach-name`
cat x
Compare this to getting the *name* of the hardware
you want to obtain the SoC-info for. Easy:
grep Hardware /proc/cpuinfo
What I'm trying to get at is that the user of this
info isn't really interested in any device tree structure,
it just becomes an obstacle s/he has to overcome
to get this info out.
But there may be a compromise: if we create the
socinfo in one place in the device tree (possibly the
top node, or a dedicated device) then class it?
/sys/class/soc/soc0 -> ../../devices/platform/top-node
Then you find your entries easily by opening
/sys/class/soc/soc0/* ?
If the socinfo interface is singleton (and why should
it not be) then:
/sys/class/soc -> ../devices/platfom/top-node
Or is this thing too trivial to have it's own class?
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list