Message ID | 20230924-pxa-gpio-v1-5-2805b87d8894@skole.hr (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | ARM: pxa: GPIO descriptor conversions | expand |
On Sun, Sep 24, 2023 at 06:42:58PM +0200, Duje Mihanović wrote: > Sharp's Spitz still uses the legacy GPIO interface in its wait_for_hsync We refer to the functions as wait_for_hsync(). > function. > > Convert it to use the GPIO descriptor interface. ... > + hsync = gpiod_get(NULL, "hsync", GPIOD_IN); > + if (IS_ERR(hsync)) > + pr_err("Failed to get hsync GPIO: %ld\n", PTR_ERR(hsync)); So, I didn't get, is this GPIO crucial for functioning or optional? If the former, we need to stop here or bail out (if possible), do we? Or should use _optional() API?
On Monday, September 25, 2023 9:36:40 AM CEST Andy Shevchenko wrote: > So, I didn't get, is this GPIO crucial for functioning or optional? > If the former, we need to stop here or bail out (if possible), do we? > Or should use _optional() API? I don't know and I do not have any hardware to test on. Though I'd assume the touchscreen would not work properly (if at all), so I'll add a return there. Regards, Duje
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 94bcb187713b..1e38069e75f7 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -520,12 +520,14 @@ static inline void spitz_leds_init(void) {} * SSP Devices ******************************************************************************/ #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) +static struct gpio_desc *hsync = NULL; + static void spitz_ads7846_wait_for_hsync(void) { - while (gpio_get_value(SPITZ_GPIO_HSYNC)) + while (gpiod_get_value(hsync)) cpu_relax(); - while (!gpio_get_value(SPITZ_GPIO_HSYNC)) + while (!gpiod_get_value(hsync)) cpu_relax(); } @@ -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), { } }, }; @@ -622,6 +626,9 @@ 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); + if (IS_ERR(hsync)) + pr_err("Failed to get hsync GPIO: %ld\n", PTR_ERR(hsync)); pxa2xx_set_spi_info(2, &spitz_spi_info); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); }
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> --- arch/arm/mach-pxa/spitz.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)