From patchwork Tue Apr 30 07:03:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13648365 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 9AF61C25B10 for ; Tue, 30 Apr 2024 07:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Fur6CFDPb9H4Yz5TFx278nE81UdbiGf79zcAWjhXEhM=; b=kHNOa9K+Ww6WF0 sESyUU7KS6uFsMSFPnhJsnXghKNxCXP84JUIZb9bKp3xWxdWgFFo4jh2m4SKMtOPViXQypYbO/UCv v+SfiC80HwDKOCejzZCvjH7sUNxWbbIr/nnKVMorEFyxrpSOuG2RNwNRTzfyNlB/kjWGFmJnH/t7N fkamKUO32gDoNZFcgEI+N4TEDAHi0S8XEsPz7Y/4AJwfHY46HUIUT2bqPa/gayUT9KyGIoaAlvHnN +3fm/qkrHVhXmwYaULxnqKcmNNICrdgtZmUDR7rsNJ+z2T/Ognq27C2gnr9t2Ecm9YS/0jKEL5m7P GDd82IZP64H91jwt8Jrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1hX6-00000005N0t-14D6; Tue, 30 Apr 2024 07:04:08 +0000 Received: from mail-yw1-x1135.google.com ([2607:f8b0:4864:20::1135]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1hWu-00000005MwM-26Pa for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2024 07:03:57 +0000 Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-61500da846fso35726727b3.1 for ; Tue, 30 Apr 2024 00:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714460634; x=1715065434; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=h0ixy7fv19ExAcreEswXg94DycLU86SeU2ojNLlxijk=; b=QtH8bCGMtetFSUMb+v6YtqQlHuamOuxVtMTalN4cq93ugNqiW5Exaxcb5MgrB6wkQu mEWg2wV8l7OmwKpkwpHzD6E0WfBFxrgjMEMV7O8EUsrr2vkDxQ+xof5L8catN59Vf0Rc kQHMA5izb5RwZ7pRKo1HzDK8Uz1ozu7ZFL9xtMv+qNrXbT92W0neJZzw2UAeuZQ/IWbZ cMSDOCB+objRIgQ2ly91BjupH6wMq5GuMK7xYEppT5Tl2MtEhNICgalY4Ubtc/TokIEd UJcpJX70X3ZcA1Qr1RSa4ldl3/+yAdrZ39ZQIQUG3qPrce+GM1j3kcNwrsAuIqUg/B4o 54SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714460634; x=1715065434; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h0ixy7fv19ExAcreEswXg94DycLU86SeU2ojNLlxijk=; b=nUApqs4qq+Z4Vx4B6NBPQdvhefuUtJAHxq+Q3QERb+OOGerTB/YAWr+eFqFnHBkimy hn+KxeNNoghY1Uh2OgqrHJLNsjAIT4nmE0Acv+F0CnwsE55QL10SlOfrmluGY3VuJQgM Q0oMRj8mZZl/XA+Ob6bYPT7/F4mLgmCRe+2V60Lx3gUlmSUVCaqxu3jIVM79vyk6JdU5 TE1LAt37bHRhnGMt75hNCFFTuscNMzryMPZytlfMIn65bcXIyueGbb542k+mglIW3AY3 sMrs9PmCtqL+QLRmIXcE1QgXigCMCVnIzPPIf8PJnAfG4vM8C9QtLsZ1C+4hR6dW9vy7 cOhw== X-Gm-Message-State: AOJu0YzpntcigqxMMHf5Y9biEBdxunUsRIrLHknWAGcCXdkXgCHFd+/M np+6hTnI3YjNVVkp53WP+18PDsNPt2gIh/w6oPQDVF6G2zzIYiq6NGHvsBVRvFM= X-Google-Smtp-Source: AGHT+IFhrTYVyGAxSgGpphlVFdD7358nVt142kj/csynXWwvRVabPFRJKNRP1Kglb24GmrH2zD4MsQ== X-Received: by 2002:a05:690c:e:b0:61a:d2a0:5497 with SMTP id bc14-20020a05690c000e00b0061ad2a05497mr14316415ywb.8.1714460634450; Tue, 30 Apr 2024 00:03:54 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id z11-20020a05622a124b00b00437b4048972sm10610674qtx.18.2024.04.30.00.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 00:03:53 -0700 (PDT) From: Linus Walleij Date: Tue, 30 Apr 2024 09:03:47 +0200 Subject: [PATCH 1/3] ARM: spitz: Convert Spitz board to GPIO descriptors for LEDs MIME-Version: 1.0 Message-Id: <20240430-gpio-leds-miscarm-v1-1-9c94d7711f6c@linaro.org> References: <20240430-gpio-leds-miscarm-v1-0-9c94d7711f6c@linaro.org> In-Reply-To: <20240430-gpio-leds-miscarm-v1-0-9c94d7711f6c@linaro.org> To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mark Brown Cc: linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-spi@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_000356_574541_EEEF5BDD X-CRM114-Status: GOOD ( 14.44 ) 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 This makes the LEDs on the PXA Spitz board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij --- arch/arm/mach-pxa/spitz.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index cc691b199429..36aec5ea7218 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -456,12 +456,21 @@ static struct gpio_led spitz_gpio_leds[] = { { .name = "spitz:amber:charge", .default_trigger = "sharpsl-charge", - .gpio = SPITZ_GPIO_LED_ORANGE, }, { .name = "spitz:green:hddactivity", .default_trigger = "disk-activity", - .gpio = SPITZ_GPIO_LED_GREEN, + }, +}; + +static struct gpiod_lookup_table spitz_gpio_leds_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LED_ORANGE, NULL, + 0, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LED_GREEN, NULL, + 1, GPIO_ACTIVE_HIGH), + { }, }, }; @@ -480,6 +489,7 @@ static struct platform_device spitz_led_device = { static void __init spitz_leds_init(void) { + gpiod_add_lookup_table(&spitz_gpio_leds_table); platform_device_register(&spitz_led_device); } #else From patchwork Tue Apr 30 07:03:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13648366 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 97AB8C4345F for ; Tue, 30 Apr 2024 07:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xg1h+7Ai+ev1hC+AZLy1bOkZUARACNXNKdoBi6VxYNM=; b=aMUwTjRcTb4WiP 8wAXUAFpY90pevX5QW35dT4VE44NaT20/roBAHIPSe9Y6C6oq8nqt2tQrE1au2ocTYL1b5j08FGJ2 TnXo1VRwOR7pqi9awomlf1HXjhLcPxyMVvT2D1hVR3lzW3f6kjUSQiPn+05pt95vZOh2ywJnExCaQ Il6L8nm23IRf91yfbAvR0TfVugvfKRmhlYqX9QUqvsvL9VSMSM0heuSXLa9e2lqjkla93OPTNf4FJ g4hTq/ZVLhJjeOKCE6c2T7qsBO7fFgNTPR35ZzBhVHYAOC59quw3T9YKxR3pIH/cJfSgPlwEphlOp f5XLRySnOkU/gOaBIJpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1hX6-00000005N1K-3joV; Tue, 30 Apr 2024 07:04:08 +0000 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1hWy-00000005MxI-2Iv7 for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2024 07:04:01 +0000 Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-43969307359so34497561cf.2 for ; Tue, 30 Apr 2024 00:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714460638; x=1715065438; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=hWNjW60aZKX5jQpzSVa+3L0ZlYdpkfiGuBdJTkw92uw=; b=c+bY3IWKF1vAfzXkoCa9EUL5H4NhTGJU20xOnqTyaTK1k68scK+WEQ1TIsJqvt/M2z WIa8vfJKEtNGFMJrTWYsrwvhVuwx/d7oWOJVktfNue1az7+/xAxyEAClX0Zii2MAGE9O FzM3/2yxNo/nk76d9ROSN/4dUB/N7no4c7b7BF/X8leTkYPijjb/vWSBnWyWPVjwB51D 8k9Z0CwiFfbLViROzpvVoXBaGb7rUDYpdTh+0mdlu/0LyPg1N5JI0JkQyjYxapfZfE0t 6sp7mlLLntE/SofIpXaXjCzQhW3CfvL8WKHAz0AdnWl1Ia6DePSkAKSVlVFcvh7eklhk u5Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714460638; x=1715065438; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hWNjW60aZKX5jQpzSVa+3L0ZlYdpkfiGuBdJTkw92uw=; b=OHDSixwG6G/G+TknFzXc3GDLJChZDL83+YoNAIrMffLmSJGnjZ0J/UxwMlGkd0ohap uY3JcEgbBDat3TahXoJqmnJl9epQub8kfHddD0yFYmELfeJB2EZBu9b7vRI1ooZpq/cn w98hSaYiEDfGKVoKQ+cjexz5Dz24TqFy+EQKHPftdwivjamE2N2BUTVmlvPioXjrKlWT DAKTmiX+rMWLZKrhaR3OPdMywnhcNF1hTFQ7haWsykhu3AM0axOEd6GOaEgN7nEsAHmw mMCpDeoyZiN8ftbgfEzVT2kq29YvXGjRKLfEk47rTF/NvLBHt4ddtCRhuDs1k3PFfccA 0isA== X-Gm-Message-State: AOJu0YyXBW+pNEMMD42c9+O9XXyyUzp0AxDbZtMyrmSREcoo4MoC4ax7 HjYCtm2gSe8l05H91tzSV96Fra12nYnSWctEE8k3KgEmidRZ4kgLFiLmPi0UIyA= X-Google-Smtp-Source: AGHT+IEU/3GWwmwnmPs3D59TLtthT2pwdifoVroVuPln6HkSH63EZK0OfBAJKGQNGC3Wl+aDomxINg== X-Received: by 2002:a05:622a:2c5:b0:43a:e716:ac3a with SMTP id a5-20020a05622a02c500b0043ae716ac3amr1631514qtx.63.1714460637882; Tue, 30 Apr 2024 00:03:57 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id z11-20020a05622a124b00b00437b4048972sm10610674qtx.18.2024.04.30.00.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 00:03:57 -0700 (PDT) From: Linus Walleij Date: Tue, 30 Apr 2024 09:03:48 +0200 Subject: [PATCH 2/3] dt-bindings: ads7846: Add hsync-gpios MIME-Version: 1.0 Message-Id: <20240430-gpio-leds-miscarm-v1-2-9c94d7711f6c@linaro.org> References: <20240430-gpio-leds-miscarm-v1-0-9c94d7711f6c@linaro.org> In-Reply-To: <20240430-gpio-leds-miscarm-v1-0-9c94d7711f6c@linaro.org> To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mark Brown Cc: linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-spi@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_000400_697291_6750B63D X-CRM114-Status: GOOD ( 12.43 ) 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 The TI ADS7846 emits a horizontal sync signal that is usually connected to a GPIO for polling. Add a binding for this. Signed-off-by: Linus Walleij Acked-by: Conor Dooley --- Documentation/devicetree/bindings/input/touchscreen/ads7846.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/ads7846.txt b/Documentation/devicetree/bindings/input/touchscreen/ads7846.txt index 81f6bda97d3c..399c87782935 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/ads7846.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/ads7846.txt @@ -57,6 +57,7 @@ Optional properties: pendown-gpio (u32). pendown-gpio GPIO handle describing the pin the !PENIRQ line is connected to. + ti,hsync-gpios GPIO line to poll for hsync wakeup-source use any event on touchscreen as wakeup event. (Legacy property support: "linux,wakeup") touchscreen-size-x General touchscreen binding, see [1]. From patchwork Tue Apr 30 07:03:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13648367 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 2D495C4345F for ; Tue, 30 Apr 2024 07:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QOjseZkOgzRxrnGrU/Zmg2lPdZaM7Ch0ijjDdRi8bOE=; b=0VCbrePJ24PfN9 J0v9P+v7Uz3/edEl1uhgarcaNl52XPIPIybJnZbMVK2rZwc7Mg5PqWDTDGYDH9Imf3wRgrLy21sj4 xOEq6yr7wZx5rAyMqh0rS/FYXB+xBzJ0XX6uR0+5bszWDiIBNnlLvg4j6848AFp2mhTbpyk7JDFGe nwLoTRIjOy2oY/I2jy7tyiFSmtwS54IVVQqYomTU2wROkepM+JFzUam6uk/Vkq9//yxPh51kNEUqX apkT/6IZ3VJRfCgr8e7g+6RNvt9ZIwWH+bI3SFf/oUOaBd++Ft64xbVOgda+jKpTu/GjuOAenQZOz arblBSpPJCNDJd1Oa3Bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1hX8-00000005N23-15Yp; Tue, 30 Apr 2024 07:04:10 +0000 Received: from mail-yw1-x112f.google.com ([2607:f8b0:4864:20::112f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1hWz-00000005Mxz-1nJf for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2024 07:04:02 +0000 Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-6181d032bf9so50737877b3.3 for ; Tue, 30 Apr 2024 00:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714460640; x=1715065440; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KoVXdJHVeZxp0h1BU5LvQei6P82WebLM3hF8pbM4pmY=; b=pQlHw229V7e3pyKC3Q6eij7Wrd1MEq+jsTCoiq/vCgMrtsc6+HeR/kk4kZXft/NxjW YnBtwo6dpuw6IByGSgEOoxfLqRfb94d7kXenCf6TBsEENi0UvlYFNoZvq/YQY+d5NmAe 6P960Aufde+mLuxw/qIa8nFi3VD6vQHwtkbYGhiSOHEw4LR6OS0Kybt6x52dsh5ufaNv fFucSPfq9qY2MRTtIWn4zFPSYRv1AP7QvTNsme4pgE1gjxJGV6Hzyw5XeUcPgWOSRUGq +8NIYuvxWcVWsoxmNIDMz/lmop6YIQQ+srfMTYwg3pIKmSigoZw/IifFPbLZWAE8h8G4 ZmRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714460640; x=1715065440; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KoVXdJHVeZxp0h1BU5LvQei6P82WebLM3hF8pbM4pmY=; b=MYMN2CfIoUtnH4epL9LpvOrjdpntuvUlP8rOuP7ZoWYv+QpfHs89DLLVdC+dWVYudw ++sB3IoJ6ox331ANJzzYkQryYlG/cL/GxcQOqdzGstDAFLY4a+9Y3eT1BHUPaLij9PRY GOSPi51g77hqDmoKROexCeGlwEbSSfVwfvriuMOYoZBCQMOdh9n0FoYrVezvmiJsapRh 6lSvwbgDYEg3gHqMkvtV7VVJw59tV0WZ/YinhJSj3mA/7LJ+aJhJkcCZcH4kiRb+tSU4 EYl/plcTLE6TXEtg8GDo6Ei4vmhE/lrwCN1jE+NCPNgzX+uqJkMzmySLls7zKbhk1l/e HHIA== X-Gm-Message-State: AOJu0YwYbTi8ufTt7ydDfqSNlQPmSJT2LUoq55h9v4vHD8LzvjoDh7TP 0H6RC/YXeX7nDxg9bbuakYSIpNbTXb+wgctTMJnn0sKZ902KMGuxkrDtU7JQVC8= X-Google-Smtp-Source: AGHT+IHXJG0jZ+ap33XuddrE18N0BzMWLMOPQO8fdp8ZhqWudDeBaHWjUjCu0mS4rRaJ83Ykfd81Tw== X-Received: by 2002:a05:690c:690f:b0:615:1413:95c1 with SMTP id if15-20020a05690c690f00b00615141395c1mr12191954ywb.19.1714460640536; Tue, 30 Apr 2024 00:04:00 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id z11-20020a05622a124b00b00437b4048972sm10610674qtx.18.2024.04.30.00.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 00:04:00 -0700 (PDT) From: Linus Walleij Date: Tue, 30 Apr 2024 09:03:49 +0200 Subject: [PATCH 3/3] ARM: spitz: Use software nodes for the ADS7846 touchscreen MIME-Version: 1.0 Message-Id: <20240430-gpio-leds-miscarm-v1-3-9c94d7711f6c@linaro.org> References: <20240430-gpio-leds-miscarm-v1-0-9c94d7711f6c@linaro.org> In-Reply-To: <20240430-gpio-leds-miscarm-v1-0-9c94d7711f6c@linaro.org> To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mark Brown Cc: linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-spi@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_000401_572744_43C798EC X-CRM114-Status: GOOD ( 28.83 ) 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 Convert the Spitz to use software nodes for SPI CS and the ADS7846 touchscreen following the pattern used in the TI platforms. The Spitz is the only user of the wait_for_sync() callback in the platform data, so define that this is a separate GPIO in the device tree bindings (previous patch) and handle this directly inside the ADS7846 driver instead. Add some infrastructure to the PXA boardfile common code to handle software nodes attached to the SPI bus instead of platform data. The SPI core will investigate the numner of GPIO handles to figure out the number of chipselects used on the platform, so no explicit encoding of the number of the number of chipselects is needed. Signed-off-by: Linus Walleij --- arch/arm/mach-pxa/devices.c | 16 ++++++++ arch/arm/mach-pxa/spitz.c | 75 +++++++++++++++++++------------------ drivers/input/touchscreen/ads7846.c | 31 ++++++++++----- include/linux/spi/ads7846.h | 1 - include/linux/spi/pxa2xx_spi.h | 2 + 5 files changed, 78 insertions(+), 47 deletions(-) diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 661b3fc43275..e0e21cb97f71 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "udc.h" @@ -682,6 +683,21 @@ void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_controller *info) platform_device_add(pd); } +void __init pxa2xx_set_spi_node(unsigned id, const struct property_entry *props) +{ + struct platform_device *pd; + + pd = platform_device_alloc("pxa2xx-spi", id); + if (pd == NULL) { + printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n", + id); + return; + } + + device_create_managed_software_node(&pd->dev, props, NULL); + platform_device_add(pd); +} + static struct resource pxa_dma_resource[] = { [0] = { .start = 0x40000000, diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 36aec5ea7218..bc93ceed0022 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,7 @@ #include #include #include +#include #include #include @@ -128,6 +130,15 @@ static unsigned long spitz_pin_config[] __initdata = { GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ }; +static const struct software_node pxa_gpiochip_node = { + .name = "gpio-pxa", +}; + +static const struct software_node *spitz_gpiochip_nodes[] = { + &pxa_gpiochip_node, + /* TODO: add the GPIO expander nodes here */ + NULL +}; /****************************************************************************** * Scoop GPIO expander @@ -500,31 +511,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", &pxa_gpiochip_node, + SPITZ_GPIO_TP_INT, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_GPIO("ti,hsync-gpios", &pxa_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 struct gpiod_lookup_table spitz_lcdcon_gpio_table = { @@ -563,8 +566,7 @@ static struct spi_board_info spitz_spi_devices[] = { .max_speed_hz = 1200000, .bus_num = 2, .chip_select = 0, - .platform_data = &spitz_ads7846_info, - .irq = PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT), + .swnode = &spitz_ads7846_swnode, }, { .modalias = "corgi-lcd", .max_speed_hz = 50000, @@ -579,18 +581,18 @@ static struct spi_board_info spitz_spi_devices[] = { }, }; -static struct pxa2xx_spi_controller spitz_spi_info = { - .num_chipselect = 3, +static const struct software_node_ref_args spitz_spi_gpio_refs[] = { + SOFTWARE_NODE_REFERENCE(&pxa_gpiochip_node, SPITZ_GPIO_ADS7846_CS, + GPIO_ACTIVE_LOW), + SOFTWARE_NODE_REFERENCE(&pxa_gpiochip_node, SPITZ_GPIO_LCDCON_CS, + GPIO_ACTIVE_LOW), + SOFTWARE_NODE_REFERENCE(&pxa_gpiochip_node, SPITZ_GPIO_MAX1111_CS, + GPIO_ACTIVE_LOW), }; -static struct gpiod_lookup_table spitz_spi_gpio_table = { - .dev_id = "spi2", - .table = { - GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_MAX1111_CS, "cs", 2, GPIO_ACTIVE_LOW), - { }, - }, +static const struct property_entry spitz_spi_props[] = { + PROPERTY_ENTRY_REF_ARRAY("gpios", spitz_spi_gpio_refs), + { } }; static void __init spitz_spi_init(void) @@ -600,9 +602,7 @@ static void __init spitz_spi_init(void) else gpiod_add_lookup_table(&spitz_lcdcon_gpio_table); - gpiod_add_lookup_table(&spitz_ads7846_gpio_table); - gpiod_add_lookup_table(&spitz_spi_gpio_table); - pxa2xx_set_spi_info(2, &spitz_spi_info); + pxa2xx_set_spi_node(2, spitz_spi_props); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); } #else @@ -1007,6 +1007,7 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd) static void __init spitz_init(void) { + software_node_register_node_group(spitz_gpiochip_nodes); init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0); pm_power_off = spitz_poweroff; diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index d2bbb436a77d..af02f70e66fc 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -138,8 +138,7 @@ struct ads7846 { void *filter_data; int (*get_pendown_state)(void); struct gpio_desc *gpio_pendown; - - void (*wait_for_sync)(void); + struct gpio_desc *gpio_hsync; }; enum ads7846_filter { @@ -634,10 +633,6 @@ ATTRIBUTE_GROUPS(ads784x); /*--------------------------------------------------------------------------*/ -static void null_wait_for_sync(void) -{ -} - static int ads7846_debounce_filter(void *ads, int data_idx, int *val) { struct ads7846 *ts = ads; @@ -790,6 +785,23 @@ static int ads7846_filter(struct ads7846 *ts) return 0; } +static void ads7846_wait_for_hsync(struct ads7846 *ts) +{ + if (!ts->gpio_hsync) + return; + + /* + * Wait for HSYNC to assert the line should be flagged + * as active low so here we are waiting for it to assert + */ + while (!gpiod_get_value(ts->gpio_hsync)) + cpu_relax(); + + /* Then we wait for it do de-assert */ + while (gpiod_get_value(ts->gpio_hsync)) + cpu_relax(); +} + static void ads7846_read_state(struct ads7846 *ts) { struct ads7846_packet *packet = ts->packet; @@ -800,8 +812,7 @@ static void ads7846_read_state(struct ads7846 *ts) packet->last_cmd_idx = 0; while (true) { - ts->wait_for_sync(); - + ads7846_wait_for_hsync(ts); m = &ts->msg[msg_idx]; error = spi_sync(ts->spi, m); if (error) { @@ -1258,7 +1269,9 @@ static int ads7846_probe(struct spi_device *spi) ts->penirq_recheck_delay_usecs = pdata->penirq_recheck_delay_usecs; - ts->wait_for_sync = pdata->wait_for_sync ? : null_wait_for_sync; + ts->gpio_hsync = devm_gpiod_get_optional(dev, "ti,hsync", GPIOD_IN); + if (IS_ERR(ts->gpio_hsync)) + return PTR_ERR(ts->gpio_hsync); snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev)); snprintf(ts->name, sizeof(ts->name), "ADS%d Touchscreen", ts->model); diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h index a04c1c34c344..fa7c4f119023 100644 --- a/include/linux/spi/ads7846.h +++ b/include/linux/spi/ads7846.h @@ -38,7 +38,6 @@ struct ads7846_platform_data { int gpio_pendown_debounce; /* platform specific debounce time for * the gpio_pendown */ int (*get_pendown_state)(void); - void (*wait_for_sync)(void); bool wakeup; unsigned long irq_flags; }; diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h index ca2cd4e30ead..d166d4469fec 100644 --- a/include/linux/spi/pxa2xx_spi.h +++ b/include/linux/spi/pxa2xx_spi.h @@ -6,6 +6,7 @@ #define __LINUX_SPI_PXA2XX_SPI_H #include +#include #include #include @@ -50,6 +51,7 @@ struct pxa2xx_spi_chip { #include extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_controller *info); +void pxa2xx_set_spi_node(unsigned id, const struct property_entry *props); #endif