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: 13716500 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6BCC8C3065A for ; Fri, 28 Jun 2024 18:09:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 341B3C4AF0D; Fri, 28 Jun 2024 18:09:05 +0000 (UTC) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 401C4C32786 for ; Fri, 28 Jun 2024 18:09:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 401C4C32786 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-7163489149eso674705a12.1 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=kernel.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=aca+wloiPth7HnBXRXvWEAFBHQTkTstferEEfYfht0W+ksXMNO4UegEQ+Krt90mTU1 ZW0nkYdIa1bXOCtTM46+L1FguEUOSHmUkTzNAGre4sSS0O20R4rYEUcsmQ1c3+6LXXdB eG/evALuh2quZ2TA8pllkrzBrPh7Gd0+G2BzKLXlVNKJls7rTSx8SmV9q3q2qalEZyyf 8H+1ePv77K1h+x5antrCwZU3bNSAIkAsMwC7Au876ZuuXi7oAq7u5XQ/ye8v1nHjEB/f Er7F6CcA1VzkNCA4lI6ILFNrtic4giKx0XuO8gd1fhT7kypOpS7kxKoHvXOaq1/X2Mwe 4+Mg== 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=tNV6aV4fLy7FneNxRhcdbDCBD2SJWTY0rWT6mBFZ/6M/4S0AUPamSo+YWIq2hVY8L6 kVjXW26HSpAj3zEMmTx9GdMKA9jXWMH96edfwJJCmXmCHu18L/xEZEf+cdZnTttggiQN WUcocPDFd/BoyApdxAaLXE+9cebr00B5UEPAC/8IdYKhLRMLTIhKO9khWZJhGICZX0dm gVMlmlY2odPJoa2z/3WsR9J619sfB9fkpqdyBCw0KnO+rZqy9PBdbsrzHWbzzfPYSMKI XdFW1T1rwxpynJu5fgnp4MglXZwI6CDJzquIItNY3SMln7xUyn7jCTmxL1H3AbZhumm+ Ulkg== X-Forwarded-Encrypted: i=1; AJvYcCWIMnd2PFt+8tho4pfGUfI93bQoInUwxs8vOfkslPWodadmFwbGziIVL9J6NbvJCKTOT7BnAyLHWyYA2MZz0Q== X-Gm-Message-State: AOJu0Yz+xORz9sacyYmrAGUNKC7t/22aAAKF3vfpDSUI6+BmOJZhTd1S A2wkNrZpctQIzt2fGXdnY8CRNbjrlgl8GpjZWAovJT/r4+gowAq9 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 List-Id: 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 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: 13716501 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 33D59C3065B for ; Fri, 28 Jun 2024 18:09:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 1028EC116B1; Fri, 28 Jun 2024 18:09:06 +0000 (UTC) Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 0D297C4AF0A for ; Fri, 28 Jun 2024 18:09:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 0D297C4AF0A Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7163489149eso674720a12.1 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=1719598144; x=1720202944; darn=kernel.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=mRPX9yHg2W/Gdol0/Q/HvLc3GaGOip9W86uqJ1av85rvWUgsVQfZY9AxhTmxrQBjYo xUawkFqTJjuK74+RnFCojIh4w8+3tt3uUw8gWe73WFagdbJoz1h8c2mhK+HX/fowVxjR Qngdq1hHVqHLBf4a4eI4z1ZkqdO0CEqhOJ/kfxwDvFnlB7GHyA3wt6kSAviTgsnnBKCu UAAtL3kffM1BTMpwrsSZ7WVWOXKnn4A43Dm5ZSzl5IsXPImFTirxt98QVzA7wyXdYaZQ 78FtofjhoTcrfo8mILVLyU4kZtXG2xR2/30U+sRxlW1KcrbqlGmN/zYl2WTLs5t78ZEN S5OQ== 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=nY4p1n1jZszzPQtpbTAzWYalDpw8qnE+KIdIp2yQPinB4izvhPveb+LZa74qolYrrg IoDtZFha7b8xr+nhT9N2LTqu/2599dxYZKqxTK0ObPYmLh6ikG5s2ghKyomcnHTQ5PhA kBEAKjxHPM3JxIpBY6vAXdKq5+5/tdfxfhj06N47CE9PZUqLt6Ze4whGhktEB1gUSvA3 QUhVIMRvbF96530+DgjTVV3adAh0c7CIFyKq/m++GVd45k90Fo6veEf6nGo6UdUIG6R3 xx2Z7tTSNpqVxve416xKx0BI2ZZL/qX0VohcaspezOINEDhw58hruWyY1xeoIGQIKeAr lF/A== X-Forwarded-Encrypted: i=1; AJvYcCWQmF12degtv46NF9scrBG4zqmpiCRGL9v2ayxzVlHdTmpdT7OuGj+5K75z1v6OTQGXikfERi3fOokU2R8DEg== X-Gm-Message-State: AOJu0YzbjnmH/ut+kRnPW1fJo7HSjtyxo2sfRvmax4cHPTeJTYco0JJG KBPFhTceMnUzlZDBvZR683PgH1n5m+NDKTX6MYx6aewIPaBe+dTs 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 List-Id: 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 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: 13716502 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5791FC2BD09 for ; Fri, 28 Jun 2024 18:09:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 2A850C2BD10; Fri, 28 Jun 2024 18:09:07 +0000 (UTC) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 4C9ADC116B1 for ; Fri, 28 Jun 2024 18:09:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 4C9ADC116B1 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-7065e2fe7d9so721858b3a.3 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=kernel.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=IKV17aoF2ZfaPGRK+FNSBhL6pM5f+r0OpzBLISJgQFJ6w1CSr4nUb58FQufeUGDCZ/ 4y7ut2ueh1Ix/a5TsK3uCB0T0cQb8pAZU48BXwcerjDh01dKEbpA2vdZi5PLBBbQvFsx e9Te6uZJw/tjLFApGAv0iQwegnvSxIJ7G0rwX6huid1RF3cAC4UIy0Yk9Q9+Wlw5LOSj sxx2x2sFV4y39MC+fkXAUWkRampaIxhWxwXPnTzOpugpwz4ifF+kFiqwacyycAsIDpjv 1zF0NxFNjWfHSXGBlkyDThJNUIEIgsTuTfgOEYHffPaTbzk4IwE76xDc9sahl8yJI9y3 GBuA== 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=SaZoHkrIOsD7+COLdOhbCw0NWFFw39+NrNj4nIuWrzKejr7TnOgmj0g7ChdVyZK78y r0uTTq+OIB5wamDRZfTaLUxG4eubVE2c//KTK+e3duCzaaFIxUBKmlVakpjSjYfBMEct Zn29Qwk6MjhqGHIejJYFRnKnuKR3t8ewTk+cwO2kDT5cynE94xpRzoQBAEhzU4uQQ7d7 oiqKG1Q+TQVnv/w8/xPISUA5xlKcVHFk5lzu9r1RqzDS4VgHIe5rTJclU1M8Fw+f87Z+ GkDR1jmX7qO5orOSjqaQdfxmwp7Q3Kppr3plme0QyCmZjvnutEeSG6im0EmcK+vfyZX7 kQvQ== X-Forwarded-Encrypted: i=1; AJvYcCXu8BV6svdLBmU9Vx+uDiyMzrCvPlwvjhP9szO8QHhwgimKByDs2seRVjZkB9REQohml7GDddbWDbopaiiBaA== X-Gm-Message-State: AOJu0YxufEM1ycj8ZMbDuew6I4e/uukurIxV93g1H21e7inb8SfHeTaU sO0adQ0/PrVZm/AnxdH63vY1xcj/PugfcRkw+WYedVjgUCRs/15y 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 List-Id: 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 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: 13716503 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3BE9AC3065C for ; Fri, 28 Jun 2024 18:09:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 29FF5C2BD10; Fri, 28 Jun 2024 18:09:08 +0000 (UTC) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 42437C116B1 for ; Fri, 28 Jun 2024 18:09:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 42437C116B1 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-7066c9741fbso772940b3a.2 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=kernel.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=TfwCCdy17l/H+qhR/PSLcwesTyVayTaxeomRw6vT9H4QE/6GHuKYDfm9UAA2VLTBM9 QzfZWCHJuW4QKJIJrrjE6F/rs6M0Zra02kagIOHGAHb9/TgVJNBZ7zD9VeUkhSaUUgko 8STCsmVsUHRC/TfV1n1igN+dF7zEIQ0X1VjNXnodgXvej9xsN4N7vqCBTeGEYMUcwa26 F2lcpzD+z5IeahsYgdnNXQ8oBH15lsRAEGGokdiuiJ8f1OLlpLF+WYamsPCXRndq3JdF Uuoshc3tIvKRrCmbD9JfuFBp7kkLPuJrGwVhcZDGH9HPSg+9MPUKVPzMZ2dodPCndnT/ bjsg== 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=VXkFl24n6ZcWZo0Z2A1IINFtrDOt6WCtD6qGED1POs/gvJE1tnYBqMVi/+KIsS7tjR DmjtN4Mon7IH21hFYBqMbFebGz/x2mjCrDPKzv1MzDdQBJPFKfCnzfcsC4yfMEkedM8Q kWDPj5fC3gscG3qmXItPA5q7Ml6hAEVJGsZnp9MiWuS3A5DddEiJk3gSShOfAc8Km/tE 7WJsZrpW64uY5k/WruoHctNH69Sg0gz6lBXGSl57V3ehe/O6GvO+h8Ub0cZJYjnhqEZf zzaODtB62ChqydvXMJfKN2fzxbkod9Pe2RkB1B7go2InzmeH4GuDkF8lMq/J25NiSJtW r6ig== X-Forwarded-Encrypted: i=1; AJvYcCWxC4UUMf+1FX8LMXmc82MG1pJqtNcg+Dz/zMYClIj+CS+1TA4yufKOTMdX2/LxKLufpqfoOdkBPncnaXrH+g== X-Gm-Message-State: AOJu0YyOI1Xy9Rt9pq/MeqZ0KMHGgW+YornEYOf5+9LVntWsmkvdGuce Poth86viYpxHOTu2iSWXS02dt9mNgmlpRkDGlADxfV1c65T+VDxw 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 List-Id: 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 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: 13716504 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 867D5C30658 for ; Fri, 28 Jun 2024 18:09:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 785BCC4AF0A; Fri, 28 Jun 2024 18:09:09 +0000 (UTC) Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 8AA83C32789 for ; Fri, 28 Jun 2024 18:09:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 8AA83C32789 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3d561d685e7so601686b6e.1 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=kernel.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=ikLdlblZVGMQEHFrfJEF8frS2h9J0AGkkDGFl7npKhrQbG+qhFchZNX3Ee1BUeXot/ r3Uurvi30dlml9CJ7ZFctIcxWluRDGfzmaxJycGTEzVyZP/89gh6PO7d8f+XnV5nzbjw yojbUNSBZjuCtHeQKzz5fWMqnlNjYDIZaj00S9LyOjgzNVKruQfmxKaY28bNC6Lop2k5 pHGUEwaaMKQGYMjp5CgDxSyj+0al2c+5/6CDN4NhLtZMsY3XkNVqv1opGMV/KB08OM5t A9slFmH6LSxrQwTENBqXpBuovd8rEYKGoWO2MAeMElUnltH+5vTSUHitGZ3gM2NV1toR H+ig== 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=ALfXSVe+s4U+E4MqVYvduE/qdhcEQ1uZSlF+ulAgSN/Sef0/PC2PhWc/8Fu5DiI1Yl phV0qvohBYxnagZ9uvtFx9UYTkwK9RSh/vMh+nwLK3OMVnLN6bdBIvdf1XrZHacmOQIH /s/aaFJ4L4fdeprs/GAeAkW1utPQiR9eZEy+y0SQSEaqWKbdavXhk7s0Sja5VL5hS0yg ZltZFv5cKFmV4ec6WkcnbJ4ctERMATVmnomF9JJ2ndelMoKWSSmZ38rTZmalDXW3NLbI hb8q3V9aC9BphJi991oXJZIgIsN9IFs5c3xCC7U8mh3nOe1OQJkEkCSjwnUQNwiAxJwY Zupw== X-Forwarded-Encrypted: i=1; AJvYcCX0GYGTKNxsjmAMI5b7B2TtKc80N8XHn68d8okvr9n8bGaDMV52l7sT8Pya1Rn0ELwp+V+3F5PXrov+X77JkA== X-Gm-Message-State: AOJu0Yzze2RAj1TNJ+k7/z8gqeR6ZCTD1lVZ7m4B5U426m9Z3ZZY5was UcMWPwx8UoA/q5pPc96KLLMs+0m/w7GGX66hxxknoZuJSz468y3U 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 List-Id: 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 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: 13716506 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8278FC3065A for ; Fri, 28 Jun 2024 18:09:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 70433C32786; Fri, 28 Jun 2024 18:09:11 +0000 (UTC) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 80D31C4AF0D for ; Fri, 28 Jun 2024 18:09:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 80D31C4AF0D Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-70a078edb8aso204227b3a.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=kernel.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=VL559fyzTmuuclLeTbsiBWEFDYiHiivpBm+ZaY4950HUJ5kNeVmEb7Ry6OW+XF/q8r Y155scvuW+rDH5FCD5pE8otGIr34bG0iSEmgf+IZ1g0fjMrLbPXWr+raJQ+vl0Pi/Yu4 F6IwcSeJENDa/y4jNZpqPpUFtGXpW8gsdvJOWXW+n1LOdwQBv9casziJr+0M8ChjNISS iqBIlWA43cRe2Q2rccvMLYuP9cgczEeLhICJJW2VeT2dCP6Q2S5/kAAw8IHBZcqU8yHr wnDVB4Tg7UnbPpc91Lg7g+XMmGIS7omuiJU0jKJ0x8nUtcCxYpZgbf0pXxmxBqiA9pDo 7MXg== 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=DUx/4MpdrEVCFxwjoaJ2+YnKorSJVEikyl1uzS7njwNTl9oQ0ezrHSwfZZk3CvFbqj nQ0BQjwKKbq+0qE/6iXwyfg/xFq0laB1Kk872nQPyEBRAKnReYM0+OQfdqT/z0wDz50c Fova+D5MtfDdIfh6Ojz02Iy53yWzD4tUTVXpQJRAqd1oD/9h+a4pK/EMRFoMpucw4ula rcrgKLbtAWoorEBKpXXiKzGXVDsAUksLT06pcDbk/9uf1h43x1OML00khydAQ8HTme3k BrAvLnowK+8dQfF9J4Q5hWuHNGYvFH/HTN3npvdQIuO4La0+lVM8dH2iWjQVKq+E7a0E KqcA== X-Forwarded-Encrypted: i=1; AJvYcCWxnkUE71A1ISflcZRoJe5E2ovTzG/kX8yQ9F5/9NscO5FMP04DDfhZ/PfWHBPqefPNsJR5hHVboRvpPaJ00A== X-Gm-Message-State: AOJu0YzpOIX6UJ3fCrJedO0Zsh8bQ8H+VJgRgszXalLbxuEGtkJNuT6b yjHgpa4fA1DMQJQEMAlder32FGQxMtWS3RjzrKv6PtqSNMIeQkNQAJd2lg== 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 List-Id: 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 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: 13716505 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B14E0C2BD09 for ; Fri, 28 Jun 2024 18:09:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id A29A6C32786; Fri, 28 Jun 2024 18:09:11 +0000 (UTC) Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id C1F20C4AF17 for ; Fri, 28 Jun 2024 18:09:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org C1F20C4AF17 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3d55f198f1eso428551b6e.0 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=kernel.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=jIi3rc4Jt98HRX5y3uwrsUvN6v+DnMgBAtaKiguAwK8S9jEUtgxRoMIYZlb2ab2ldV DvyqUHaUlCOiLvXjIidM4nUjkEfTbOw/ixtftzeu4gTpJUpC2/I08AuUpNODwvmdiJbT UreVtUqh57tc6RAkP+MNpcdT84J98ll+zcTwU87xcZH1QryS8tbbNoGR6+Ry870c97HM Chd6SqEDqDk8bXEt9xr6MMQ8zPuWJsJ/XluBTmd20KZrA8XSMTr+ytw+F1u09Yj8PkFT WooEzBRkkUGzsgbNVV4TO3hHckhPf4sDGrdo4lEh2a9SRNYJhijJYnsctTYXLCZotE3B x5yQ== 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=g/UHbcAOQ4pCOem/66f1GfjXOBf2t5VQeeXT3EaeqdQCfGw10QDLh6oKnuELp7N5sl 1K21rkiUj8k0phUSBzClkRYAirdAT+a9K3OxEIuVethtZ+BPzqMoCg3xNyPr32seLvdu 5l2dm8ex8Wpi4gdgxbi61wxbySXCX9Eow84mETiBH6fR4OcDpMXo96n+bH2M1Q+MXSv4 fmMcLBPW+TU4RNscT7SpAfMO97+sa83WesXukeTcstWPqKF/ZYcEp0lYytZ6Setp6CKg 3kkRNzJSOfE/BSIp/3YxqUjfCZ6B/82uIdn+wc+Oeq8PIARpp6asEwGH+PiU8yYUceIv OjLQ== X-Forwarded-Encrypted: i=1; AJvYcCWgaDrtUWVqabD79Lwwb5RjESHxqOYSAd+O9xCv4HycgCSyuHE6xZ4/6YFDZvoLCBfoku6Yiwg04UyM2GBh0w== X-Gm-Message-State: AOJu0YwqDsiUfqHy1Ik7M8r70FupMgDeXbB8X7xP4bXwd7UxL9kP5qqr +OKCEEMorQXuaWFrfWa467IOfWxRs30g/g9uLxuVL8wOvGQLwJ+q8OaJMA== 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 List-Id: 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 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: 13716507 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8D041C30658 for ; Fri, 28 Jun 2024 18:09:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 762EAC2BD10; Fri, 28 Jun 2024 18:09:12 +0000 (UTC) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 7A7A9C116B1 for ; Fri, 28 Jun 2024 18:09:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 7A7A9C116B1 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-6eab07ae82bso646880a12.3 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=kernel.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=EKqS45Wn2qFeN1Efol7QRj7iBH+JzdHKVr2X16qgNMUlRo5MpCq46nIKBK2KXrHEEB bZmq5rZApgZTsgq7E0LwPNXisWt1hdZmJmOrHZ6CC+CRVUdG0IM7/JCKYA0XSXmiuzuo U0qUYEjfQ/wrERJb6OyqP0HuA2CPsfBwJFYhYwKpMg20mp8KDK7bM1BON87mepZFKzBc bDAhC/UroN7zdvJbaUXm2WKg7C5sfUVd2FGYQWUjlzSrLGSWGsvtyi3iw3xY0AJ1JHxi 66DMUsXz2yc3Apl7g9mfKG3hY0DTX1YhxQQkNtt99pFeijaH4Ri/YnxuY/sLd9pUrPny wZqQ== 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=c6anScGiQMfuYn5EgM6STPSl+u3on2es7r9Q4kauqa11k5hiJ3YDA8ePRsIlHnq3I7 aKgDGcHrReyvRDAsjFJkTHLPperYGGWGaayVRC/FNA9ks+OFj2PrrkqvvzxQFW1ttHZ7 Nv7Mk7KrkZhKNOS7JxMO9TcOfGVSZlin9rDx45yoK/ghGGw0p0ct25w2TBkmnPezDmxv C0xJ+/KW67nnONbmqjLMF5gMQ+qJ78z8OgIOy7qZQEuWKV9M9HhmOZ7JrKk1t4cAMYn2 FxXVXaa+RLMhv/lZNkLtcpZ+uKZfdMHPxiFnfOqih9v4WM2SOp/1A3Dtq1dDQIpvt1I3 36EQ== X-Forwarded-Encrypted: i=1; AJvYcCXwSHm/uKpLzK0KmeR32S/QHKCpIX8Zzk7lt3W85cOgH0M87q6AHOuk/zxeHw6Moawb8sbkwX5lsSiy9FwbsQ== X-Gm-Message-State: AOJu0YwEZOPXHxsM93saKnnbxR6Y1MDU0PQRjfQC+Cf5cc53dCNr+TXo syqOIiiUsspUS980RY//+QYmW3NgV4lFQ6graY8EkGZ/LLuBvLl8 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 List-Id: 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 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: 13716508 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B1CDFC3065C for ; Fri, 28 Jun 2024 18:09:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id A44C9C32789; Fri, 28 Jun 2024 18:09:13 +0000 (UTC) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id BAE2CC116B1 for ; Fri, 28 Jun 2024 18:09:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org BAE2CC116B1 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-71884eda768so567198a12.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=kernel.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=UdjBvKYcAc4ju/K8bZRNYf0T2tAKavm0rvwn6+GIyzIyOt4pUnVLbif+oFPNTYgVYL cMN1GSNj/LkAjlWQNdqIw+n6XOBUGmCXtVu+Mr8I4tUAbiXOcsakUBr5TIObZoD/sttU ftq3N6yYT3qst+59HzZB4uMnRj9lFmMePgrgt6KSO4hPDL0BhSWkY7P4jx3ClIYYZ88Y 8BKdbvvBxF1oBLDb5OBCN1+vl+LwY1DXFMqlSfY3cnOYvT6wNbUdBCfg2ohlJOSebrmq oN9UVVpCJmuN8a1zf22eyMis4Oghq5MF1LtzHlmK/+hQHIehv3H7ZhNYL04shO0rN1B3 dD+w== 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=xL4mziNLYfl+SHPVTlauJu/iXWb4MxPDP9QxcJo8qBpyySFSkX2On37EH7lzHFV7ZS AaWG+L0eWmsjzjaDfcz9GNpa5/8d6nAzDTuDfF7Fjl5qq/JqNjymDrrfcRJgpf2mG0Co BNEU6FYV/EWEyOvFgvpAhgQTfxhI/Ts/KClORmxoaL1+tMxDzTvk1kvWX0PijJQ9lN4M ULgQX90IiFZawRu3daEHLaS/UUhOzXEmnzZM96yyPSGYx3ze2dXMoGcKb9gTkLdDnewU V3yZ9n+tfKzpvY6osP8N+ppXlJ9pOlEHvYKTNbKqJyjDuNhXbxhkD17LrD+szWakvvQu eoFQ== X-Forwarded-Encrypted: i=1; AJvYcCWm3eZ7TdIPuFkrqDMFjPdpy6YP28qrGG/EG+PkFmzVAA43Od21M05yzuJJ6iBEM6NUdOoeStsWW84QjqTLJQ== X-Gm-Message-State: AOJu0YxtkJKXqWyDA/DNE8FN0cpVgHepY+T6ay/TTDAUrfX6Wf+rP4i7 ySx7qb6zQaU6UCs20fyQG51UOKpT/h2qwJJg52voEjSmVIDQaxHH 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 List-Id: 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 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: 13716509 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BF979C3065A for ; Fri, 28 Jun 2024 18:09:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id AEA9AC32789; Fri, 28 Jun 2024 18:09:14 +0000 (UTC) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id D0B59C4AF0A for ; Fri, 28 Jun 2024 18:09:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org D0B59C4AF0A Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-706a4a04891so714731b3a.3 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=kernel.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=REyw98x3eKOFnyA+CVFMXvrQ56BXmHC6R3tX1X08O8HAogrGOKX0o4/RkHImFsblzE eCw0uwfsOFi/nf8U12DB693PnZee15H5H7N5f0CH7f4mGY+OgEnmdqhcaMvP+hEfGSAX HlxUk3CcD3516t+kdELzGolqExKV+88wqrcp/9ztIVY/24ZUP++OcByvthOGM85C2wY+ K8gy8qmc8MQrKrW8ZM6UA45dReIu4wHgxbBQp7OBVuYL8zJx1DgCYaRCl6lRyETEGx0M UXEWXmzj1ahdfR/bYXN+TtF9R2IUKOO1sUtAkZCf23EeLGBuH7uIl989Phj/Ue8trPpE OKMA== 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=Ylq6FztMHQWfvkKGeovlDVVVeYCaQY37vDrOT96KQia0bSRVylyodBweueI0R1Di2N GiPo3iGc2Hl0vu9rrGZQ4fNQTiDDYtw0wG46sBL1lmPYYesYCJQRrz8EO/+rRWouhBDP YeTYI3dLd5SO4BLLD97VJ7rNZ/qzqP+CHWJhDF3+Wa3rj3hW0x15Jw9bTLJiFxK8G7lq tr2o9X03wCwirf/E+Xt6I6ngmpzBi/dLA36s/UvZ8OMRVtIhI021oaEN8W1e/9VGeUMX oWld9Y9W8ucqkHy+6Zrk++dJx/VqEqvfVSk8HJIuBDz4VzQRyasTfehZX63Xyj4M125j aifQ== X-Forwarded-Encrypted: i=1; AJvYcCUb9Vt1QhhYs/SHCGTjL9idSJVzSJdYq4EOpVf7qllPEsmiaQvODwc2PdK+KNfPh8Tq4lQAg3U04oyK2EMApw== X-Gm-Message-State: AOJu0YyNUZFtbBrFYc6CztlmdUhHlUL9ofvRcUphq1rtLi4ZhQddqmeN UU3pUeJLudXbttcJungp6LhN0FUo9rkMzaGk8XdNffLGXCAXgVfq 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 List-Id: 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 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)