* small brainstorm for the problem I have
@ 2025-02-10 9:31 Andy Shevchenko
2025-02-11 12:14 ` Bartosz Golaszewski
2025-02-12 22:55 ` Linus Walleij
0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-10 9:31 UTC (permalink / raw)
To: linux-gpio; +Cc: Linus Walleij, Bartosz Golaszewski
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...
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: small brainstorm for the problem I have
2025-02-10 9:31 small brainstorm for the problem I have Andy Shevchenko
@ 2025-02-11 12:14 ` Bartosz Golaszewski
2025-02-11 12:21 ` Andy Shevchenko
2025-02-12 22:55 ` Linus Walleij
1 sibling, 1 reply; 6+ messages in thread
From: Bartosz Golaszewski @ 2025-02-11 12:14 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-gpio, Linus Walleij, Koichiro Den
On Mon, Feb 10, 2025 at 10:31 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
>
> 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...
>
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: small brainstorm for the problem I have
2025-02-11 12:14 ` Bartosz Golaszewski
@ 2025-02-11 12:21 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-11 12:21 UTC (permalink / raw)
To: Bartosz Golaszewski, Mika Westerberg, Hans de Goede
Cc: linux-gpio, Linus Walleij, Koichiro Den
+Cc: Mika, Hans (if you have any input on this, I will appreciate)
On Tue, Feb 11, 2025 at 01:14:44PM +0100, Bartosz Golaszewski wrote:
> On Mon, Feb 10, 2025 at 10:31 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > 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...
> >
>
> 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).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: small brainstorm for the problem I have
2025-02-10 9:31 small brainstorm for the problem I have Andy Shevchenko
2025-02-11 12:14 ` Bartosz Golaszewski
@ 2025-02-12 22:55 ` Linus Walleij
2025-02-13 7:58 ` Andy Shevchenko
1 sibling, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2025-02-12 22:55 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-gpio, Bartosz Golaszewski
On Mon, Feb 10, 2025 at 10:31 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> 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"?
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: small brainstorm for the problem I have
2025-02-12 22:55 ` Linus Walleij
@ 2025-02-13 7:58 ` Andy Shevchenko
2025-02-13 11:24 ` Linus Walleij
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-13 7:58 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, Bartosz Golaszewski
On Wed, Feb 12, 2025 at 11:55:31PM +0100, Linus Walleij wrote:
> On Mon, Feb 10, 2025 at 10:31 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>
> > 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"?
>
> > 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.
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.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: small brainstorm for the problem I have
2025-02-13 7:58 ` Andy Shevchenko
@ 2025-02-13 11:24 ` Linus Walleij
0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2025-02-13 11:24 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-gpio, Bartosz Golaszewski
On Thu, Feb 13, 2025 at 8:58 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-13 11:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10 9:31 small brainstorm for the problem I have Andy Shevchenko
2025-02-11 12:14 ` Bartosz Golaszewski
2025-02-11 12:21 ` Andy Shevchenko
2025-02-12 22:55 ` Linus Walleij
2025-02-13 7:58 ` Andy Shevchenko
2025-02-13 11:24 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox