From patchwork Fri Jun 28 18:08:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716489 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 1806CC2BD09 for ; Fri, 28 Jun 2024 18:09:32 +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=BBCvkVyfkbdo7pnt4Aoi2nCfq7+jAcbsmUlNqiZyQyk=; b=ZCg9c/zCGD4GMF2bbHEO5+mF/Z aYJlMKzVW3Q+Be7CgFR+aBUB3KKotYlsP5w7YCx3BewXdwXLGF9SjdhqdqYbsiraduNZ8UiglCcOc ExQ+25Z0+H+A/v2wP9TxVcw0YeZWuzEbvdw83zeIWM2+Hy3v1TGgUU/QkbBGTy9hz/pBi+sve4XZX 24TlI9V0f33VRlAlo2V0c44Pb1u9kzBxHSwOD8dw29HYhLl8zeDR+WtbiKAFADKLePiZRUKnY+4/G AM4F14EEBkEWZg7wjdyKTfYfJn9TdHQKLVCCq8QireoMOAnTZGQX6Py2SApwY4SJxPywd160sfI9J lpSdxviQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2B-0000000EaKB-2n4Y; Fri, 28 Jun 2024 18:09:19 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG1w-0000000EaCr-1HFi for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:05 +0000 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-652fd0bb5e6so593167a12.0 for ; Fri, 28 Jun 2024 11:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598143; x=1720202943; 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=BBCvkVyfkbdo7pnt4Aoi2nCfq7+jAcbsmUlNqiZyQyk=; b=F90Oj86QYYeyYWp6yT1rm5+InNDOmd04zXZr4/G1KOz7FxUZUFWms6FgVDbRnvqlUX 1uVk39e/srZZJ3KZ/K3pdAxYxJdejlP2VgBCqVppj6vL9l77rNLAS/QUQBNGGIRa4bXd whJ+Q+vY0Ink1vNnhJ/nnpUI/opJSPN5oY8lrKnipssSv432iLZWK2CJR7mS6pRt8K+K nWbbLLphv+GxcG6t0pcgpJgJToo6yY24IagrOuM40aDgDfDkl0iRxkHjWeU3icBildzs bH9hblcofFZjN4VE1j6+MKK0xa3bZP8Yv67OVJIEPItPt9ZBiQ7y6gigKl1JDFmWV7pi 1FaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598143; x=1720202943; 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=BBCvkVyfkbdo7pnt4Aoi2nCfq7+jAcbsmUlNqiZyQyk=; b=MnzvRZA4tQSoeyBNRlz+YofNk2A+z5gJdMiTm2CKiI5g2VIA/VNNJ2q3rxp5Oj9Yx5 RMq/ElfNNFsT5jLGwmyW5VYWG4TMTZDgzDxPhzVwKFL0blMLGH6cm9GoEQp70+eVudZz xH/EFfkvugOvX5V6hMApTy6Q/OU8JqjhMo60W7akOPIXwWgKwcX1PVuN4z1359Ruz93+ p5XDK9mOJDVLwO3OSGQd6xZ27KkbnfeWrZqH8KVlf+dya5Z4U0tUS8XdiG2OPnJgzrxm CBoxgJ/pSSgU+e/ZKCdhX0t5tB05FVMALjbpgEnpcAbfQz/ThyBB2BIOs7zFzrdNUEE5 sZmw== X-Gm-Message-State: AOJu0YxgW1Dx9ZJa0CV2hD6O5t3vupbiX+wcsT+HJVxcDO/syGIXoD5o fn0m5IDQIFuPkRRXEYWeq5PyHYuqPB9lckJr9JbF7593S2HNIN38 X-Google-Smtp-Source: AGHT+IGwdjUnAxnrdNhQ33UTdibVtsjtn7lXpV2d4m+C6E3UaoUTdQmOGIj57QB+hbO2gd1xcDLN7w== X-Received: by 2002:a05:6a20:3ca1:b0:1be:c699:6aea with SMTP id adf61e73a8af0-1bec6996ff2mr9156618637.47.1719598143323; Fri, 28 Jun 2024 11:09:03 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:02 -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 01/10] ARM: spitz: fix GPIO assignment for backlight Date: Fri, 28 Jun 2024 11:08:41 -0700 Message-ID: <20240628180852.1738922-2-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_110904_364571_78E61105 X-CRM114-Status: GOOD ( 12.93 ) 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 GPIOs controlling backlight on Spitz and Akita are coming from GPIO expanders, not the pxa27xx-gpio block, correct it. Additionally GPIO lookup tables operate with pin numbers rather than legacy GPIO numbers, fix that as well. Use raw numbers instead of legacy GPIO names to avoid confusion. Fixes: ee0c8e494cc3 ("backlight: corgi: Convert to use GPIO descriptors") Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/spitz.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 3c5f5a3cb480..10ab16dcd827 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -520,10 +520,8 @@ static struct gpiod_lookup_table spitz_ads7846_gpio_table = { static struct gpiod_lookup_table spitz_lcdcon_gpio_table = { .dev_id = "spi2.1", .table = { - GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_CONT, - "BL_CONT", GPIO_ACTIVE_LOW), - GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_ON, - "BL_ON", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("sharp-scoop.1", 6, "BL_CONT", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("sharp-scoop.1", 7, "BL_ON", GPIO_ACTIVE_HIGH), { }, }, }; @@ -531,10 +529,8 @@ static struct gpiod_lookup_table spitz_lcdcon_gpio_table = { static struct gpiod_lookup_table akita_lcdcon_gpio_table = { .dev_id = "spi2.1", .table = { - GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_CONT, - "BL_CONT", GPIO_ACTIVE_LOW), - GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_ON, - "BL_ON", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("i2c-max7310", 3, "BL_ON", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("i2c-max7310", 4, "BL_CONT", GPIO_ACTIVE_LOW), { }, }, }; @@ -964,12 +960,9 @@ static inline void spitz_i2c_init(void) {} static struct gpiod_lookup_table spitz_audio_gpio_table = { .dev_id = "spitz-audio", .table = { - GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_L - SPITZ_SCP_GPIO_BASE, - "mute-l", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R - SPITZ_SCP_GPIO_BASE, - "mute-r", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("sharp-scoop.1", SPITZ_GPIO_MIC_BIAS - SPITZ_SCP2_GPIO_BASE, - "mic", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("sharp-scoop.1", 8, "mic", GPIO_ACTIVE_HIGH), { }, }, }; @@ -977,12 +970,9 @@ static struct gpiod_lookup_table spitz_audio_gpio_table = { static struct gpiod_lookup_table akita_audio_gpio_table = { .dev_id = "spitz-audio", .table = { - GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_L - SPITZ_SCP_GPIO_BASE, - "mute-l", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R - SPITZ_SCP_GPIO_BASE, - "mute-r", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("i2c-max7310", AKITA_GPIO_MIC_BIAS - AKITA_IOEXP_GPIO_BASE, - "mic", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("i2c-max7310", 2, "mic", GPIO_ACTIVE_HIGH), { }, }, }; From patchwork Fri Jun 28 18:08:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716490 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 B3466C2BD09 for ; Fri, 28 Jun 2024 18:09:35 +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=up/qg8WDCqy4xhIoMEE6lkWQO4HcB5nnKXIU51pcsyE=; b=fdmctO71za59XPUWjgdC7dB2Uc MjefwONGLRELECPa7xWjQiKkltCBp0ay7rMhDDlv7tmagXHZGLbopqYhVgFN6JRklx/hGgVVeh0K8 77x8+rB90cp9DiF7yZxha4cpbE6dz2zvX+5kztPkUKsthj9L779YO8HLxn8adczmVkFXJpGHXed5M NRLOlBYRMhUlhJRITSCQObYjwo8hgDqdiRrZzCon/rsJBwaP+Y5G2xeUXymK1sch3tBycZhDuRl8R 5Lr6BxS7zMzqqNz98y30Vp4ACzKKAkO0wOodpYuWqVRBsAX+9J+mibfRdsjcybbZU9lfIYTr3P3yH xjkWbNyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2I-0000000EaMn-1pyu; Fri, 28 Jun 2024 18:09:26 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG1x-0000000EaDC-169a for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:06 +0000 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-70685ab8fb1so700856b3a.2 for ; Fri, 28 Jun 2024 11:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598144; x=1720202944; 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=up/qg8WDCqy4xhIoMEE6lkWQO4HcB5nnKXIU51pcsyE=; b=bBOEmqZt5SjyobmsqDDtC0vmV8ceH+XvwiGYwhY1qv1kSJBGiW8i9HnFawDbf+zbkt YajhqPJwYeDAHvVisKoIXWKUoyd1ohYkNZG3Xh9k6tb1A4sVXPeOgzeqSatICTWeLmFJ 6G16rFV/dSRRSdpJf+1vaSu6qkJAdv1q/MGZZV5RL1s5vwmckpmKYdQycNUaLBkxlFrJ xJLE9oiwHcky/rv5GZ4R0pJ62DlSsDHYFoKElXYyEYHAY9yE950uZK79w8WMn5rQL4Fo 4u3CcgBab8FZ5Eis4XRJ6jIDUFaLXleqYHv3yaCkQP/VKJI3EWngYRTLGc2Ujh4yK6f+ +91w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598144; x=1720202944; 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=up/qg8WDCqy4xhIoMEE6lkWQO4HcB5nnKXIU51pcsyE=; b=bPCSWjTOPARXoY3Wp1EVohtDW7nDpLTVlKnCP1iZkl/JPtuPrlBbtFWGoWSmjiswN8 NRrR80Pd5gr73E+fE5uh8ovFd+0rMeyQw/igVl8WoP+GWpj2Al5jbZnAjmrOph0LaFLr eobDthnx81RkHIgvaDK7FwrSo9zNi8oSu/nriwssoKEJO9GayN4WRmI4KDs42i6iY8lK ML3uBoMUWfJVwaRAOD/WVEX8y3sw3uOizvk27ymiXMPKbJ5fV/vCe0Xivni/YW6jw+mD X/btiUWwRkHRkgChxveYxtZSxKQf3qJkbQKsxFfX0TewI1qzsamccV0na/koRcrEa9NU Sy0A== X-Gm-Message-State: AOJu0YzuCSMu2p5lCevj5bCS2E7+Amlpy0hHQ5UJEal0sSfeYnAGEej1 fJRNj/qXymSCFBZXQxpqsnpVjZRpwqSqC35lo4vo3wvX/j7JceROFgUxyg== X-Google-Smtp-Source: AGHT+IHl5Hkg3zTbLOFzM8iN/UjEZ0JCZYz7drxxPW4g1Ndh3zPD3L4duozHiDSYrQjf9NwirFH/xA== X-Received: by 2002:a05:6a20:6a90:b0:1bd:91aa:79a0 with SMTP id adf61e73a8af0-1bd91aa7a7dmr8588298637.12.1719598144351; Fri, 28 Jun 2024 11:09:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:04 -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 02/10] ARM: pxa: consolidate GPIO chip platform data Date: Fri, 28 Jun 2024 11:08:42 -0700 Message-ID: <20240628180852.1738922-3-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_110905_322332_A994D941 X-CRM114-Status: GOOD ( 18.33 ) 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 platform data for the GPIO controllers for the boards using non-DT setup is the same between PXA25x (gumstix) and PXA27x (Spitz) devices. Move it into devices.c to consolidate code. It will help with conversion to software nodes/properties. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/devices.c | 13 +++++++++++++ arch/arm/mach-pxa/pxa25x.c | 7 +------ arch/arm/mach-pxa/pxa27x.c | 8 +------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 1e4cd502340e..7cc6db2d1615 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -17,6 +18,7 @@ #include #include +#include "mfp-pxa2xx.h" #include "regs-ost.h" #include "reset.h" #include "devices.h" @@ -650,11 +652,19 @@ struct resource pxa_resource_gpio[] = { }, }; +static struct pxa_gpio_platform_data pxa2xx_gpio_info = { + .irq_base = PXA_GPIO_TO_IRQ(0), + .gpio_set_wake = gpio_set_wake, +}; + struct platform_device pxa25x_device_gpio = { .name = "pxa25x-gpio", .id = -1, .num_resources = ARRAY_SIZE(pxa_resource_gpio), .resource = pxa_resource_gpio, + .dev = { + .platform_data = &pxa2xx_gpio_info, + }, }; struct platform_device pxa27x_device_gpio = { @@ -662,6 +672,9 @@ struct platform_device pxa27x_device_gpio = { .id = -1, .num_resources = ARRAY_SIZE(pxa_resource_gpio), .resource = pxa_resource_gpio, + .dev = { + .platform_data = &pxa2xx_gpio_info, + }, }; static struct resource pxa_dma_resource[] = { diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index 02712d24be82..2ab3d8d66466 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c @@ -178,12 +178,8 @@ void __init pxa25x_map_io(void) pxa25x_get_clk_frequency_khz(1); } -static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = { - .irq_base = PXA_GPIO_TO_IRQ(0), - .gpio_set_wake = gpio_set_wake, -}; - static struct platform_device *pxa25x_devices[] __initdata = { + &pxa25x_device_gpio, &pxa25x_device_udc, &pxa_device_pmu, &pxa_device_i2s, @@ -244,7 +240,6 @@ static int __init pxa25x_init(void) if (!of_have_populated_dt()) { pxa2xx_set_dmac_info(&pxa25x_dma_pdata); - pxa_register_device(&pxa25x_device_gpio, &pxa25x_gpio_info); ret = platform_add_devices(pxa25x_devices, ARRAY_SIZE(pxa25x_devices)); } diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index d71491e2e1d6..b135b9ef665c 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -276,12 +276,8 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info) pxa_register_device(&pxa27x_device_i2c_power, info); } -static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = { - .irq_base = PXA_GPIO_TO_IRQ(0), - .gpio_set_wake = gpio_set_wake, -}; - static struct platform_device *devices[] __initdata = { + &pxa27x_device_gpio, &pxa27x_device_udc, &pxa_device_pmu, &pxa_device_i2s, @@ -345,8 +341,6 @@ static int __init pxa27x_init(void) register_syscore_ops(&pxa2xx_mfp_syscore_ops); if (!of_have_populated_dt()) { - pxa_register_device(&pxa27x_device_gpio, - &pxa27x_gpio_info); pxa2xx_set_dmac_info(&pxa27x_dma_pdata); ret = platform_add_devices(devices, ARRAY_SIZE(devices)); From patchwork Fri Jun 28 18:08:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716491 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 3DFE9C30658 for ; Fri, 28 Jun 2024 18:09:45 +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=iPjL6ORxfcbcSywP6tXKN3XgBVxZ1+LizFBx1kUWvpM=; b=vCanYrO/bBHr9ZADoTPJLagOK5 vKH3V6jtsx6piBlG5iND6Q0lEdcNgahaFgiNXQqlfE+GFM/sN2kCCHXACBj64a9ZymrD/NoF5rOmY AyEhWWIKA+y+W9iQ/HJcCVxwdrNEZM5Y5o47CvRK0U/taCy6eX6sg48HRMmsABEvwn/JdblzjEyWi T+OTNRYyaPQSxuGqLMNLW2BoRQf52IsyMi+WQBtsS8Qac2Gw1QmH3n74wjChORRlIrfDcqE0zsPq/ dYkIWEwsKVPd8OPAJ3qj9e1JmWN+/Ohe/7BHrjf2Rgb0ltEfGQTunEBOKmop3X1QJMw3l+8lp/Q8Z 3MoeHSsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2P-0000000EaQ9-1F0E; Fri, 28 Jun 2024 18:09:33 +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 1sNG1y-0000000EaDe-1eQu for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:07 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-7066c9741fbso772926b3a.2 for ; Fri, 28 Jun 2024 11:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598145; x=1720202945; 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=iPjL6ORxfcbcSywP6tXKN3XgBVxZ1+LizFBx1kUWvpM=; b=FcGHUnRlBt5XFO6bAuU+BQ5ST5Rr5jPUGh4JLyAKwpO6xxNWqn8zQWtYrXcNLsoZZp IQ8hBF6VDYo3reBsw82AlPkoGa+RJ6DhAU7Q3a5oqb0MUK1TSeiOjCORQLn48xLVdltp ZHUp4wE+1nVOYHm3cpf3pDJPgfZH7RWTIjT5NAxKB3fgMjvuLwqd9DxAg2fvG996wOdL xSwB/Fk2BGJHz/oZ6Whqt2sxTadbcLKcAReiOlhyaI/21m/7i4LaYu18TvvgvWTDmALs pj/wzxl8H/mUvf+NRG8gtkiFhj5H5n7mF/kyjqjl5WaXIjMz2WIUZvg4dQLyXZxwy60D SUiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598145; x=1720202945; 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=iPjL6ORxfcbcSywP6tXKN3XgBVxZ1+LizFBx1kUWvpM=; b=EePobj/5gmY7rlC5jYjUyYod8O8A7D0JXqivtDNXhMh9jCR2QthdWvSPFnrsvATCJQ yaXet+Lgs8mNNEIHeevtw7f3CwgJkHN81zJG/3H/0hE5siTbJChJlfOPfIwKciazm5xs XwB8ocRLR8SS4tpNKdWQfq+P1+U9Ha4tWr33qXDVpUulLSCAhWDTFPqZNgdviDwRwb4w y6p/yOWMun7jqc5RBlUIB+IRrWKqFuLXrJx5D4H6FhwnVQ7/mZtDgHqyiztJhcopCJ0s bXvkbqIo4XMw69Nb9+7+I/Cto2Bu3e0LaxiN3cQvPuQIPmufZMP2FDMFZ3t789dS5YNX i9sQ== X-Gm-Message-State: AOJu0Yyo7JPVR/pnJaeyt17wGvpxyhcio+nod6t/Cay6NCjx/CjYh+zy rtzT/F3Kmw4qiuNkwUB59gAepjiyBMYBpEGnURTw/1UxXJttGQoJ X-Google-Smtp-Source: AGHT+IE+8ChQtulMhadJgbwyhFCNkwINJZRVm5GvacmeQhYE8fDwdcsKKYNUc1CNoqwRvnfviNUoGQ== X-Received: by 2002:a05:6a00:990:b0:706:750c:8dda with SMTP id d2e1a72fcca58-706750c8efcmr27072902b3a.6.1719598145501; Fri, 28 Jun 2024 11:09:05 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:05 -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 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes Date: Fri, 28 Jun 2024 11:08:43 -0700 Message-ID: <20240628180852.1738922-4-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_110906_462737_DF509DB1 X-CRM114-Status: GOOD ( 17.71 ) 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 Switch vbus gpios from using a custom GPIO lookup table to software properties using PROPERTY_ENTRY_GPIO() constructs which closely mimic device tree gpio properties. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/devices.c | 4 ++++ arch/arm/mach-pxa/devices.h | 4 ++-- arch/arm/mach-pxa/gumstix.c | 22 +++++++++------------- arch/arm/mach-pxa/pxa25x.c | 1 + 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 7cc6db2d1615..e2758c94fd77 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -629,6 +629,10 @@ struct platform_device pxa27x_device_pwm1 = { }; #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */ +const struct software_node pxa2xx_gpiochip_node = { + .name = "gpio-pxa", +}; + struct resource pxa_resource_gpio[] = { { .start = 0x40e00000, diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h index 82c83939017a..b7c0e138ef61 100644 --- a/arch/arm/mach-pxa/devices.h +++ b/arch/arm/mach-pxa/devices.h @@ -53,8 +53,8 @@ extern struct platform_device pxa_device_asoc_ssp4; extern struct platform_device pxa25x_device_gpio; extern struct platform_device pxa27x_device_gpio; -extern struct platform_device pxa3xx_device_gpio; -extern struct platform_device pxa93x_device_gpio; + +extern const struct software_node pxa2xx_gpiochip_node; void __init pxa_register_device(struct platform_device *dev, void *data); void __init pxa2xx_set_dmac_info(struct mmp_dma_platdata *dma_pdata); diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c index c9f0f62187bd..b9eddc691097 100644 --- a/arch/arm/mach-pxa/gumstix.c +++ b/arch/arm/mach-pxa/gumstix.c @@ -100,26 +100,22 @@ static void __init gumstix_mmc_init(void) #endif #ifdef CONFIG_USB_PXA25X -static struct gpiod_lookup_table gumstix_gpio_vbus_gpiod_table = { - .dev_id = "gpio-vbus", - .table = { - GPIO_LOOKUP("gpio-pxa", GPIO_GUMSTIX_USB_GPIOn, - "vbus", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("gpio-pxa", GPIO_GUMSTIX_USB_GPIOx, - "pullup", GPIO_ACTIVE_HIGH), - { }, - }, +static const struct property_entry spitz_mci_props[] __initconst = { + PROPERTY_ENTRY_GPIO("vbus-gpios", &pxa2xx_gpiochip_node, + GPIO_GUMSTIX_USB_GPIOn, GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("pullup-gpios", &pxa2xx_gpiochip_node, + GPIO_GUMSTIX_USB_GPIOx, GPIO_ACTIVE_HIGH), + { } }; -static struct platform_device gumstix_gpio_vbus = { +static const struct platform_device_info gumstix_gpio_vbus_info __initconst = { .name = "gpio-vbus", - .id = -1, + .id = PLATFORM_DEVID_NONE, }; static void __init gumstix_udc_init(void) { - gpiod_add_lookup_table(&gumstix_gpio_vbus_gpiod_table); - platform_device_register(&gumstix_gpio_vbus); + platform_device_register_full(&gumstix_gpio_vbus_info); } #else static void gumstix_udc_init(void) diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index 2ab3d8d66466..03e34841fc00 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c @@ -239,6 +239,7 @@ static int __init pxa25x_init(void) register_syscore_ops(&pxa2xx_mfp_syscore_ops); if (!of_have_populated_dt()) { + software_node_register(&pxa2xx_gpiochip_node); pxa2xx_set_dmac_info(&pxa25x_dma_pdata); ret = platform_add_devices(pxa25x_devices, ARRAY_SIZE(pxa25x_devices)); From patchwork Fri Jun 28 18:08:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716492 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 CAF53C2BD09 for ; Fri, 28 Jun 2024 18:09:50 +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=wmoY9MC+b9hOZcGZXOQJ0Uh4Gl8qIWXCfwHUYEIgVNk=; b=s5jK3xnE65jfGeE0hvHqVSBmog Z93KTmHrtFV25bpJmv3rwlWZYT5MP4lrZenRvBz3Vjsa9dnlD5LsfKYY+zygKYzh7NM+6GB1OetDw S4N8ufSNsqhn70tKNtkr5UiH7tgvK6aR2GYWT9C/jA0tZQNmdiw/sModEywvWxEd5DawCovPAJQvt l27ETJlvZmy6M+zSSiqsoEmGsNkfFOYu57DXAHz1XopuAM/deMWwEGW8k2QV6vRDHMpHhAMrQvigB ofeVHxReiCT2kzNwBUfQCNQptcy6mCR78g/TRsISzK5d2A4ekN5ZsuyPVRL9/7QvfceQzaMiC6yva FB7Wyudg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2W-0000000EaUF-1fte; Fri, 28 Jun 2024 18:09:40 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG1z-0000000EaEF-1a5M for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:08 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-7065e2fe7d9so721872b3a.3 for ; Fri, 28 Jun 2024 11:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598146; x=1720202946; 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=wmoY9MC+b9hOZcGZXOQJ0Uh4Gl8qIWXCfwHUYEIgVNk=; b=Z+ma6tmUlyfhnn3CcxWzbQgdgnviguf6cM1RLb7DsDRbCVFdrpfdd5qLMKWQyvRvo8 rrWMaIb47tqfxI8zXlBjatugtQteZff0zwlG/tqzf/ZsPc600mhvBH8U6k60CwG7ZtmM R9ef89p94yqAvfd7ot0VOOFMLyhcqnLCpS/aE60vYIDXbM/AnVMYSuKY4QdItJCfE8mD XoqMbs6I8xY5D0PekxhS5v1IdaAT2LAMH2XZlyrfNwnD5/nnCUFhW1ge/AbhsFRIoM6L Wah4PigHASDM5QNmkJ3e5f7qobfUAY82CWsOH+HRHFYk8f+fOtYjUb0KolvPUdBY35B0 J8Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598146; x=1720202946; 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=wmoY9MC+b9hOZcGZXOQJ0Uh4Gl8qIWXCfwHUYEIgVNk=; b=sDVdngYqRKsE12Nk4tIqF1zburju9KZzN/kOnp4oUeDmy3gt6f9kc65ZNwt9d74xHd hA8dEyNrSTqvA4iHijQe2NXTinMgOGjXwX8d1aB1fBEC2d9P2gTTHkkBoskrA/pwVXoH TjcYxDJE65ClKRxYj5UTeQvD/BuhCLbKRchkh16AQp2Rfkl4ZbMqVsTEToAoos1IuiIt WzDDggn2ZHMzYqG/dzG+vsSanWre7Tr6VKzhDWYkP4WW00A6+kjazdn1xcJ1iFYFQb4L fHr3obmu4ov0q4UMakSgbUc8ifGnlswwwgfFT9pL0qmVYQLMKdyjq2yt/iYicpfV8HzX HNHQ== X-Gm-Message-State: AOJu0Yz/Y8sITWdNJye5lQwzIHXu+IciVwDXngiQG5xeHcAtKfzfNAWT WPQb5FHlQx4zDYzo39FgeG8qtj0qwmOCtNto/EmwOnPGyciNxs2oJu47kA== X-Google-Smtp-Source: AGHT+IFym5PAI16Os9Hfp7AYeddl0ojmEh3aJykbFJxWnw9ufaFP8zsIAOZN9UfNjvXStDqZSy006Q== X-Received: by 2002:a05:6a00:b91:b0:705:b81b:6ee2 with SMTP id d2e1a72fcca58-706745e809bmr23126817b3a.19.1719598146472; Fri, 28 Jun 2024 11:09:06 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:06 -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 04/10] ARM: spitz: Simplify instantiating SPI controller Date: Fri, 28 Jun 2024 11:08:44 -0700 Message-ID: <20240628180852.1738922-5-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_110907_433950_668B460A X-CRM114-Status: GOOD ( 16.77 ) 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 platform_device_register_full() to instantiate SPI controller in one go instead of allocating it, creating a software node, and registering the platform device as separate steps. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/spitz.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 10ab16dcd827..b14eb2a54f80 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -580,14 +580,16 @@ static const struct property_entry spitz_spi_properties[] = { { } }; -static const struct software_node spitz_spi_node = { +static const struct platform_device_info spitz_spi_device_info = { + .name = "pxa2xx-spi", + /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */ + .id = 2, .properties = spitz_spi_properties, }; static void __init spitz_spi_init(void) { struct platform_device *pd; - int id = 2; int err; if (machine_is_akita()) @@ -598,19 +600,11 @@ static void __init spitz_spi_init(void) gpiod_add_lookup_table(&spitz_ads7846_gpio_table); gpiod_add_lookup_table(&spitz_spi_gpio_table); - /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */ - pd = platform_device_alloc("pxa2xx-spi", id); - if (pd == NULL) { - pr_err("pxa2xx-spi: failed to allocate device id %d\n", id); - } else { - err = device_add_software_node(&pd->dev, &spitz_spi_node); - if (err) { - platform_device_put(pd); - pr_err("pxa2xx-spi: failed to add software node\n"); - } else { - platform_device_add(pd); - } - } + pd = platform_device_register_full(&spitz_spi_device_info); + err = PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("pxa2xx-spi: failed to instantiate SPI controller: %d\n", + err); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); } From patchwork Fri Jun 28 18:08:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716493 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 B5B3BC2BD09 for ; Fri, 28 Jun 2024 18:09:59 +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=fVMwheqA5PLjXICrqtVucOfQhWX0Fpnfz1fEEhxd/KA=; b=yz1x3t+jje0p9ftNtLEBmX9xFW 9WtMMbr+EukAWw9HbcSFIDapXtco2arCffz+pit3Ar1rm42A/USn0tEKCe6G28t0GR5k1VC1Z4VOq EjghK/oVo6I9Qc7VBv5XVHM5khMbJ45bkda37tEd50rpGSr8DraxX43HJ4qyFrd0BvcNFO4UQNNPc jF2T8VedQFX6wOGpZ6A5ePccFbv3GcBMoq1s8qaMdfx9sSc7H2ul5Hy1JOZkP+L0m6p/KccBjLqKK mItSXDogpYWRf3dRUgnU26vqeqINS26vjrZfJukA92HuEfPv7HURGe0P9FXhpI4q8Zeqc+E4LxnZc 3vmJLvDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2e-0000000EaYE-1wQH; Fri, 28 Jun 2024 18:09:48 +0000 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG20-0000000EaEe-2bNv for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:09 +0000 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3c9b94951cfso499982b6e.3 for ; Fri, 28 Jun 2024 11:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598147; x=1720202947; 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=fVMwheqA5PLjXICrqtVucOfQhWX0Fpnfz1fEEhxd/KA=; b=M8ancfvHRpc47pwKJ16Onz3fXnZcCKeBH+l06oustEa6dA3JKmaL9AOlyrdChnahbe 3eKBwOm2IPD+vh47mKJO1muicy7HFDbooLFCzQLlkyvHecAMh744dpX7uYkJRCn/0Nfb bAtb1Yyqqc85OotIqcg7CnYz+TYDBgqU0CBzJfaUp5KvfWKSiNelloyVE7cRFIOLppTT 1i2evr6zlHv/b0RciNrcky4HVs268VybZpMBQYLTuNYp/0AS1jEunWQ1vutqKtrUV7TP ORv6YlYwdgMq5hHEgPG0zE/BIIXqx/YeGYUjt4vAyM+2MUqAI3VcoBBxMPFCZK7WyiBC Pdrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598147; x=1720202947; 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=fVMwheqA5PLjXICrqtVucOfQhWX0Fpnfz1fEEhxd/KA=; b=UG+7IyoG8Jad1dpZaXV9scKG2QHFHrfDn5iHhnkEKo0X/3All7h8zUO2QBVtBX3M/e VM1l7l+FhVRw/1/3vzSc6pJa/CiDZxd22yEHpURUmS4Ad0L7su9AhiLXwda1vRJOvH8j pPm8p7+JG8hquXHlViPuFYTOFBJCxF9nXijKrgDOGJjjvJ6EElR2H0vKTxix/4Bbr0ZM jIqLo1Hjco8xE81fqJc/SYBfQD2Q9xKr9VFkbDYHyyF3wYB8DOzYNQ9PeWRoSe5d8aLk zpTk+RyMpaZXCH7XYLjOJXObw5lh7sAKwEG7eQyypi3FLCNgqfRaebqTGk2ipYqPG5jm 7ryA== X-Gm-Message-State: AOJu0Yykx5gdmRfQ35DhwuZAJYcxhtjp+xiu2Ya+vJF4q4ytzhmDycjU RCvhQu6JClTnZxpVlH11wtvXlHGGkXpVg6d71CHt9SNGip/V7T1WTQuafA== X-Google-Smtp-Source: AGHT+IGNZSGJXSF1ny8x7rMmOSnm4p25k/DcV8pt4n6UZoIc2gM1XH3BV8U4qDA1RrIettcCykcLqQ== X-Received: by 2002:a05:6808:2219:b0:3d2:212e:71a0 with SMTP id 5614622812f47-3d54594bcd4mr20676903b6e.6.1719598147504; Fri, 28 Jun 2024 11:09:07 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:07 -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 05/10] ARM: spitz: Use software nodes to describe SPI CS lines Date: Fri, 28 Jun 2024 11:08:45 -0700 Message-ID: <20240628180852.1738922-6-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_110908_694129_2A0F7EAB X-CRM114-Status: GOOD ( 17.92 ) 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 for specifying SPI CS. Because the SPI core can figure out the number of chipselects from the number of GPIO handles specified in properties, setting "num-cs" property is no longer needed. Signed-off-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/pxa27x.c | 1 + arch/arm/mach-pxa/spitz.c | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index b135b9ef665c..f8382477d629 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -341,6 +341,7 @@ static int __init pxa27x_init(void) register_syscore_ops(&pxa2xx_mfp_syscore_ops); if (!of_have_populated_dt()) { + software_node_register(&pxa2xx_gpiochip_node); pxa2xx_set_dmac_info(&pxa27x_dma_pdata); ret = platform_add_devices(devices, ARRAY_SIZE(devices)); diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index b14eb2a54f80..504d04bb2df7 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,7 +130,6 @@ static unsigned long spitz_pin_config[] __initdata = { GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ }; - /****************************************************************************** * Scoop GPIO expander ******************************************************************************/ @@ -565,18 +566,17 @@ static struct spi_board_info spitz_spi_devices[] = { }, }; -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 software_node_ref_args spitz_spi_gpio_refs[] = { + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_ADS7846_CS, + GPIO_ACTIVE_LOW), + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_LCDCON_CS, + GPIO_ACTIVE_LOW), + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_MAX1111_CS, + GPIO_ACTIVE_LOW), }; static const struct property_entry spitz_spi_properties[] = { - PROPERTY_ENTRY_U32("num-cs", 3), + PROPERTY_ENTRY_REF_ARRAY("gpios", spitz_spi_gpio_refs), { } }; @@ -598,7 +598,6 @@ static void __init spitz_spi_init(void) gpiod_add_lookup_table(&spitz_lcdcon_gpio_table); gpiod_add_lookup_table(&spitz_ads7846_gpio_table); - gpiod_add_lookup_table(&spitz_spi_gpio_table); pd = platform_device_register_full(&spitz_spi_device_info); err = PTR_ERR_OR_ZERO(pd); From patchwork Fri Jun 28 18:08:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716494 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 9CA50C30658 for ; Fri, 28 Jun 2024 18:10:06 +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=ay9TI8HWK+oR18tT8EQNVS4HczzSY9JpQeS8IURTtMg=; b=VSBA34ttHsrlBe4bJk/t9ufxpv OrbvYulFQNGA5nP8BkbryxLji2/X/Ss+Hpmqy9YQHaMRNu5qpieQzgyVTB4/ziL6xchBHjhEb4fTd irZNz2nhXPmzmzDDnEwiW/oxHeL2WHCBXuxWJBX9TwTtU00yZyNn8mxwb0SyfPDmHfPTfQZ5nsIab 857Ey2q1nacxTKPXchQnRGuAKaT4ZRlA8+BRnvQlXsF5d7jdBqm//tXPrveAUww2pH8Yzx3l/V5Md 3RsyAZDtEulOO0rOLg3n9xkQvvMT3/fWNRiwGQ2i8GDumL7P/1sc/P5ibSSWDfgRUy2rm7SY0LADy 9BloegDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2m-0000000Eacw-28Xl; Fri, 28 Jun 2024 18:09:56 +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 1sNG21-0000000EaFG-1TSE for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:10 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-70a078edb8aso204225b3a.1 for ; Fri, 28 Jun 2024 11:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598149; x=1720202949; 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=ay9TI8HWK+oR18tT8EQNVS4HczzSY9JpQeS8IURTtMg=; b=Gh29ToiPrlcf40uuYtzlw08ML81dfOfgvFBibsEftgBg4N2m0jMlPbdXYpfRIeFsPs 1pVAYo42Z7UI4pj9AkjFvF58ecpqMH53FFRhPNAjZfIGp95wDeICcpDnudirIs84NsmY C9b3nI5pSPvSWCluHQUr+Jwy+nGnSvuFF3XtHX9lnaZKTG/0+cKzUYpg+G8IIKFeQeH0 oXWbgVQBbCz8uaqRnqTMzKCHHugwIxRjE68EuyFdx7haAY9bEiHklwFYbKPyIJASR2Yn t8gq9k9jx15ZUT7wFxIcxRVOs/vwQQ84MFumND5ipDgeFXNH9DEJwWLEYgBvKVNdcqTP ZNyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598149; x=1720202949; 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=ay9TI8HWK+oR18tT8EQNVS4HczzSY9JpQeS8IURTtMg=; b=m4u3E0n5Mu43GWnfSXD+GtMjddZxB7pnNc4BylAHgWY2y7TFSaxkSODRpmUM9HZGvV tqRNTT/CfkHd2PxMkT5IRSq1/pc08N+ugHKldjwdauXMUCp+DBRlLSWR1kthk9CN4x5A N+QJFRJbhc6Tb7v8qdPvd6ECfnuXU2ikoqK/5OlKolTpFJDqA/O1QnjlYIMbp8FpQc0H JJO6TCG6fUR1Nl5fyC+uDA4x8nXeYd6X7W8SJA4MfYNO/RAf9YiuU8gCUohcufS62Y1e h1oI3H7YaiDJ2U8v1r7Wn+s53xb506BqPabOZ3MDuernKbXXxH4uxQDaZTzlgQBYpSow iIgQ== X-Gm-Message-State: AOJu0YxwEAH+f51HWlwTsXS2UQZX7OG6Jz8j31nwgMcumSVljzeOorRY d28QxpO9ygq73T0A2vSHwWwzTJD8vkqLyE7NRsfavjb0MsWnkO5Z X-Google-Smtp-Source: AGHT+IFUdHHXsh+kQq1MNIc7SmoyKk0Wy8cjfjvnFWozynmhMcEHlK3wZYCzHdSPBhIp8OVcAk/pbA== X-Received: by 2002:a05:6a20:3947:b0:1bd:208a:3b20 with SMTP id adf61e73a8af0-1bee4926d26mr3662610637.14.1719598148636; Fri, 28 Jun 2024 11:09:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:08 -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 06/10] ARM: spitz: Use software nodes to describe audio GPIOs Date: Fri, 28 Jun 2024 11:08:46 -0700 Message-ID: <20240628180852.1738922-7-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_110909_412969_D57218F3 X-CRM114-Status: GOOD ( 17.58 ) 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 Spitz to use software nodes for specifying GPIOs for the audio chip. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/spitz.c | 66 ++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 504d04bb2df7..278d49ed7a9c 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -130,6 +130,20 @@ static unsigned long spitz_pin_config[] __initdata = { GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ }; +static const struct software_node spitz_scoop_1_gpiochip_node = { + .name = "sharp-scoop.0", +}; + +/* Only on Spitz */ +static const struct software_node spitz_scoop_2_gpiochip_node = { + .name = "sharp-scoop.1", +}; + +/* Only on Akita */ +static const struct software_node akita_max7310_gpiochip_node = { + .name = "i2c-max7310", +}; + /****************************************************************************** * Scoop GPIO expander ******************************************************************************/ @@ -950,24 +964,24 @@ static void __init spitz_i2c_init(void) static inline void spitz_i2c_init(void) {} #endif -static struct gpiod_lookup_table spitz_audio_gpio_table = { - .dev_id = "spitz-audio", - .table = { - GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("sharp-scoop.1", 8, "mic", GPIO_ACTIVE_HIGH), - { }, - }, +static const struct property_entry spitz_audio_props[] = { + PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3, + GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4, + GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("mic-gpios", &spitz_scoop_2_gpiochip_node, 8, + GPIO_ACTIVE_HIGH), + { } }; -static struct gpiod_lookup_table akita_audio_gpio_table = { - .dev_id = "spitz-audio", - .table = { - GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("i2c-max7310", 2, "mic", GPIO_ACTIVE_HIGH), - { }, - }, +static const struct property_entry akita_audio_props[] = { + PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3, + GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4, + GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("mic-gpios", &akita_max7310_gpiochip_node, 2, + GPIO_ACTIVE_HIGH), + { } }; /****************************************************************************** @@ -975,12 +989,14 @@ static struct gpiod_lookup_table akita_audio_gpio_table = { ******************************************************************************/ static inline void spitz_audio_init(void) { - if (machine_is_akita()) - gpiod_add_lookup_table(&akita_audio_gpio_table); - else - gpiod_add_lookup_table(&spitz_audio_gpio_table); - - platform_device_register_simple("spitz-audio", -1, NULL, 0); + struct platform_device_info audio_info = { + .name = "spitz-audio", + .id = PLATFORM_DEVID_NONE, + .properties = machine_is_akita() ? + akita_audio_props : spitz_audio_props, + }; + + platform_device_register_full(&audio_info); } /****************************************************************************** @@ -1003,6 +1019,12 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd) static void __init spitz_init(void) { + software_node_register(&spitz_scoop_1_gpiochip_node); + if (machine_is_akita()) + software_node_register(&akita_max7310_gpiochip_node); + else + software_node_register(&spitz_scoop_2_gpiochip_node); + init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0); pm_power_off = spitz_poweroff; From patchwork Fri Jun 28 18:08:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716495 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 654EFC2BD09 for ; Fri, 28 Jun 2024 18:10:16 +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=TES+PR3oco/zso5TBiV82fiMxzPeRQiTqnjOENaSm6Y=; b=L2CIZfPOeQ4WsqpGOJaxAQ7Il4 aBaCrIDTnif/pdxhDrA4mAwbju7FQroqRLqeYwoL35g7sw1ALJ7Z9SQgqbyl7OE+fjR9y92Ot5B3y gG3biuVXFhnan8tW51292PRr4y5pwUUmEdoH4sPX/kHx9kNUZszBr4MOEUr8LWd7fvGQXaCSNolcw ecjGoKS5JX7McIXUmZCDPcxTmFdZT4Jaetz/k0Ms9sodCxnuP3K3/NxdCdeSBNYT2F+T+ptp3rQAx rWJGmM9g/oFm28xbNbMn8kjRtg5P4wr7RCpQENaNKwnvTme9nlhWVvOLBY6K0n40zJ9fJmqnyd4fK aF/wTfyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2u-0000000EahY-2S0U; Fri, 28 Jun 2024 18:10:04 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG22-0000000EaFe-3kTH for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:12 +0000 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3d561e564d0so525321b6e.1 for ; Fri, 28 Jun 2024 11:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598150; x=1720202950; 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=TES+PR3oco/zso5TBiV82fiMxzPeRQiTqnjOENaSm6Y=; b=monSsnvUaFFpQzpQdcZxN+chgxjjUIXvzTlFS5NSDT9jdpIjwXXH46m1lBVMdNv7+S aUhpxf7G2D3OEKMt74tjvnyQ4hZYPrIeAJDC/XOZFnSi9pYX7ci3jkjpVklmR8GxQ9JX SMH+ZSvAOoJ7XQsZAxc38x6+oqXI9OWkVVKTo6CDoq/F8JTm1oj20mWmmtRbkc/lPrNR gLfUc33ncpzjGYJReyYuIBG9M3GdhBZiNZJJIiGKptsSdN0d+wjjYPW84zGiFB0PeVCQ n0Q+ssiIQMUXRGY7S3wmz+3ISxeXB5sxvJF9fyRDoT6ISNSvQrWxBj4fxUFDqiVU3Z82 4Yyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598150; x=1720202950; 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=TES+PR3oco/zso5TBiV82fiMxzPeRQiTqnjOENaSm6Y=; b=lJ2x92uwrV5RmZJtatepihsKpnW0lgpNC8QHqUQuPOoF2nT1oaYt+rRdq+vXSMxZra QN+IM+aXYcuN/pj2gyMbpqsdONk7cQgRYFutkwfrGeoeq78O5WdfHOT6IpiM3DqeEuUj aYM74O1yfM6Ll3f/xRZxhoKYX07mQbazFXaPn8XyrWUtNfbj2IJOBCPqno23PVBpLr1M YNnqhVx3JH9yCLcPSZ1huqOsoCWeLseEsBVYsUFkDRqInyZJLaFu+EBISYQPFFzeeEHz C2Fcaw/Fn/UPxSJLMNjdpVTMfFdiWPzl7wu7VSsN4/fwNG82885zbN8fuzI9aQD05pzo E4cA== X-Gm-Message-State: AOJu0YxuHtBlSb03LeVRB2R+WAGrALMZW+RgDwhg5xS0i7QceCaijF8Q DVjshLNw0DbUSPYslFUhkHzXUzNsvNfVX7zdpyItF8FBg+u6YECI X-Google-Smtp-Source: AGHT+IFbVQmOnqIXtYzrw7G3AGIcltAq/SwDu0tAxwBmNb/x6ZxkTvrB7B5PQEu7pirK0ugnnATPyg== X-Received: by 2002:a05:6808:16a6:b0:3d2:22c6:59d3 with SMTP id 5614622812f47-3d541c50f73mr19803715b6e.6.1719598149794; Fri, 28 Jun 2024 11:09:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:09 -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 07/10] ARM: spitz: Use software nodes to describe LCD GPIOs Date: Fri, 28 Jun 2024 11:08:47 -0700 Message-ID: <20240628180852.1738922-8-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_110910_952819_C04964AA X-CRM114-Status: GOOD ( 15.10 ) 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 Spitz to use software nodes for specifying GPIOs for the LCD. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/spitz.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 278d49ed7a9c..c79510185ce3 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -532,22 +532,24 @@ static struct gpiod_lookup_table spitz_ads7846_gpio_table = { }, }; -static struct gpiod_lookup_table spitz_lcdcon_gpio_table = { - .dev_id = "spi2.1", - .table = { - GPIO_LOOKUP("sharp-scoop.1", 6, "BL_CONT", GPIO_ACTIVE_LOW), - GPIO_LOOKUP("sharp-scoop.1", 7, "BL_ON", GPIO_ACTIVE_HIGH), - { }, - }, +static const struct property_entry spitz_lcdcon_props[] = { + PROPERTY_ENTRY_GPIO("BL_CONT-gpios", + &spitz_scoop_2_gpiochip_node, 6, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_GPIO("BL_ON-gpios", + &spitz_scoop_2_gpiochip_node, 7, GPIO_ACTIVE_HIGH), + { } }; -static struct gpiod_lookup_table akita_lcdcon_gpio_table = { - .dev_id = "spi2.1", - .table = { - GPIO_LOOKUP("i2c-max7310", 3, "BL_ON", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("i2c-max7310", 4, "BL_CONT", GPIO_ACTIVE_LOW), - { }, - }, +static const struct property_entry akita_lcdcon_props[] = { + PROPERTY_ENTRY_GPIO("BL_ON-gpios", + &akita_max7310_gpiochip_node, 3, GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("BL_CONT-gpios", + &akita_max7310_gpiochip_node, 4, GPIO_ACTIVE_LOW), + { } +}; + +static struct software_node spitz_lcdcon_node = { + .name = "spitz-lcdcon", }; static struct corgi_lcd_platform_data spitz_lcdcon_info = { @@ -572,6 +574,7 @@ static struct spi_board_info spitz_spi_devices[] = { .bus_num = 2, .chip_select = 1, .platform_data = &spitz_lcdcon_info, + .swnode = &spitz_lcdcon_node, }, { .modalias = "max1111", .max_speed_hz = 450000, @@ -606,11 +609,6 @@ static void __init spitz_spi_init(void) struct platform_device *pd; int err; - if (machine_is_akita()) - gpiod_add_lookup_table(&akita_lcdcon_gpio_table); - else - gpiod_add_lookup_table(&spitz_lcdcon_gpio_table); - gpiod_add_lookup_table(&spitz_ads7846_gpio_table); pd = platform_device_register_full(&spitz_spi_device_info); @@ -619,6 +617,8 @@ static void __init spitz_spi_init(void) pr_err("pxa2xx-spi: failed to instantiate SPI controller: %d\n", err); + spitz_lcdcon_node.properties = machine_is_akita() ? + akita_lcdcon_props : spitz_lcdcon_props; spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); } #else From patchwork Fri Jun 28 18:08:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716496 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 62F64C30658 for ; Fri, 28 Jun 2024 18:10:22 +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=mZZQERlIGvlDT2ctdsAJWWSJ3qbII640NDh+Pz14HqU=; b=cL6kizAfP86ggMX61OQc/XRLB4 Ma1c57iczsyYDlBmmqtYK5dJ91pKMUt5j6oHXHdaN0QWyjKd6pkd3ceeXb0VB1GrDpBcboppngogC ACv5ZWMHEvsAQHLLwViXZFB8/M3Lv0D5rCitxyIClPtXkSvDUgACz5cD6boTDxCeZ4EC+326/Cksi 0TTk8hK+qQoZ5r5EFg2sfzJPmI3h+MDCAj3WgnALm1utHdukEENPftLnXvYkHix5OI6hMghnlWpgU pmBfCKmWFXFXo7oMHm3Gibz9poHb0zj3b7Ow9Jw5dSX8ukF+qbK6c+n/LhHPYI+yXkHQZH7NPRC+h vqKDGm/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG32-0000000Ean8-42vu; Fri, 28 Jun 2024 18:10:12 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG23-0000000EaG3-2ok3 for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:13 +0000 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-7180308e90bso646628a12.1 for ; Fri, 28 Jun 2024 11:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598151; x=1720202951; 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=mZZQERlIGvlDT2ctdsAJWWSJ3qbII640NDh+Pz14HqU=; b=dOjYZqnLODbexiaE77nJVfI53gCMEyeRCg4wB9xF3etD4Uw2Y8XgaUyeOuBRGzfpJp WET47ZUYyJVRZjEd7hu44VEqRUhzdENoZIUkt8iK7+I4k7gFSwR5jQWUJnsg6oDJW2+r dDbcykkhZHzv5Z8cPqJuw0vV+Nf91BaBSjr+rxRv4imU79Ed8in42OxHvhOZfyMF0/j0 9ekOtyeVFtzAKzwjI3BcakxK4LlK20nV4dOxdyaWMlfyEd54EkotHrx5CqAbP4dYMLG4 wuMzURKl3+yyV9tte/A+pqdE8pDT6oownjbjVD/nq1hzzNVz/ljV2rd3j7bov+b3U/yc i0Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598151; x=1720202951; 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=mZZQERlIGvlDT2ctdsAJWWSJ3qbII640NDh+Pz14HqU=; b=rq6Pgr05+ss5wYioqBEOcyrk7u76xh1DV6UaPp1BDJN/7UbrcNnILxCUOce5MxDq7x IVSr/mceLWOhKUmhDtjo5F7nzvZsKbUwWRlWFb9+11OiDQ5iqfcV2w4E5u9+TM2GPV3D 1m/SFADD/QW/1IGNdefJ5tlaZhwrfvEZdQvo8vSeV3gnK4cKHGTcr7RmxBVMxeCNV3dg cALhx0FnSLEZpSwIsdXPcxYmAyLJKjgiJSPGTb08oFoKkSTBiBXrdO9yc4UCojpCwt6r 2SSnOxktcZZ0Gp8aflTurDD0grwcVatyqx+W3Trd2kQnslBarAEryxLkLg2p4WJo8F7o tobw== X-Gm-Message-State: AOJu0Yx7ZKIOdb5Co9qO3NovX9hevKd2urRlotTWdAjfxNnxvM0/3VkU O4fe81bU7kv+oUpuSfwc/JfwrLda4EggHN+okgivSoiXTMc/jApB X-Google-Smtp-Source: AGHT+IHkQkSp58snm0J9lMaUMbDp2cIe5JR1UZf7YHJIVSCoCLZlR/SP/vAyS5cqOgnfslds0UlWUA== X-Received: by 2002:a05:6a20:1225:b0:1be:c7d9:ecc5 with SMTP id adf61e73a8af0-1bec7d9ef7bmr7626980637.19.1719598150756; Fri, 28 Jun 2024 11:09:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:10 -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 08/10] ARM: spitz: Use software nodes to describe MMC GPIOs Date: Fri, 28 Jun 2024 11:08:48 -0700 Message-ID: <20240628180852.1738922-9-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_110911_742619_87FBFF52 X-CRM114-Status: GOOD ( 20.08 ) 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 Spitz to use software nodes for specifying GPIOs for the MMC. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/devices.c | 36 +++++++++++++----------- arch/arm/mach-pxa/devices.h | 1 - arch/arm/mach-pxa/gumstix.c | 2 +- arch/arm/mach-pxa/spitz.c | 18 +++++------- include/linux/platform_data/mmc-pxamci.h | 4 ++- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index e2758c94fd77..d050a4c78f97 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -48,7 +48,7 @@ struct platform_device pxa_device_pmu = { .num_resources = 1, }; -static struct resource pxamci_resources[] = { +static const struct resource pxamci_resources[] = { [0] = { .start = 0x41100000, .end = 0x41100fff, @@ -61,22 +61,26 @@ static struct resource pxamci_resources[] = { }, }; -static u64 pxamci_dmamask = 0xffffffffUL; - -struct platform_device pxa_device_mci = { - .name = "pxa2xx-mci", - .id = 0, - .dev = { - .dma_mask = &pxamci_dmamask, - .coherent_dma_mask = 0xffffffff, - }, - .num_resources = ARRAY_SIZE(pxamci_resources), - .resource = pxamci_resources, -}; - -void __init pxa_set_mci_info(struct pxamci_platform_data *info) +void __init pxa_set_mci_info(const struct pxamci_platform_data *info, + const struct property_entry *props) { - pxa_register_device(&pxa_device_mci, info); + const struct platform_device_info mci_info = { + .name = "pxa2xx-mci", + .id = 0, + .res = pxamci_resources, + .num_res = ARRAY_SIZE(pxamci_resources), + .data = info, + .size_data = sizeof(*info), + .dma_mask = 0xffffffffUL, + .properties = props, + }; + struct platform_device *mci_dev; + int err; + + mci_dev = platform_device_register_full(&mci_info); + err = PTR_ERR_OR_ZERO(mci_dev); + if (err) + pr_err("Unable to create mci device: %d\n", err); } static struct pxa2xx_udc_mach_info pxa_udc_info = { diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h index b7c0e138ef61..72c556ff67db 100644 --- a/arch/arm/mach-pxa/devices.h +++ b/arch/arm/mach-pxa/devices.h @@ -4,7 +4,6 @@ struct mmp_dma_platdata; extern struct platform_device pxa_device_pmu; -extern struct platform_device pxa_device_mci; extern struct platform_device pxa3xx_device_mci2; extern struct platform_device pxa3xx_device_mci3; extern struct platform_device pxa25x_device_udc; diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c index b9eddc691097..efa6faa62a2c 100644 --- a/arch/arm/mach-pxa/gumstix.c +++ b/arch/arm/mach-pxa/gumstix.c @@ -90,7 +90,7 @@ static struct pxamci_platform_data gumstix_mci_platform_data = { static void __init gumstix_mmc_init(void) { - pxa_set_mci_info(&gumstix_mci_platform_data); + pxa_set_mci_info(&gumstix_mci_platform_data, NULL); } #else static void __init gumstix_mmc_init(void) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index c79510185ce3..4720a40587f1 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -651,21 +651,17 @@ static struct pxamci_platform_data spitz_mci_platform_data = { .setpower = spitz_mci_setpower, }; -static struct gpiod_lookup_table spitz_mci_gpio_table = { - .dev_id = "pxa2xx-mci.0", - .table = { - GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_DETECT, - "cd", GPIO_ACTIVE_LOW), - GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_WP, - "wp", GPIO_ACTIVE_LOW), - { }, - }, +static const struct property_entry spitz_mci_props[] __initconst = { + PROPERTY_ENTRY_GPIO("cd-gpios", &pxa2xx_gpiochip_node, + SPITZ_GPIO_nSD_DETECT, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_GPIO("wp-gpios", &pxa2xx_gpiochip_node, + SPITZ_GPIO_nSD_WP, GPIO_ACTIVE_LOW), + { } }; static void __init spitz_mmc_init(void) { - gpiod_add_lookup_table(&spitz_mci_gpio_table); - pxa_set_mci_info(&spitz_mci_platform_data); + pxa_set_mci_info(&spitz_mci_platform_data, spitz_mci_props); } #else static inline void spitz_mmc_init(void) {} diff --git a/include/linux/platform_data/mmc-pxamci.h b/include/linux/platform_data/mmc-pxamci.h index 7e44e84e7150..652f323b5ecc 100644 --- a/include/linux/platform_data/mmc-pxamci.h +++ b/include/linux/platform_data/mmc-pxamci.h @@ -7,6 +7,7 @@ struct device; struct mmc_host; +struct property_entry; struct pxamci_platform_data { unsigned int ocr_mask; /* available voltages */ @@ -18,7 +19,8 @@ struct pxamci_platform_data { bool gpio_card_ro_invert; /* gpio ro is inverted */ }; -extern void pxa_set_mci_info(struct pxamci_platform_data *info); +extern void pxa_set_mci_info(const struct pxamci_platform_data *info, + const struct property_entry *props); extern void pxa3xx_set_mci2_info(struct pxamci_platform_data *info); extern void pxa3xx_set_mci3_info(struct pxamci_platform_data *info); From patchwork Fri Jun 28 18:08:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716497 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 349E4C2BD09 for ; Fri, 28 Jun 2024 18:10:33 +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=TG3sk+VOjiapEEqjoqAeer5DFsWVZ6qfMsFkHqGpV/g=; b=KYN/zmDd75LtOyrAh+TrIJjsMU uoGhrlSDLAB10wT4VoMlR3aJOC8i64GLQ61T7inHcsEvGuwhvLFl9/v7ZUg+CYZqpa442etSk321p OQazzWxaewfQ5mbKDqTFeR6jFJcQ3l8vTzZty/n3fQyxpsF/vyVzrd8TSy6gwW42YAYEnVF8GZ2n1 CaCz/A50AE1st43jMpGEOg/PicDsX2kD71rh+V2cevkuF/KB18aLMIXQ5XEa2B70ucjDqBe5JnzSa RzTPquufp+EtiYGeiLIKWr/HpsQd0Sia7M3GDMSC13cao5yfIxijAut2rW2+CwoR08iKExShVjm/D mMVke+Hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG3B-0000000EasV-1xs0; Fri, 28 Jun 2024 18:10:21 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG24-0000000EaGj-2kkt for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:14 +0000 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-7082dd9bbf8so826066b3a.1 for ; Fri, 28 Jun 2024 11:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598152; x=1720202952; 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=TG3sk+VOjiapEEqjoqAeer5DFsWVZ6qfMsFkHqGpV/g=; b=Ln7z5M+ILWwaGtQfZCElzzHHSD7Z5ZRo7B3cuCfFXlyh2XPlWX/4bbvosskjFwYLUT +m/MVJI8ReZmF+vgUe9agOHZkniWKrHfjWZMzqJwFZ24mcXrFQg+iJ7xsLwTMODWYuNr duOszHgV09LfRN8dSGk4iAuhCpib/BeZOuUWlP9Lp5PcY8MO3wXPrG1bL+8Y02T1E3fR +IP7DdcSewPyiO7raJ6bxF6GFCPv5W75lqTs6nIlP3CyR2U8XUTx29tS9i6Qn300WepW C7lMpPuRPxnRUjVdw9k4ftFGhPN62N2/lKLavl56JVwvTsPJXNLdt2g9QCZdh6X6bes4 VrLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598152; x=1720202952; 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=TG3sk+VOjiapEEqjoqAeer5DFsWVZ6qfMsFkHqGpV/g=; b=jM/Lp185dtq586W/6JRyQFEyztBcLq7gZNVMZrBYjTTmUW08Wk1gVRCcYFF2xMSH+l 376oSMtR0TuAeGDeu2rfUwbgdv6DmC+jWM/AaPA9ARhywaLc8bglEX6gSUdkTNS28n1d RP9vWpF9gQ8g9klwAIQwSYqzsfr2cqTE5zzWZLPBnt708JRN/72jMwI+T38d+CjQCTZP bhRBMG6zXWWqAUjIRFgTiltr64U31+7iP+XrGjfck0TVxVZIwWhRFoavWSEqSvD2/M3D rdmP9Kz39FOHKdabzpLuJGhtftuqX4wlvC2G6R2yRxYZG65esHzqVxted5IQ9V8diQs4 i0iw== X-Gm-Message-State: AOJu0Yy+ktv1cC3bT3xUwxqmupt0xVbceIlBjBAj+/ybwqMjvVm0FCc4 /h6hTpA6bOh9ZhKMLG17CXVpaaMy9lUuCCsxDc1JW1qfGoxBcIWz4yXktw== X-Google-Smtp-Source: AGHT+IE/uVGbMaIUFaLkhNGkXfqS8xVGatcfBWhmOGBmX0fUaCsObE8LAGJWprKosEFqJ28F7EkCSg== X-Received: by 2002:a05:6a20:3c86:b0:1be:da68:1f26 with SMTP id adf61e73a8af0-1beda6820b8mr6390563637.59.1719598151928; Fri, 28 Jun 2024 11:09:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:11 -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 09/10] ARM: spitz: Use software nodes to describe LED GPIOs Date: Fri, 28 Jun 2024 11:08:49 -0700 Message-ID: <20240628180852.1738922-10-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_110912_786870_D2731810 X-CRM114-Status: GOOD ( 15.34 ) 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 Spitz to use software nodes for specifying GPIOs for the LEDs. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/spitz.c | 71 +++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 4720a40587f1..b19d4ed35192 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -467,35 +467,64 @@ static inline void spitz_keys_init(void) {} * LEDs ******************************************************************************/ #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) -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 const struct software_node spitz_gpio_leds_node = { + .name = "spitz-leds", }; -static struct gpio_led_platform_data spitz_gpio_leds_info = { - .leds = spitz_gpio_leds, - .num_leds = ARRAY_SIZE(spitz_gpio_leds), +static const struct property_entry spitz_orange_led_props[] = { + PROPERTY_ENTRY_STRING("linux,default-trigger", "sharpsl-charge"), + PROPERTY_ENTRY_GPIO("gpios", + &spitz_scoop_1_gpiochip_node, 6, GPIO_ACTIVE_HIGH), + { } }; -static struct platform_device spitz_led_device = { - .name = "leds-gpio", - .id = -1, - .dev = { - .platform_data = &spitz_gpio_leds_info, - }, +static const struct software_node spitz_orange_led_node = { + .name = "spitz:amber:charge", + .parent = &spitz_gpio_leds_node, + .properties = spitz_orange_led_props, +}; + +static const struct property_entry spitz_green_led_props[] = { + PROPERTY_ENTRY_STRING("linux,default-trigger", "disk-activity"), + PROPERTY_ENTRY_GPIO("gpios", + &spitz_scoop_1_gpiochip_node, 0, GPIO_ACTIVE_HIGH), + { } +}; + +static const struct software_node spitz_green_led_node = { + .name = "spitz:green:hddactivity", + .parent = &spitz_gpio_leds_node, + .properties = spitz_green_led_props, +}; + +static const struct software_node *spitz_gpio_leds_swnodes[] = { + &spitz_gpio_leds_node, + &spitz_orange_led_node, + &spitz_green_led_node, + NULL }; static void __init spitz_leds_init(void) { - platform_device_register(&spitz_led_device); + struct platform_device_info led_info = { + .name = "leds-gpio", + .id = PLATFORM_DEVID_NONE, + }; + struct platform_device *led_dev; + int err; + + err = software_node_register_node_group(spitz_gpio_leds_swnodes); + if (err) { + pr_err("failed to register LED software nodes: %d\n", err); + return; + } + + led_info.fwnode = software_node_fwnode(&spitz_gpio_leds_node); + + led_dev = platform_device_register_full(&led_info); + err = PTR_ERR_OR_ZERO(led_dev); + if (err) + pr_err("failed to create LED device: %d\n", err); } #else static inline void spitz_leds_init(void) {} 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)