* Re: [PATCH RFC v3 1/6] ARM: pxa: Convert Spitz OHCI to GPIO descriptors
[not found] ` <20230929-pxa-gpio-v3-1-af8d5e5d1f34@skole.hr>
@ 2023-09-29 20:44 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-09-29 20:44 UTC (permalink / raw)
To: Duje Mihanović
Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Alan Stern, Greg Kroah-Hartman, Bartosz Golaszewski,
Andy Shevchenko, linux-arm-kernel, linux-kernel, linux-usb,
linux-gpio
On Fri, Sep 29, 2023 at 3:15 PM Duje Mihanović <duje.mihanovic@skole.hr> wrote:
> Sharp's Spitz board still uses the legacy GPIO interface for controlling
> a GPIO pin related to the USB host controller.
>
> Convert this function to use the new GPIO descriptor interface.
>
> Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Looks good to me!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC v3 2/6] ARM: pxa: Convert Spitz LEDs to GPIO descriptors
[not found] ` <20230929-pxa-gpio-v3-2-af8d5e5d1f34@skole.hr>
@ 2023-09-29 20:48 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-09-29 20:48 UTC (permalink / raw)
To: Duje Mihanović
Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Alan Stern, Greg Kroah-Hartman, Bartosz Golaszewski,
Andy Shevchenko, linux-arm-kernel, linux-kernel, linux-usb,
linux-gpio
Hi Duje,
thanks for your patch!
On Fri, Sep 29, 2023 at 3:15 PM Duje Mihanović <duje.mihanovic@skole.hr> wrote:
> Sharp's Spitz board still uses the legacy GPIO interface for configuring
> its two onboard LEDs.
>
> Convert them to use the GPIO descriptor interface.
>
> Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
(...)
> + .table = {
> + GPIO_LOOKUP_IDX("pxa-gpio", SPITZ_GPIO_LED_ORANGE, NULL, 0,
> + GPIO_ACTIVE_HIGH),
> + GPIO_LOOKUP_IDX("pxa-gpio", SPITZ_GPIO_LED_GREEN, NULL, 1,
> + GPIO_ACTIVE_HIGH),
This looks right!
> + gpiod_add_lookup_table(&spitz_led_gpio_table);
> + spitz_gpio_leds[0].gpiod = gpiod_get_index(&spitz_led_device.dev,
> + NULL, 0, GPIOD_ASIS);
> + spitz_gpio_leds[1].gpiod = gpiod_get_index(&spitz_led_device.dev,
> + NULL, 1, GPIOD_ASIS);
> platform_device_register(&spitz_led_device);
I missed this before, sorry.
This will probably not work. You need to register the spitz_led_device
first, then
you can get the gpiod:s.
The lookup will use the device name to locate the device, and if the device
isn't there it can't be found.
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC v3 5/6] ARM: pxa: Convert Spitz hsync to GPIO descriptors
[not found] ` <20230929-pxa-gpio-v3-5-af8d5e5d1f34@skole.hr>
@ 2023-09-29 21:43 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-09-29 21:43 UTC (permalink / raw)
To: Duje Mihanović
Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Alan Stern, Greg Kroah-Hartman, Bartosz Golaszewski,
Andy Shevchenko, linux-arm-kernel, linux-kernel, linux-usb,
linux-gpio
Hi Duje,
thanks for your patch!
On Fri, Sep 29, 2023 at 3:15 PM Duje Mihanović <duje.mihanovic@skole.hr> wrote:
> Sharp's Spitz still uses the legacy GPIO interface in its
> wait_for_hsync() function.
>
> Convert it to use the GPIO descriptor interface.
>
> Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Overall this looks fine, but can't help but notice:
> static void spitz_ads7846_wait_for_hsync(void)
> {
> - while (gpio_get_value(SPITZ_GPIO_HSYNC))
> + while (gpiod_get_value(hsync))
> cpu_relax();
Waits while the line is high...
> - while (!gpio_get_value(SPITZ_GPIO_HSYNC))
> + while (!gpiod_get_value(hsync))
> cpu_relax();
Then as it goes low, waits for it to go high again.
So the hsync signal is *active* when it is *low*.
> @@ -543,6 +545,8 @@ static struct gpiod_lookup_table spitz_ads7846_gpio_table = {
> .table = {
> GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_TP_INT,
> "pendown", GPIO_ACTIVE_LOW),
> + GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_HSYNC,
> + "hsync", GPIO_ACTIVE_LOW),
Which is what you appropriately flag it for.
BUT: the signal is now inverted in gpiolib, so the
spitz_ads7846_wait_for_hsync() loops needs to be rewritten
inverted, because the value from gpiod_get_value() now means
"asserted" if high.
/* Wait while de-asserted */
while (!gpiod_get_value(hsync))
cpu_relax();
/* Wait while asserted */
while (gpiod_get_value(hsync))
cpu_relax();
return;
Right?
> @@ -622,8 +626,13 @@ static void __init spitz_spi_init(void)
>
> gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
> gpiod_add_lookup_table(&spitz_spi_gpio_table);
> + hsync = gpiod_get(NULL, "hsync", GPIOD_IN);
You are getting the gpiod from device NULL which is probably correct
when you do this in the board file.
But the spitz_ads7846_gpio_table where you put the descriptor
is associated with the ads7846 device so this will not work.
You either have to add a one-gpio table just for this, or (better)
move the whole spitz_ads7846_wait_for_hsync() down into the
touchscreen driver instead, so the device driver can (optionally) obtain
this gpio and deal with it. Which is easy because:
[linus@Fecusia linux-nomadik]$ git grep ads7846_platform_data
Documentation/spi/spi-summary.rst: static struct
ads7846_platform_data ads_info = {
arch/arm/mach-pxa/spitz.c:static struct ads7846_platform_data
spitz_ads7846_info = {
arch/mips/alchemy/devboards/db1000.c:static struct
ads7846_platform_data db1100_touch_pd = {
arch/powerpc/platforms/512x/pdm360ng.c:static struct
ads7846_platform_data pdm360ng_ads7846_pdata = {
Only three users in the kernel, and sptiz is the only one using the
void (*wait_for_sync)(void) callback in ads7846_platform_data!
So delete that callback from ads7846_platform_data in
include/linux/spi/ads7846.h
and augment drivers/input/touchscreen/ads7846.c to get the
GPIO optionally with gpiod_get_optional() from the device,
then copy the code from spitz_ads7846_wait_for_hsync() right
into the driver and make sure it gets called if and only
if the "hsync" gpio exists.
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC v3 6/6] ARM: pxa: Convert gumstix Bluetooth to GPIO descriptors
[not found] ` <20230929-pxa-gpio-v3-6-af8d5e5d1f34@skole.hr>
@ 2023-09-29 21:48 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-09-29 21:48 UTC (permalink / raw)
To: Duje Mihanović
Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Alan Stern, Greg Kroah-Hartman, Bartosz Golaszewski,
Andy Shevchenko, linux-arm-kernel, linux-kernel, linux-usb,
linux-gpio
On Fri, Sep 29, 2023 at 3:15 PM Duje Mihanović <duje.mihanovic@skole.hr> wrote:
> Gumstix still uses the legacy GPIO interface for resetting the Bluetooth
> device.
>
> Convert it to use the GPIO descriptor interface.
>
> Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
As far as I can tell the BT UART is registered before the
gpios are added and retrieved, and that should work so:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-29 21:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230929-pxa-gpio-v3-0-af8d5e5d1f34@skole.hr>
[not found] ` <20230929-pxa-gpio-v3-1-af8d5e5d1f34@skole.hr>
2023-09-29 20:44 ` [PATCH RFC v3 1/6] ARM: pxa: Convert Spitz OHCI to GPIO descriptors Linus Walleij
[not found] ` <20230929-pxa-gpio-v3-2-af8d5e5d1f34@skole.hr>
2023-09-29 20:48 ` [PATCH RFC v3 2/6] ARM: pxa: Convert Spitz LEDs " Linus Walleij
[not found] ` <20230929-pxa-gpio-v3-5-af8d5e5d1f34@skole.hr>
2023-09-29 21:43 ` [PATCH RFC v3 5/6] ARM: pxa: Convert Spitz hsync " Linus Walleij
[not found] ` <20230929-pxa-gpio-v3-6-af8d5e5d1f34@skole.hr>
2023-09-29 21:48 ` [PATCH RFC v3 6/6] ARM: pxa: Convert gumstix Bluetooth " Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).