From patchwork Fri Jun 28 18:08:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93C1AC30658 for ; Fri, 28 Jun 2024 18:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1UaptWOE/d6S6pBZfH91tBCmSGK27RbRnUptUO4PI8g=; b=LX/PYoVGSHjSbcK5XmDw6sODJi 0xhzRV8N3N6tzz4fLwt8H8UARlT3k3IfsCz7AhlOhMSDhDm/bjmaCjWJHZHXry2V/cLZtJO6PFzZ9 FlCtsOifRHZHDp1aksyr+qVr3DhQHkR4zYUwLzP5JOGg06DJbmQAgu9avBg6ejDeX2whjgZgmYB00 HsYt1xPlAdertQ2ZF9qkFIASuKTfGXJJwkeoIoViOWEMooiCWMI14WRg6Qplc1M5aLY0gQnP+n1M5 ncLnGSuPgF9sFYRemAmqCcX0e8Fg5l/MKwZMhycYFj/OGttWiGcT7Z0leIBFb+xIdQ3jaU2pM2pKX ZHyh5U5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG3J-0000000Eaxo-3a8w; Fri, 28 Jun 2024 18:10:29 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG25-0000000EaHj-3gRn for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:15 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-70699b6afddso754808b3a.1 for ; Fri, 28 Jun 2024 11:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598153; x=1720202953; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1UaptWOE/d6S6pBZfH91tBCmSGK27RbRnUptUO4PI8g=; b=aPOlMryUL6v4mcemEAHznDF8BH5RhlN0ZQDT9UrGNGD+hljaUk/3sDE7KMUaLxf4Y1 L3DDEp4ozicIDMViJLYoKburn91Co1jwALrQBgFEU9yFpJecdIp6aDVGgJhA8EOsz/pt lIllJSRmRCQaMAvrtda9OuXeC5jbgpBd1JvcItZnyJ+vws8ioyKxAv/gMkvZNlK3E/dx dKAl7oNV9Dj6Kj7SUGh5CD2p8eA8kGJHXDi2DJcHxkPQu8bWqhjo3rU5o6GVxCqq9LRe X+r6FPi4kdHgnaBKPba0dhQK0ztJp8xQqGA4Nm3i8Angh+H+uFRXlLx7FBtSwouUEWFd bSnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598153; x=1720202953; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1UaptWOE/d6S6pBZfH91tBCmSGK27RbRnUptUO4PI8g=; b=ksOvnIFTHQB0C+UlXlm63tRHfGjJ0UyIHmiKT8bG9uUVTvbDaM33pAGGq5lsk5iEYV uB1eoUqd0lecPXoeDqf3+6MXEAmmAfjoZFujGXqI5vAO/L/0QwoBl06txljlr4YY3O7E z7ycU7OcEKuSGzXJ6EkO1380g4ThNZ2Je12blJpxT+jmLvJD10TkeomxAZ2q1t6wSEqt 1DvmGHLtEJBre1axTRhCTdDiHCCcwoT+k7/xqCfqrLmvX864or+kJteGSfJuRhJ/+5JF 9s76o5vQOyExgEynFD+YWr+YOClDMcIPne4Y0SMOJev+lPtGjMF8aeEXTO8byJLUklS8 +Svw== X-Gm-Message-State: AOJu0YxrSDib17qe9RKaooYOK8MLLnpghKZVR+BUXEC6aCGCC5rngUGA 5kqibSJtQjnCetcgASD9qPA9oaGeMfUXnv5Pay+I3dmYRQbZKlUX X-Google-Smtp-Source: AGHT+IEo27gQsi1ZqtXMWNPG5YGN57sEOTwCgh0eIFUABFtz/d5KvfYYUSc8KC42EYmSwAdXlE8ycw== X-Received: by 2002:a05:6a00:884:b0:705:940a:c80e with SMTP id d2e1a72fcca58-70670e7a740mr22843851b3a.3.1719598152869; Fri, 28 Jun 2024 11:09:12 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:c929:2998:720d:a104]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7080295d1f4sm1982911b3a.91.2024.06.28.11.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:12 -0700 (PDT) From: Dmitry Torokhov To: Haojian Zhuang , Daniel Mack , Robert Jarzmik , Arnd Bergmann , Linus Walleij , soc@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/10] ARM: spitz: Use software nodes for the ADS7846 touchscreen Date: Fri, 28 Jun 2024 11:08:50 -0700 Message-ID: <20240628180852.1738922-11-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog In-Reply-To: <20240628180852.1738922-1-dmitry.torokhov@gmail.com> References: <20240628180852.1738922-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_110913_951791_CE2A131C X-CRM114-Status: GOOD ( 18.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Linus Walleij Convert the Spitz to use software nodes to describe GPIOs for the ADS7846 touchscreen. As part of the conversion switch from the custom wait_for_sync() callback to defining hsync GPIO that can be used by the ads7846 driver to detect hsync. Signed-off-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/spitz.c | 40 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index b19d4ed35192..452bf7aac1fa 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -534,31 +534,23 @@ static inline void spitz_leds_init(void) {} * SSP Devices ******************************************************************************/ #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) -static void spitz_ads7846_wait_for_hsync(void) -{ - while (gpio_get_value(SPITZ_GPIO_HSYNC)) - cpu_relax(); - - while (!gpio_get_value(SPITZ_GPIO_HSYNC)) - cpu_relax(); -} -static struct ads7846_platform_data spitz_ads7846_info = { - .model = 7846, - .vref_delay_usecs = 100, - .x_plate_ohms = 419, - .y_plate_ohms = 486, - .pressure_max = 1024, - .wait_for_sync = spitz_ads7846_wait_for_hsync, +static const struct property_entry spitz_ads7846_props[] = { + PROPERTY_ENTRY_STRING("compatible", "ti,ads7846"), + PROPERTY_ENTRY_U32("touchscreen-max-pressure", 1024), + PROPERTY_ENTRY_U16("ti,x-plate-ohms", 419), + PROPERTY_ENTRY_U16("ti,y-plate-ohms", 486), + PROPERTY_ENTRY_U16("ti,vref-delay-usecs", 100), + PROPERTY_ENTRY_GPIO("pendown-gpios", &pxa2xx_gpiochip_node, + SPITZ_GPIO_TP_INT, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_GPIO("ti,hsync-gpios", &pxa2xx_gpiochip_node, + SPITZ_GPIO_HSYNC, GPIO_ACTIVE_LOW), + { } }; -static struct gpiod_lookup_table spitz_ads7846_gpio_table = { - .dev_id = "spi2.0", - .table = { - GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_TP_INT, - "pendown", GPIO_ACTIVE_LOW), - { } - }, +static const struct software_node spitz_ads7846_swnode = { + .name = "ads7846", + .properties = spitz_ads7846_props, }; static const struct property_entry spitz_lcdcon_props[] = { @@ -595,7 +587,7 @@ static struct spi_board_info spitz_spi_devices[] = { .max_speed_hz = 1200000, .bus_num = 2, .chip_select = 0, - .platform_data = &spitz_ads7846_info, + .swnode = &spitz_ads7846_swnode, .irq = PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT), }, { .modalias = "corgi-lcd", @@ -638,8 +630,6 @@ static void __init spitz_spi_init(void) struct platform_device *pd; int err; - gpiod_add_lookup_table(&spitz_ads7846_gpio_table); - pd = platform_device_register_full(&spitz_spi_device_info); err = PTR_ERR_OR_ZERO(pd); if (err)