RE: [PATCH] i2c: xiic: Support disabling multi-master in DT

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

 



> > The multi-master -binding is documented here as boolean and encodes a
> > Boolean by either existing or not existing in device tree. It is also
> > used in other drivers so I couldn't do much about it missing meaning
> > False.
> > https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/i2c/i2c.txt
> > I originally had a custom device tree entry where the default was for
> > multi-master to be enabled before I noticed the pre-existing binding.
> > 
> > Maybe if the multi-master binding was changed from Boolean to for
> > example a string property (multi-master = "ON" / multi-master =
> > "OFF"), code could still just check the existence with
> > "of_property_read_bool()" first, where property missing means "OFF"
> > and property existing means "ON"(like before) if there is no text
> > associated. Xiic driver would then only disable multimaster, if device
> > tree explicitly contains multi-master = "OFF".
> > 
> > This should be able to maintain driver backwards compatibility with
> > old device trees, but requires binding documentation change and all
> > drivers should likely be updated to also accept the new style of
> > multi-master property to be consistent. This is also not as clean as
> > the old Boolean property in my opinion.
>
> I agree. I don't want to change the old "multi-master" binding like
> above because that would be quite intrusive for other drivers and
> confusing when trying to understand the binding.
>
> My best bet is to introduce another binding "single-master" which says
> clearly that we are the only bus master on that bus.
>
> Both bindings missing means then "unclear".
>
> I think this matches reality best.
>
> Opinions?

I agree that this sounds like the best option if original binding can't be used, even though it can also be a bit confusing to have 2 similar bindings.
How would both bindings existing simultaneously be interpreted? Maybe both existing simultaneously should be considered as an invalid configuration, so that it would be enough to just check the one you need? The other option would be to treat both existing similarly to neither existing, which would require the driver to always check both if checking one.

Should the new single-master binding also be a general binding for all I2C drivers or a binding just defined for the XIIC driver? Having it as a general binding for all drivers could help with similar issues rising later with some other driver. It seems possible that a similar issue could happen with some other driver implementing multi-master support, but I have no experience with using or testing them.

- Jaakko




[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