Re: [PATCH 2/2] rtc: x1205: Add DT probing support

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

 



Hi Alexandre,

On Fri, Feb 1, 2019 at 3:13 PM Alexandre Belloni
<alexandre.belloni@xxxxxxxxxxx> wrote:
> On 01/02/2019 13:22:57+0100, Linus Walleij wrote:

> > In the earlier implementations of device tree it was done
> > such that the device node would match the i2c name and
> > then the device would probe, such that if I in my device
> > tree name it:
> >
> > x1205@6f {
> >     reg = <>;
> > };
> >
> > Then the core will see match that node name to the i2c
> > device name. (I think this goes way back, possibly to the
> > earliest Open Firmware.)
> >
> > However the DT maintainers have more and more pushed
> > for DT nodes to have functional name, so this would then
> > be named:
> >
> > rtc@6f {
> >     reg = <>;
> > };
> >
> > And then it stops working.
> >
> > I think Lee Jones added the compatible probing to a bunch
> > of I2C devices for this reason.
> >
>
> Well, that is not what I was referring to.

Oh sorry for my ignorance, it's the only mechanism I ever
heard of...

> You could use:
>
> rtc@6f {
>      compatible = "xircom,x1205";
>      reg = <0x6f>;
> };
>
> And this would already probe without having an of_device_id table
> because the i2c core is matching the compatibles with the i2c_device_id
> table.

Oh interesting! There is some code in i2c-core-of.c that strips the "vendor,"
part and matches on the last part of the compatible, but it is named
i2c_of_match_device_sysfs() so one think it only apply to devices
added through sysfs. But indeed seems to be used for everything.

That's a neat trick!

Yours,
Linus Walleij



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux