Thread (35 messages) 35 messages, 3 authors, 2023-03-09

Re: [PATCH v8 3/3] HID: cp2112: Fwnode Support

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2023-03-08 12:42:01
Also in: linux-devicetree

On Tue, Mar 07, 2023 at 01:57:27PM -0600, Daniel Kaehn wrote:
On Tue, Mar 7, 2023 at 12:14 PM Andy Shevchenko
[off-list ref] wrote:
quoted
On Tue, Mar 07, 2023 at 02:17:06PM +0100, Benjamin Tissoires wrote:
quoted
On Mar 06 2023, Andy Shevchenko wrote:
...
quoted
quoted
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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help