New i2c sensor - dts compatible and his driver

Hello,

I would like to add to my project new i2c slave (for example - dac5571 from TI).
In the DTS overlay - under the i2c0 node I need to specify compatible, and I don't understand what is happening in the background with this keyword.

I looked on other TI dac compatible that are already found in zephyr tree, and all I could see are yaml files and no code files.

my questions are:

1. If I need to make my own compatible - what does it make on compile time? what are the rules to make compatible for any new i2c slave?
2. Where the driver code for each new i2c slave is declared on compile time related to the DTS compatible keyword?

Thanks,
Udi.

Parents
  • Hi,

    The compatible keyword in the dts is used to identify the hardware components and then find the appropriate drivers to be used when the program is built. The YAML binding files describes the devices properties and how it maps to the hardware registers. It's placed at dts/bindings/component

    what are the rules to make compatible for any new i2c slave?

    What are you thinking of? You can set the field to comptatible in the dts if you find the correct driver for the device.

    2. Where the driver code for each new i2c slave is declared on compile time related to the DTS compatible keyword?

    Zephyr will check if it can find the correct driver as instructed by the YAML binding, for each device in the dts that has the compatible field. If the driver is find during build then it will be linked to that device.

    regards

    Jared

Reply
  • Hi,

    The compatible keyword in the dts is used to identify the hardware components and then find the appropriate drivers to be used when the program is built. The YAML binding files describes the devices properties and how it maps to the hardware registers. It's placed at dts/bindings/component

    what are the rules to make compatible for any new i2c slave?

    What are you thinking of? You can set the field to comptatible in the dts if you find the correct driver for the device.

    2. Where the driver code for each new i2c slave is declared on compile time related to the DTS compatible keyword?

    Zephyr will check if it can find the correct driver as instructed by the YAML binding, for each device in the dts that has the compatible field. If the driver is find during build then it will be linked to that device.

    regards

    Jared

Children
No Data
Related