Re: I2C and devicetrees

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

 



[+devicetree-discuss]

On Wed, Dec 5, 2012 at 2:36 PM, Peter Huewe <PeterHuewe@xxxxxx> wrote:
> 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.


> Here's a short example:
> device tree:
> test {
>         compatible = "vendor,device1", "vendor,device2";
>         reg = <0x20>;
> }
>
> The driver has in its id table only this entry:
> static const struct i2c_device_id my_i2c_table[] = {
>         {"device2", 0},
>         {},
> };
>
> -> "vendor,device2" matches and the driver is called.
> --> Is i2c_client.name guaranteed to be "device2" ?
>
> Second question:
> Where would you probably add an i2c tpm?
> Would you add it to
>  Documentation/devicetree/bindings/i2c/trivial-devices.txt
> or if it's not trivial add it to a new file under
>  Documentation/devicetree/bindings/i2c/

A trivial device is a device that takes at most an address (or address
range) and an interrupt.

If it has a more elaborate binding than that, then a separate small
binding doc is needed.

> or create a new folder
>  Documentation/devicetree/bindings/tpm
> as there probably are more i2c tpms to come in the near future.

I'd leave it under i2c for now, we tend to group per bus, not per function.

> I'd probably prefer the first one, whereas Google already uses the second
> option:
> http://git.chromium.org/gitweb/?p=chromiumos/third_party/kernel.git;a=history;f=Documentation/devicetree/bindings/tpm;hb=refs/heads/chromeos-3.4

The location of the file doesn't matter and it can easily be moved. I
was more concerned with getting the document written and included than
stored in the perfect location at the time.



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


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux