From patchwork Tue Sep 26 15:46:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Duje_Mihanovi=C4=87?= X-Patchwork-Id: 13399319 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6F6B30CFB for ; Tue, 26 Sep 2023 15:46:38 +0000 (UTC) Received: from mx.skole.hr (mx1.hosting.skole.hr [161.53.165.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB5C11F; Tue, 26 Sep 2023 08:46:37 -0700 (PDT) Received: from mx1.hosting.skole.hr (localhost.localdomain [127.0.0.1]) by mx.skole.hr (mx.skole.hr) with ESMTP id E0EC982367; Tue, 26 Sep 2023 17:46:35 +0200 (CEST) From: =?utf-8?q?Duje_Mihanovi=C4=87?= Date: Tue, 26 Sep 2023 17:46:26 +0200 Subject: [PATCH RFC v2 5/6] ARM: pxa: Convert Spitz hsync to GPIO descriptors Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230926-pxa-gpio-v2-5-984464d165dd@skole.hr> References: <20230926-pxa-gpio-v2-0-984464d165dd@skole.hr> In-Reply-To: <20230926-pxa-gpio-v2-0-984464d165dd@skole.hr> To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Alan Stern , Greg Kroah-Hartman , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Duje_Miha?= =?utf-8?q?novi=C4=87?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1744; i=duje.mihanovic@skole.hr; h=from:subject:message-id; bh=iDSRsRvbtFOxQFJcaMgRFqBD4OPrnaTiwiEd2g9ViUU=; b=owEBbQKS/ZANAwAIAZoRnrBCLZbhAcsmYgBlEvzWvKOK8Jgrv8cV8mXpPyIo+QydjhrRFeCDN +7WkkTkiXqJAjMEAAEIAB0WIQRT351NnD/hEPs2LXiaEZ6wQi2W4QUCZRL81gAKCRCaEZ6wQi2W 4dpyEAChUkA0UQoq4DsrWVZ3WmVhlrOJNsEfCtKC4QnJLAgF/mpUu2DRVgIUDwTq89eEU2+m1/l VTF7nmWilyWNZeqaeGMRvQ9XGkoG9Iah2fCtL2JWAZbY29qdilEli4/YFWpiQOl5TN/ePfsG5dl WugaqopM4eIQtgaG17n9x0VC9M/M4AxD9jaMIsAbzanPKnY8RMIn9956lBz92kK13KVgdFuTX5J uZUbTQbgpUeP4DKJIkQ61DJkwcgN0l4RO3e/SYdzS5/dk0lZN7IYgLCCwHLo/mepyYDOKmBzUOi j/FtoDl0A/bephgd6M6hjovOLLuSyHZVqnuPeYz+Z61vHJ+UB3Lk5OKl5U/PTSR9ueCXwgn0TTx HDTp9qwvO7ivldg/O4zNqYRvBks8DB+Jr7fbVoDuIVJ2qtqlFrCN82bNeMGcfNphPkQXg/9Pe73 /HrRyqe0+Q5/C1xK8/eSSuoZXYF13r/LkbVL1Yle33DX4C/3VtIjoEpxCZG5f89q28WXDpHHze4 suYScWGXap094Jf0ekO8XPUUHAF1fhcYue840XzrC0hJGiSGz3n7fdWz15F+jd4cTbp9maM0EOx PmRpAM8+Pj/d8Pv2r6meeoA6i6LihaiAqFPPncuOAwJRnZseMNvRLKUCGM2foux/FmXeU/eVMhy psZq92FP0XzOeCQ== X-Developer-Key: i=duje.mihanovic@skole.hr; a=openpgp; fpr=53DF9D4D9C3FE110FB362D789A119EB0422D96E1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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ć --- arch/arm/mach-pxa/spitz.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 94bcb187713b..5c8f497b71ec 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,11 @@ 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)); + return; + } pxa2xx_set_spi_info(2, &spitz_spi_info); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); }