Re: How-to: Uniquely identify a DT node in the driver?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, Jul 28, 2015 at 08:38:33PM +0100, Lina Iyer wrote:
> Hello,
> 
> I am looking to find a way to uniquely identify a device in the driver.
> Here is an example -
> 
> 	big: power-controller@1 {
> 		compatible = "soc,foo";
> 		...
> 	};
> 
> 	little: power-controller@2 {
> 		compatible = "soc,foo";
> 		...
> 	};

Ok, so these are two instances of the same block...

> In the driver for the power-controller foo.c, would like to do -
> 
> 	struct xyz {
> 		const char *name;
> 		...
> 	};
> 
> 	static struct xyz a = {
> 		.name = "big"; // To be associated with big device
> 		...
> 	};
> 
> 	static struct xyz b = {
> 		.name = "little"; // To be associated with little device
> 		...
> 	};

... which we're magically assuming things about.

> What would be the best way to associate the power-controller devices 'big'
> and 'little' with 'a' and 'b' respectively? A string comparison would be
> ideal but possibly can work with other ways.
> 
> I could think of adding compatibles to achieve this, but was hoping to
> find something more elegant and appropriate. Or, is compatible the
> recommended way to uniquely identify devices by the driver?

There's no recommended way to uniquely idetnify a device, because in
general it doesn't make sense to do so. Doing so implies intimate
knowledge of a particular board and a lack of hardware description in
the DT (otherwise you wouldn't need to associate additional information
with the instance).

Either you need to describe some characteristic of the device with some
properties on each instance, or you need to derive that form the linkage
to other devices.

It looks like you're trying to give different behviours to "big" and
"little" clusters, which doesn't really fit either case. What do you
want to differ? e.g. is it just the set of OPPs?

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux