From patchwork Tue Apr 23 13:53:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1926598 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=JeQUBtei; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-gpio+bounces-5760-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP3WN597Lz1yP2 for ; Tue, 23 Apr 2024 23:54:08 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 562DD28806E for ; Tue, 23 Apr 2024 13:54:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B452E136E01; Tue, 23 Apr 2024 13:54:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JeQUBtei" X-Original-To: linux-gpio@vger.kernel.org Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF7781369A8 for ; Tue, 23 Apr 2024 13:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880443; cv=none; b=bbqDel/PmhMUXXPYW5k0bt/ayIW5eSgDiatuKRC9JnEfJyVH+Qw/RdAgYbWUY4rJ4M4zWrfmsR/4EhEvBZ3ZoRkR9CCqEk/4gIQlXZLtv7GP+u/VWcnuj7oM5hIiEu631jECEdwchylu8zE1Sodz7QgUFW4GYWeYD5n47l4E7w4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880443; c=relaxed/simple; bh=ZgFE9vMr0rgyzOzeVaH/Absgu+QhKgMOkT0mW9TavZA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SlzUeAvvG7tyXIyeqiQm8PKpAH0AUbV34LQUln/RvVCNmf6kGtPqwyjj0n8mA9FgicCVGvlbmh8YLs1PtmcNppW0soaRYh08i53dQyvIwDVEx9fauQTmIQwKxpJL4OqESmAftvQ93LmN2G8cenuRVxWPIrC1RUSBgFHXQT6C/hc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JeQUBtei; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-516d3a470d5so7042758e87.3 for ; Tue, 23 Apr 2024 06:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713880440; x=1714485240; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iqxRItWvTJbOoTJBydlz3fX/6NTjT+yh3cw5bUjUWlQ=; b=JeQUBtei5V/fP9vQ/5+8+0RIXL9X2YxnB1QOOX1Hmhh7bw1wpRJ/SJsXbx6UKFpNuJ aL0Fs1xLRV1MSMzUDY6WaU3Vdk2fse/NLH+GWZ8Dp6aGTIUQJwyO+G6KR9nkquowZqcM YNf1vouIjLNmkNkBlQW04TDjGLztaHexl7iGBEMf3qfD1d83Xgb5v/J+545rAdlOJA+7 XHsI8AAYAnCjfEm37LxBXphjMVCWG3HzV/3Q8Q5IYHLcP9oQGEyvJQeXx8Va2eeKdDi9 cup0S8ydX4j2E0TslAsFyfaOJO1bL3Vkg1W9c/qeZK8u/zoeXaBLg9X6xbtRtG+VV6IT RwNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713880440; x=1714485240; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iqxRItWvTJbOoTJBydlz3fX/6NTjT+yh3cw5bUjUWlQ=; b=aEPLS8K2XZoBeycIKW9p+GE64IA36jmXKi4Cg1XrmxENwYXXNjIoQZgsoO0x6MivIf f0IqDMOC6DFnL77lKJBTBlMoOC34p/n5oyuiu2/0FoYzx1vxFLMerk4wpds8i48T+CXs Qu//qcMhtszEQz421/iazHyIiL5SsOSZj+sV+7o6g5i0+vXscsa2g83oyIwaMmwczF4/ YZu84b6a+FL9dTausZUW0AWgr0vCNyymSlzLtSO+nW9d4LtCpu/OsWgxmfDavOcp49LV H5LDeqNm25hskZxdAlVQ6LJ3x2O3wE/MtM1SkW0LV2r34wpCj9JW3yc6I86Jb38oi+gE 9e7Q== X-Forwarded-Encrypted: i=1; AJvYcCUt1GgX7xcXjXq2Waa36iHcI6MWLFEMldT3mzofxyFnbVMTWXHPctGq/Va19roT7OdvbQ0427822LJ/YUCyTocpDws3GnuOgNuk3A== X-Gm-Message-State: AOJu0YxNHnj8uidAd5u9HfZZPL2kUPrIrFdVqskw912cOUA04gWTe/uC 6EU+nOZYl0DOuOXnjG+gtdX7NlaDFS3icRP0z3ihUvTeSOwmpF/veoG4yKm+nTVduiJxjU745Vw L X-Google-Smtp-Source: AGHT+IFzoFyorMbDsFIsafP23V2BI8V4tcOvYoSUwjDxawZ2DK4ZicdpmELHa5ZmSmwnm91fHnoi8w== X-Received: by 2002:a05:6512:3449:b0:518:b5af:5f67 with SMTP id j9-20020a056512344900b00518b5af5f67mr8365691lfr.64.1713880439735; Tue, 23 Apr 2024 06:53:59 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id b18-20020ac24112000000b0051a61f2d251sm1875997lfi.290.2024.04.23.06.53.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:53:59 -0700 (PDT) From: Linus Walleij Date: Tue, 23 Apr 2024 15:53:57 +0200 Subject: [PATCH 1/5] ARM: orion5x: Convert D2Net board to GPIO descriptors for LEDs Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240423-gpio-leds-v1-1-799c2f6bc61c@linaro.org> References: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> In-Reply-To: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> To: Andrew Lunn , Sebastian Hesselbarth , Gregory Clement Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 This makes the LEDs on the D2Net Orion5x board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij --- arch/arm/mach-orion5x/board-d2net.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-orion5x/board-d2net.c b/arch/arm/mach-orion5x/board-d2net.c index 0297e302d7bc..09bf366d05ff 100644 --- a/arch/arm/mach-orion5x/board-d2net.c +++ b/arch/arm/mach-orion5x/board-d2net.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -55,12 +56,9 @@ static struct gpio_led d2net_leds[] = { { .name = "d2net:blue:sata", .default_trigger = "default-on", - .gpio = D2NET_GPIO_BLUE_LED_OFF, - .active_low = 1, }, { .name = "d2net:red:fail", - .gpio = D2NET_GPIO_RED_LED, }, }; @@ -77,6 +75,17 @@ static struct platform_device d2net_gpio_leds = { }, }; +static struct gpiod_lookup_table d2net_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("orion_gpio0", D2NET_GPIO_BLUE_LED_OFF, NULL, + 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", D2NET_GPIO_RED_LED, NULL, + 1, GPIO_ACTIVE_HIGH), + { }, + }, +}; + static void __init d2net_gpio_leds_init(void) { int err; @@ -91,6 +100,7 @@ static void __init d2net_gpio_leds_init(void) if (err) pr_err("d2net: failed to configure blue LED blink GPIO\n"); + gpiod_add_lookup_table(&d2net_leds_gpio_table); platform_device_register(&d2net_gpio_leds); } From patchwork Tue Apr 23 13:53:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1926599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=djfVcRMQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-gpio+bounces-5761-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP3WQ3s2Gz1yP2 for ; Tue, 23 Apr 2024 23:54:10 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 447F71C21D80 for ; Tue, 23 Apr 2024 13:54:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98DA1136E0E; Tue, 23 Apr 2024 13:54:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="djfVcRMQ" X-Original-To: linux-gpio@vger.kernel.org Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C0761369A9 for ; Tue, 23 Apr 2024 13:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880444; cv=none; b=DfgvGWHxKdhHC7Hbwdf+FHs1x8g5Uf4nmvXPvF4mX2y0UZocgP2dh+AeIQODUviqmv2pdIJW3ymIrIPla0ApArCVMF+EuamSGqB1ABW7vWYoNGKZ9LeRlCG/5X7NH7NcuJFLCvECfDRBWp1J9Z9IWm/opq8JcvNiMyyWA/qCz3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880444; c=relaxed/simple; bh=YpJzDzC2/F1jXxUrSp60Hzo019b2vBYuAMaIAzEoIbY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PacBhB746tbZhN32w+cQ6ja3fGYHepVlt79XGVl2efE5Fl87s1uV3HNIOFn70zvFqR3Hd3bg5NT27wJYAqHmwVr4ESE3Eb/+1INAgv3ljQsMEFj6B9QgGMLDWQh8MlVUsk/kQwgJhu7nJkpmZWawHN6zhJTBbH12loshzlyqYfU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=djfVcRMQ; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-516d3a470d5so7042781e87.3 for ; Tue, 23 Apr 2024 06:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713880440; x=1714485240; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gReuYTpcRssmlbBTeL2oSNhhV9ufTFwwH1vDMi+LMNc=; b=djfVcRMQlEtTYBwajnHw3cYo1T1SzKTOEF1iAcSPnQsXYc7Rb9M9rdw64W8hkx6hE2 C3FkqQ+e/h74DGlvOjlwMWIWV7rg4dDQa63rM4zC6Emyw98g89I3pxIir1HGdtHy9Gv0 n7B5TrCKWdqLVJgTNtX3pYCu9hcahWD/GvQDvZKcGfpJNJx5eBC7Jgn/ctZaUCV7mcGD iAo16BTKr7VLeIdRe56EywKygohFZiWuYSWxnNLuLfklH6uQ9Tk6Is10u4S7DiBnTkLZ fIUSpstGct4+x+7ux9MXNt4xP1QRhA72sKgyS3fsSrCCAMQ8NvGmGcSGr8sbVZqcqJ16 7M1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713880440; x=1714485240; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gReuYTpcRssmlbBTeL2oSNhhV9ufTFwwH1vDMi+LMNc=; b=FMaRdtf+qJ3LUPMNKwfzcH0/ebBfAcnCn0CudxR9LMNGclpOm6MrJi3q4fj2+zNvOU 7G09Mcn9p7rcllvMSKJcaDgt0ufL7flZqJLTY0CMASzZ3ugOvOGcMenzSI/1tq7wozJC 4yVCXmS7Odlw3WwfF680Az/dLfRAa4Ar6/LLXAmMPx5eDJwuqYkHb25i0DhmUV67LxzV AMHAFWFVbEq2SSvZ4Er7qvkjjHp/rIE/cgI4UVE62ivxIv5xKl0UjnURi9N1yVb1ldri SdNAwPn2qxZ3Du/W62mCEkTmHKet8EtsC8HNQLIjV4F78OB1CoZxBvNOSWVOypQQzHJK +S6Q== X-Forwarded-Encrypted: i=1; AJvYcCUe3xe8syYe7jEL0r2nwDlHRcC6BQS0AIDn+kLdJMN6ks6K8mwVSEuoz+n7dS7mRE1EvGy7icQD65HRi6BQGd50VHSmRR/A8K+z8w== X-Gm-Message-State: AOJu0YwH6M73+yFgao5LrFqvzT+DXG1/p8Nyu+BmfPPBOoKiwV6whdMn bGSkwAKN37/0MSAPbXMe+AWokokE1kGOdIb6yRl20UT1cByXZY91KND73nydReYDcsAc61fGNIO S X-Google-Smtp-Source: AGHT+IEaJ+P/6KBOOtJyniHX1/cJOt0L+qQsFCuJMw0pbhOmIuGoJhmTttr2pc5PnXsak6Idb8O6fg== X-Received: by 2002:a05:6512:3082:b0:513:30fb:d64 with SMTP id z2-20020a056512308200b0051330fb0d64mr12144142lfd.44.1713880440589; Tue, 23 Apr 2024 06:54:00 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id b18-20020ac24112000000b0051a61f2d251sm1875997lfi.290.2024.04.23.06.53.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:54:00 -0700 (PDT) From: Linus Walleij Date: Tue, 23 Apr 2024 15:53:58 +0200 Subject: [PATCH 2/5] ARM: orion5x: Convert DNS323 board to GPIO descriptors for LEDs Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240423-gpio-leds-v1-2-799c2f6bc61c@linaro.org> References: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> In-Reply-To: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> To: Andrew Lunn , Sebastian Hesselbarth , Gregory Clement Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 This makes the LEDs on the D-Link DNS323 Orion5x board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij --- arch/arm/mach-orion5x/dns323-setup.c | 63 +++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index d69259b6b60d..062109efa0ec 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c @@ -14,6 +14,7 @@ * */ #include +#include #include #include #include @@ -254,37 +255,64 @@ static int __init dns323_read_mac_addr(void) static struct gpio_led dns323ab_leds[] = { { .name = "power:blue", - .gpio = DNS323_GPIO_LED_POWER2, .default_trigger = "default-on", }, { .name = "right:amber", - .gpio = DNS323_GPIO_LED_RIGHT_AMBER, - .active_low = 1, }, { .name = "left:amber", - .gpio = DNS323_GPIO_LED_LEFT_AMBER, - .active_low = 1, }, }; +static struct gpiod_lookup_table dns323a1_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("orion_gpio0", DNS323_GPIO_LED_POWER2, NULL, + 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", DNS323_GPIO_LED_RIGHT_AMBER, NULL, + 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", DNS323_GPIO_LED_LEFT_AMBER, NULL, + 2, GPIO_ACTIVE_LOW), + { }, + }, +}; + +/* B1 is the same but power LED is active high */ +static struct gpiod_lookup_table dns323b1_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("orion_gpio0", DNS323_GPIO_LED_POWER2, NULL, + 0, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", DNS323_GPIO_LED_RIGHT_AMBER, NULL, + 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", DNS323_GPIO_LED_LEFT_AMBER, NULL, + 2, GPIO_ACTIVE_LOW), + { }, + }, +}; static struct gpio_led dns323c_leds[] = { { .name = "power:blue", - .gpio = DNS323C_GPIO_LED_POWER, .default_trigger = "timer", - .active_low = 1, }, { .name = "right:amber", - .gpio = DNS323C_GPIO_LED_RIGHT_AMBER, - .active_low = 1, }, { .name = "left:amber", - .gpio = DNS323C_GPIO_LED_LEFT_AMBER, - .active_low = 1, }, }; +static struct gpiod_lookup_table dns323c_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("orion_gpio0", DNS323C_GPIO_LED_POWER, NULL, + 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", DNS323C_GPIO_LED_RIGHT_AMBER, NULL, + 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", DNS323C_GPIO_LED_LEFT_AMBER, NULL, + 2, GPIO_ACTIVE_LOW), + { }, + }, +}; static struct gpio_led_platform_data dns323ab_led_data = { .num_leds = ARRAY_SIZE(dns323ab_leds), @@ -621,16 +649,21 @@ static void __init dns323_init(void) /* The 5181 power LED is active low and requires * DNS323_GPIO_LED_POWER1 to also be low. */ - dns323ab_leds[0].active_low = 1; - gpio_request(DNS323_GPIO_LED_POWER1, "Power Led Enable"); - gpio_direction_output(DNS323_GPIO_LED_POWER1, 0); - fallthrough; + gpiod_add_lookup_table(&dns323a1_leds_gpio_table); + gpio_request(DNS323_GPIO_LED_POWER1, "Power Led Enable"); + gpio_direction_output(DNS323_GPIO_LED_POWER1, 0); + i2c_register_board_info(0, dns323ab_i2c_devices, + ARRAY_SIZE(dns323ab_i2c_devices)); + + break; case DNS323_REV_B1: + gpiod_add_lookup_table(&dns323b1_leds_gpio_table); i2c_register_board_info(0, dns323ab_i2c_devices, ARRAY_SIZE(dns323ab_i2c_devices)); break; case DNS323_REV_C1: /* Hookup LEDs & Buttons */ + gpiod_add_lookup_table(&dns323c_leds_gpio_table); dns323_gpio_leds.dev.platform_data = &dns323c_led_data; dns323_button_device.dev.platform_data = &dns323c_button_data; From patchwork Tue Apr 23 13:53:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1926603 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=kfVPArjx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-gpio+bounces-5762-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP3WT2r8xz1yZt for ; Tue, 23 Apr 2024 23:54:13 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C9F521F23355 for ; Tue, 23 Apr 2024 13:54:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD02B136E16; Tue, 23 Apr 2024 13:54:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kfVPArjx" X-Original-To: linux-gpio@vger.kernel.org Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDF01136E05 for ; Tue, 23 Apr 2024 13:54:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880445; cv=none; b=KVg4YP1pAPVL1LJEvE4RxEEOftMpSzn6TVm87Ia9vv1Slxnu1hD2Ersn16j+jGzLFYWpITqmrId61nRBOyAD43tezUpA+MTIkQ3aq8PKzgOsk1rtzOwX7pQkeuHVMGI+7LPyso8H9oN2l4/Gd9NRNvQrnzhtqhNDJHlVnnyTuG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880445; c=relaxed/simple; bh=grpQ83LFr2QOET7Wt4Tc857g/QnpjTwTFqd0fCT8jpg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WkPLt1QcxpUEVVxzbq0WFkDQbpUzoUhG6lK8xfAsj6knymuplOB+qLaEkEN2WCT87sKzXHzPqtHl8CTT53Oz7AuLDuyilSTEkXOocC6Ih8nazNW38SIPJyihDBtggiZlyQ/Srw+Z7HYQl5SHCL6khd2A37xWddYYcUmmOb4Y06w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=kfVPArjx; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-51abf1a9332so5708536e87.3 for ; Tue, 23 Apr 2024 06:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713880441; x=1714485241; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bED1J92t6L8xqCCoMd53N6tL4C0DTI8s9irWtXqiNYc=; b=kfVPArjxxNCw11jp/UPXbWxm7azo4KYVopV39tc7hx7V3GtSPDrH7bt8AsAx+TT9GF WISWQeFAc00ly8Tjkfya0L8c7IpbUFT2qKI9HyznfEj1tF4wdTSraJSHTTj08m4pRgwS WTxe8aARDF/6V3P0CO+pC3/DgfSDV4rtGDdk5LLXbRsGeQpwrzXFhXemNgMBj7r/uVeh 8L3ldZ1fmNII1TsLEp5ObqS6BiL6hog1EVxYJ2dOgDEqK26RF/3woPWrqKEC8ulrErkk dhPmhTDYDW2OhEeFyMjdARGjYkKE3B2ZNMiP9njMVrTJV3m9bJIebIrwNgTSmvbPPLQs haEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713880441; x=1714485241; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bED1J92t6L8xqCCoMd53N6tL4C0DTI8s9irWtXqiNYc=; b=q5qZxvrz6LfCLrO5Oe167GFprAOhXbpUcbwSYxAYf2qhYenjSQeCctYnZn2FJX12Bv LpPwtn+/KbNXw5DAMACLtNfU6byOgrgssfQ8iw6TiGnvp8SftXfvQfJduMKmFRG4byLd mOecZNlYD+6xLbokFBqJN1P9cW8kHhGVlb7pHvUCvCVlnTYTBmmmeGauQX8pPDS9SCGE 5c+3eFZ/vqEYH4Cn9/66muvIt9agbBoWhxVsKslEYFn1B5P3roZdaIvljtE6tMU+tgnY XrXIRE+OMEF3IOxPsa66GSCEIK8nntxn7LPQrzzrz5hKSSBsXjeEsngJD3U1izYCMbP/ GiOw== X-Forwarded-Encrypted: i=1; AJvYcCVEQi0vubRgkQ3R1mx2Zcb2jjoIV3W/4eskmblsOjLnjS5fRLTplqBU1AXpOgwbk8GjLDoPU6XJ1BlgQWs3KldmJwNfmKZBAKIU4A== X-Gm-Message-State: AOJu0YyYnqGoPxUtNvIer92NU3DKUcLG+Ept3iXRskVjjpNjdco8zC8p +yLQLHXnSkanHiwjG82Zs/w6jLAfP5l4SJ22JO2gAhdnPUkwP5lPLTcFNv/A8Gtu/4YCfI6VDKG y X-Google-Smtp-Source: AGHT+IHyO0PxjAJE6IewIDC+ePQ55Uzrd20ljTDYwFM1JodsG0AkTrhFmiNM3dMdYb8EV3ngM6wXpA== X-Received: by 2002:a05:6512:4d0:b0:516:c7c2:23b6 with SMTP id w16-20020a05651204d000b00516c7c223b6mr7594408lfq.9.1713880441502; Tue, 23 Apr 2024 06:54:01 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id b18-20020ac24112000000b0051a61f2d251sm1875997lfi.290.2024.04.23.06.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:54:01 -0700 (PDT) From: Linus Walleij Date: Tue, 23 Apr 2024 15:53:59 +0200 Subject: [PATCH 3/5] ARM: orion5x: Convert MV2120 board to GPIO descriptors for LEDs Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240423-gpio-leds-v1-3-799c2f6bc61c@linaro.org> References: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> In-Reply-To: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> To: Andrew Lunn , Sebastian Hesselbarth , Gregory Clement Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 This makes the LEDs on the MV2120 Orion5x board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij --- arch/arm/mach-orion5x/mv2120-setup.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c index 2bf8ec75e908..b7327a612835 100644 --- a/arch/arm/mach-orion5x/mv2120-setup.c +++ b/arch/arm/mach-orion5x/mv2120-setup.c @@ -8,6 +8,7 @@ * License, or (at your option) any later version. */ #include +#include #include #include #include @@ -139,34 +140,45 @@ static struct i2c_board_info __initdata mv2120_i2c_rtc = { static struct gpio_led mv2120_led_pins[] = { { .name = "mv2120:blue:health", - .gpio = 0, }, { .name = "mv2120:red:health", - .gpio = 1, }, { .name = "mv2120:led:bright", - .gpio = 4, .default_trigger = "default-on", }, { .name = "mv2120:led:dimmed", - .gpio = 5, }, { .name = "mv2120:red:sata0", - .gpio = 8, - .active_low = 1, }, { .name = "mv2120:red:sata1", - .gpio = 9, - .active_low = 1, }, }; +static struct gpiod_lookup_table mv2120_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("orion_gpio0", 0, NULL, + 0, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", 1, NULL, + 1, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", 4, NULL, + 2, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", 5, NULL, + 3, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", 8, NULL, + 4, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", 9, NULL, + 5, GPIO_ACTIVE_LOW), + { }, + }, +}; + static struct gpio_led_platform_data mv2120_led_data = { .leds = mv2120_led_pins, .num_leds = ARRAY_SIZE(mv2120_led_pins), @@ -219,6 +231,7 @@ static void __init mv2120_init(void) gpio_free(MV2120_GPIO_RTC_IRQ); } i2c_register_board_info(0, &mv2120_i2c_rtc, 1); + gpiod_add_lookup_table(&mv2120_leds_gpio_table); platform_device_register(&mv2120_leds); /* register mv2120 specific power-off method */ From patchwork Tue Apr 23 13:54:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1926600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=wJCVoQph; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-gpio+bounces-5763-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP3WQ4pfGz1yZt for ; Tue, 23 Apr 2024 23:54:10 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6160228850C for ; Tue, 23 Apr 2024 13:54:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D315136E21; Tue, 23 Apr 2024 13:54:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wJCVoQph" X-Original-To: linux-gpio@vger.kernel.org Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76A1B1369A8 for ; Tue, 23 Apr 2024 13:54:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880446; cv=none; b=r4fCIvG59pJcJGZiYAKaTfOWnUGINyiA+7W+/8+r/JrRx6KG1RWLpiTLZLGShSj9AqqvvmiQhq3474OL482qAppKzzysVXEIwtyJ9Un4BtYYcilZUHDJCMAgF6XU5KdcF2Jgz9AR4Lak89XeGAlj9CLhEVwqLuVFRtxhKSjB4X0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880446; c=relaxed/simple; bh=uq44RX/SgqmbfC6VXLuuo7CPLcLJMnmCEO+mCpGAG9o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hkWdTacFa5HkSsJEGVtn0rN4Ri+k1w6b4dVShznu3id+fklMZzPLhmpFqlm6sje+Cy7N/xaUHcvbbjyPblwI4OyUVIBDUYJOwi3FNeVDqngIGhFxek81FedWZs/BxDqJmJKSCYgdZED90XbX6BtSwz2QXYZ2sqrgRpTOm/jW6E0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wJCVoQph; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-518a56cdbcfso8847206e87.2 for ; Tue, 23 Apr 2024 06:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713880442; x=1714485242; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wEjTI295LgCVV5ERwS4DZP1yxmv81nEiKm3GiKi945M=; b=wJCVoQphwfHr3Som77wHFjx2dnBkZkeJnH7BA74zlHVnCL12gwpNF1TFOOtTCo5SD/ okIgDyP+2tE7t1vtsYy3lkaRCSkXIYh+Z560BEh2mW3Aq5XZ/aQOTLgMxR1A0VpEf2yf sh5nJ9gJ22iZdPBRSuLLDPd5U5JF0hZ7rz133Y86r8rtOKoPDSudIFbAhqMvuo6xG6xp LzWeiOyCv+yk5in+eNaMUiDmkHsQxAagtwn8JJSiGBcbQp4umFK/jt6zlV33ForAv0zp NZWD5Y6o5aGJZaK31sj2SZ+ayP8UNsTiJEQrJ785fYtgGYscHeXkeuaFUBvIiX6S4Zfz fftA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713880442; x=1714485242; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wEjTI295LgCVV5ERwS4DZP1yxmv81nEiKm3GiKi945M=; b=rOBnGeQxF+tzjwcQd18CVL/jN/jJ3x10jhNWylpXM0Ud+I6uAqvfhdRS2iAi2OYAVj 5uATTHQZyWS6zHzObNsmnuK+wGP69dDfmu1q6GGbWRN0odBYqXOeObs/VUeAr88CSXc1 KFX8BFGTUZaqLPjB6xFo+HForKRS/LkUHUwuSHnbj9zrWP1b7PUCU467r95jR848SV+5 M/qfjE/NbEpEz8Ji+cOAsK0Mzw2oxJDJWKXzOXVBK9oBzidZQbVeXJ7OirM+aGnD8Kkh uCg5RI7w2yn506WZB59XrLB32qQhomcftNdB4GY+UW3MR4gMpqKiLivIBNXDPo847Mdy DfYQ== X-Forwarded-Encrypted: i=1; AJvYcCW9+C1K2GjzNYyyXEjRMAphgA7mzvIdQVwYePyHfcdhHKggmCkPwY+6bvx+bjG50LCl6JxH0lc07MNWfqSeqHWvgHkqmqFGffwxBw== X-Gm-Message-State: AOJu0YybkpNcyu7mNx+CncaXOGi6pExvZ+ip6gqyNNb4zrojZOnpn44Z X1CC16tU9/8rdu4qjnniGB911SeEs05VC93UlONdwKHju5f81lT1md5K5XtLtnJh+ipQMHAbwUH 2 X-Google-Smtp-Source: AGHT+IH1+21GmNgWo02XyqGVWT6stfzMs6P+xDchhUAi6mGeLDA4OOkHSmQk2cCYv1GfQn1MhOL7Aw== X-Received: by 2002:ac2:4bd0:0:b0:516:9f03:6a92 with SMTP id o16-20020ac24bd0000000b005169f036a92mr13267766lfq.43.1713880442576; Tue, 23 Apr 2024 06:54:02 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id b18-20020ac24112000000b0051a61f2d251sm1875997lfi.290.2024.04.23.06.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:54:02 -0700 (PDT) From: Linus Walleij Date: Tue, 23 Apr 2024 15:54:00 +0200 Subject: [PATCH 4/5] ARM: orion5x: Convert Net2big board to GPIO descriptors for LEDs Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240423-gpio-leds-v1-4-799c2f6bc61c@linaro.org> References: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> In-Reply-To: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> To: Andrew Lunn , Sebastian Hesselbarth , Gregory Clement Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 This makes the LEDs on the Net2big Orion5x board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij --- arch/arm/mach-orion5x/net2big-setup.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-orion5x/net2big-setup.c b/arch/arm/mach-orion5x/net2big-setup.c index 695cc683cd83..6ad9740b426b 100644 --- a/arch/arm/mach-orion5x/net2big-setup.c +++ b/arch/arm/mach-orion5x/net2big-setup.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -214,19 +215,30 @@ static void __init net2big_sata_power_init(void) static struct gpio_led net2big_leds[] = { { .name = "net2big:red:power", - .gpio = NET2BIG_GPIO_PWR_RED_LED, }, { .name = "net2big:blue:power", - .gpio = NET2BIG_GPIO_PWR_BLUE_LED, }, { .name = "net2big:red:sata0", - .gpio = NET2BIG_GPIO_SATA0_RED_LED, }, { .name = "net2big:red:sata1", - .gpio = NET2BIG_GPIO_SATA1_RED_LED, + }, +}; + +static struct gpiod_lookup_table net2big_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_PWR_RED_LED, NULL, + 0, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_PWR_BLUE_LED, NULL, + 1, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_SATA0_RED_LED, NULL, + 2, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_SATA1_RED_LED, NULL, + 3, GPIO_ACTIVE_HIGH), + { }, }, }; @@ -282,6 +294,7 @@ static void __init net2big_gpio_leds_init(void) if (err) pr_err("net2big: failed to setup SATA1 blue LED GPIO\n"); + gpiod_add_lookup_table(&net2big_leds_gpio_table); platform_device_register(&net2big_gpio_leds); } From patchwork Tue Apr 23 13:54:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1926601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=gL+PxhQt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-gpio+bounces-5764-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP3WR3CJKz23tD for ; Tue, 23 Apr 2024 23:54:11 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1D077287FB3 for ; Tue, 23 Apr 2024 13:54:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 700D6136E2A; Tue, 23 Apr 2024 13:54:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gL+PxhQt" X-Original-To: linux-gpio@vger.kernel.org Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 868221369A9 for ; Tue, 23 Apr 2024 13:54:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880447; cv=none; b=snjfFlEYRS+aLFt0PxPqImV1jcYOCexmWZ3nFOiuV59rhP8LiSApdXO+ZZMTw2jsncrhNUkMe9j3n8gBSdPF2/lSHd/AFfvT+CgFnaJa2rjGZoD8+c7jioYNRMXZnwMOxQ1QnBRUG976ZuBWTGat66HUOBJ9/L2Qs8oGor0/Fek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713880447; c=relaxed/simple; bh=Rc2IumjbQ8OjG4qfb9Z/1cwn+g9VCp4urj9gZ8iGneE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LEJeH0wKtB6UUI2unxFgRJybwrc8TlQigWSHdkrKhPBg5TEBRY1R2cEPcrz8OJPkuP4Ok9kfneYZuCcSUZrUmV24pgFQcB+NEbYpGopP0KDQCue2+wJ2X901ZGAy+NgXhrNZwgzB6VH9HrNPd57Kzc5LZL6Dbe+KBrtprtFQuZE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=gL+PxhQt; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-51b09c3a111so3790114e87.1 for ; Tue, 23 Apr 2024 06:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713880443; x=1714485243; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gtSA0+kfCH0DzApn0Z0KwQ9Ybzg48e+TinciXUnlIO0=; b=gL+PxhQtlBkKCKXD98D2fu1xrRdORNGEnBDV/FrEbJNoBoc7FFnRYyd5UvRhJzb2l2 RzCdzfltTycU79WqlEZj7VtEhLVBx6AAOrS3d13s1U7+xYabw7PJIDytySBbvrQw7Mjr UP4WZQR/3o7QAsgw3agtrqWOzFiPjShjC/ZC8wbiA5pe1sn+KUwdfCvYnQdvJdzpQ1hC 2SYe6hmYZyYcv8yQjZicliIoCpmS7zHzjEOIu32MEUm2jn6AevV/cylDobxClyZy1Ote HGWbFQ4ihwWPeVLlP5NgnxKL4o4NXkFW6Gbb3NSFp+6I7drLhK5xqIqqq42CQGZSROhw lDaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713880443; x=1714485243; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gtSA0+kfCH0DzApn0Z0KwQ9Ybzg48e+TinciXUnlIO0=; b=HusnikhvBifQEIKY5DCMK1+VPSdpQpUezlS0RrxUaHUQn+2/58EsWb6D1kyR+bjMhR EmM2+wXug1Cd0MP8SN/ibRmQeZG/u1W4vymRx2pZ3Vbec0hipsnYmNIKnHJUARGk5X/q 95zVjDtO7ceid3heZ44hqQ9INkBd3UqhcS7xX1XmgqBIyOL6U2dWanteLcpVS1a+DrIb hhhQxoKPFdJ8+hUvMXID2gnWiWU5rdtR5yeZD/UaysfVISwRdVXkiD+ebghJ00dmP8/y HXIHny+Q9N6r/h5JVyhyI/rxvvM4rewLENgP1ytiAMOiA/o8y5G+/7q88VQWmARv2C7T g9yQ== X-Forwarded-Encrypted: i=1; AJvYcCVdyT3UGxMBEC8cYBJe2PJ3I3hC1tMscbrdPavkE6XSCzT7ba2TLIVlhdXD6NaINFC97yzOFhI4Aa8Ri2o6i62/NBLTfdCnz/IHJQ== X-Gm-Message-State: AOJu0YxdOt5zynbxwq0RCl5LdUQ0RnMp3jsaZr0N4QpeJGyOVKd5TdoH ja5yPMuEpC1ysEk9iR3JDk8xO8mbZ8OXAjAsJZFWzMiVdtUMRxcBQLp1Il5UiwkUIbooKjA1a9M V X-Google-Smtp-Source: AGHT+IFlE4pqogUlR+eZ37BQq666pDAg97ATWOgkDpFMSX8lWAbA7K/Gu3ABd18BwtKzqHaH18zFDA== X-Received: by 2002:a19:640e:0:b0:519:6691:4135 with SMTP id y14-20020a19640e000000b0051966914135mr8449450lfb.67.1713880443491; Tue, 23 Apr 2024 06:54:03 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id b18-20020ac24112000000b0051a61f2d251sm1875997lfi.290.2024.04.23.06.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:54:02 -0700 (PDT) From: Linus Walleij Date: Tue, 23 Apr 2024 15:54:01 +0200 Subject: [PATCH 5/5] ARM: orion5x: Convert TS409 board to GPIO descriptors for LEDs Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240423-gpio-leds-v1-5-799c2f6bc61c@linaro.org> References: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> In-Reply-To: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> To: Andrew Lunn , Sebastian Hesselbarth , Gregory Clement Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 This makes the LEDs on the TS409 Orion5x board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij --- arch/arm/mach-orion5x/ts409-setup.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c index 6f60dc1dfa22..8131982c10d9 100644 --- a/arch/arm/mach-orion5x/ts409-setup.c +++ b/arch/arm/mach-orion5x/ts409-setup.c @@ -8,6 +8,7 @@ * Copyright (C) 2008 Martin Michlmayr */ #include +#include #include #include #include @@ -168,20 +169,27 @@ static struct i2c_board_info __initdata qnap_ts409_i2c_rtc = { static struct gpio_led ts409_led_pins[] = { { .name = "ts409:red:sata1", - .gpio = 4, - .active_low = 1, }, { .name = "ts409:red:sata2", - .gpio = 5, - .active_low = 1, }, { .name = "ts409:red:sata3", - .gpio = 6, - .active_low = 1, }, { .name = "ts409:red:sata4", - .gpio = 7, - .active_low = 1, + }, +}; + +static struct gpiod_lookup_table ts409_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("orion_gpio0", 4, NULL, + 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", 5, NULL, + 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", 6, NULL, + 2, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", 7, NULL, + 3, GPIO_ACTIVE_LOW), + { }, }, }; @@ -300,6 +308,7 @@ static void __init qnap_ts409_init(void) if (qnap_ts409_i2c_rtc.irq == 0) pr_warn("qnap_ts409_init: failed to get RTC IRQ\n"); i2c_register_board_info(0, &qnap_ts409_i2c_rtc, 1); + gpiod_add_lookup_table(&ts409_leds_gpio_table); platform_device_register(&ts409_leds); /* register tsx09 specific power-off method */