small brainstorm for the problem I have
I have a device that uses SPI bitbang (which is physically represented by bunch of GPIOs). I want to have a driver of that device to use SPI GPIO driver, but...
1) SPI GPIO has an established DT schema and hardcoded GPIO line names in the driver.
2) The firmware for the device uses already some names for the GPIO lines that not compatible with SPI GPIO schema.
So, what would be the best approach here?
I was thinking about the following:
1) Use GPIO aggregator to fake the chip that will provide necessary names.
2) Hack the GPIO library to add a quirk for this specific device to translate the line names.
3) ...your variant...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 13 lines · Andy Shevchenko
I have a device that uses SPI bitbang (which is physically represented by bunch of GPIOs). I want to have a driver of that device to use SPI GPIO driver, but...
1) SPI GPIO has an established DT schema and hardcoded GPIO line names in the driver.
2) The firmware for the device uses already some names for the GPIO lines that not compatible with SPI GPIO schema.
So, what would be the best approach here?
Quoted 8 lines
I was thinking about the following:
1) Use GPIO aggregator to fake the chip that will provide necessary names.2) Hack the GPIO library to add a quirk for this specific device to translate the line names.
3) ...your variant...
I would go with #1 of course - as it has the least impact on the kernel - but setting the names is not yet available upstream. I'm Cc'ing Koichiro Den who's working on adding support for it.
Bart
+Cc: Mika, Hans (if you have any input on this, I will appreciate)
Quoted 20 lines · Bartosz Golaszewski
Quoted 18 lines · Andy Shevchenko
I have a device that uses SPI bitbang (which is physically represented by bunch of GPIOs). I want to have a driver of that device to use SPI GPIO driver, but...
1) SPI GPIO has an established DT schema and hardcoded GPIO line names in the driver.
2) The firmware for the device uses already some names for the GPIO lines that not compatible with SPI GPIO schema.
So, what would be the best approach here?
I was thinking about the following:
1) Use GPIO aggregator to fake the chip that will provide necessary names.2) Hack the GPIO library to add a quirk for this specific device to translate the line names.
Quoted 6 lines
Quoted 2 lines
3) ...your variant...
I would go with #1 of course - as it has the least impact on the kernel - but setting the names is not yet available upstream. I'm Cc'ing Koichiro Den who's working on adding support for it.
I now realized that under "names" I actually meant "connection IDs" (con_id in the code).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
2) The firmware for the device uses already some names for the GPIO lines that not compatible with SPI GPIO schema.
I guess you mean the node names
like "cs", "mosi", "miso", "sck"?
Quoted 5 lines
I was thinking about the following:
1) Use GPIO aggregator to fake the chip that will provide necessary names.2) Hack the GPIO library to add a quirk for this specific device to translate the line names.
I would honestly do (2) if it was device tree, because we already have nicely centralized quirks for it, but for ACPI I don't know :/ Aggregator feels a bit like overkill for this.
Yours,
Linus Walleij
Quoted 12 lines · Linus Walleij
Quoted 2 lines · Andy Shevchenko
2) The firmware for the device uses already some names for the GPIO lines that not compatible with SPI GPIO schema.
I guess you mean the node names
like "cs", "mosi", "miso", "sck"?Quoted 3 lines
I was thinking about the following:
1) Use GPIO aggregator to fake the chip that will provide necessary names.
Quoted 6 lines
Quoted 2 lines
2) Hack the GPIO library to add a quirk for this specific device to translate the line names.
I would honestly do (2) if it was device tree, because we already have nicely centralized quirks for it, but for ACPI I don't know :/ Aggregator feels a bit like overkill for this.
Interestingly, I feel the same. The aggregator approach is something like +100+ LoCs for a little benefit + runtime overhead.
But this sounds like we would need some kind of translation quirks done in gpiolib-acpi.c. In the similar way as OF does.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
But this sounds like we would need some kind of translation quirks done in
gpiolib-acpi.c. In the similar way as OF does.
Yeah that's what I would do. You're the maintainer of that file so I feel you should do what you think works best for ACPI.
Yours,
Linus Walleij