On Tue, Mar 07, 2023 at 01:57:27PM -0600, Daniel Kaehn wrote: > On Tue, Mar 7, 2023 at 12:14 PM Andy Shevchenko > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: > > On Tue, Mar 07, 2023 at 02:17:06PM +0100, Benjamin Tissoires wrote: > > > On Mar 06 2023, Andy Shevchenko wrote: ... > > > It is commonly accepted in the ACPI world that the names do not carry > > > meaning AFAICT, and so I think I agree with Andy's initial comment > > > regarding using indexes, not names to also fetch the I2C and GPIO nodes. > > > You can probably have a fallback mechanism for when "i2c" is not > > > present, or simply check if you are in DT or not and use the names only > > > if we are in DT. > > > > The solution is to provide in the main node the list of cell names, that way > > you will always know the indices: > > > > Device (DEV) { > > _DSD > > "cell-names" { "i2c", "gpio" } // index of the name is the > > // index of the cell > > > > Device (I2C0) { > > } > > > > Device (GPI0) { > > } > > } > > > > Problem solved. > > Just to make sure I'm understanding you correctly: > > Are you proposing that specifically this driver directly reads "cell-names" > from the ACPI DSD to implement this indexing? Or are you proposing a > kernel-wide mechanism of "overriding" a fwnode name with ACPI? > (assuming this doesn't exist already, and I'm not just missing it in > the kernel source) > > Or are you proposing something else entirely? > (apologies if this should be obvious -- throwing up the ACPI newbie > card again here :) ) Out of the three listed above I'm proposing the first one. (Maybe it can be called 'reg-names', but it depends on the hardware) Also look into hierarchical _DSD (it is similar to the children of the device node without being separate devices). > In any case, would this be something I should post to the email chain > with DT and ACPI > folks for opinions before I start to implement it? May be, the -names approach is already used widely for clock, interrupt, reset, phy and nvmem. So it's something we know about. -- With Best Regards, Andy Shevchenko