Re: I2C and devicetrees
From: Grant Likely <hidden>
Date: 2012-12-14 20:38:45
Also in:
linux-i2c
On Tue, 11 Dec 2012 13:56:08 -0700, Stephen Warren [off-list ref] wrote:
On 12/11/2012 01:21 PM, Olof Johansson wrote:quoted
[+devicetree-discuss] On Wed, Dec 5, 2012 at 2:36 PM, Peter Huewe [off-list ref] wrote:quoted
Hi, I have a short question about the relations between i2c and devicetrees. I was wondering is the device part of the compatible string of a (trivial) i2c device instanciated via devicetree _always_ identical to name in i2c_client.name ? Or can it be somehow different?It can be different, but the driver will then need to add a OF table that matches the probing. By default the i2c/dt core code will strip off the vendor prefix (before ",") and try probing with the rest of the device name. If that doesn't match the client name, that is when you need the additional table.While relying on the prefix stripping works, I think I recall Grant mentioning that people shouldn't rely on it - namely that any I2C device that gets instantiated from DT should contain the OF match table explicitly. I CC'd Grant in case I'm mis-quoting him.
I'm not quite that strict about it. The behaviour described above is based merely on a heuristic but for a lot of drivers that don't do anything special it works just fine. The moment you need to identify a specific device it becomes better to use an of match table. g. -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd.