Because Zephyr parses devicetree at compile time rather than runtime
it handles compatible strings differently. It defines the compatible
string for a driver with the #define DT_DRV_COMPAT
macro in
the driver. If the driver supports more than one device the following
pattern is used:
#if DT_HAS_COMPAT_STATUS_OKAY(foo_bar)
#define DT_DRV_COMPAT foor_babar
#elif DT_HAS_COMPAT_STATUS_OKAY(foo_baz)
#define DT_DRV_COMPAT foor_baz
#endif
For the bindings a YAML file is created for each device and a common file that is included in each device file. For example, see:
drivers/display/uc81xx.c
ultrachip,uc81xx-common.yaml
dts/bindings/display/ultrachip,uc8176.yaml
dts/bindings/display/ultrachip,uc8179.yaml
dts/bindings/display/ultrachip,uc8175.yaml