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: 13640129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1FF82C10F1A for ; Tue, 23 Apr 2024 13:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vGBPyg/cWzcgkLKmkEXhGizGsHEE6K4VgiQ3W4GVHt0=; b=gIvSs13GlxeJxU 643SwV5glnZhHuYkKdz2mDRWDgrDYRHA2MWGDFIrpbgPgen0MDC3+LF1BGylL17wkVUb5/qfh8NhS 589whciKyJHW3TbaGEo9NKxdgMhJQOJIInfxlGPMT25ZsD6qOg6tAQ0M2UWDt0Uh8kMEbn52Dhsmq Rwnyc6Ng54DmuW1jPl/U1P/qR7mrZVDCw7js3Q1zjSIZ1AvwZvOnT/V6uKJrtZJS8jIIu26Ij/COH jIdi0aRs0Qam0Vd6V0eTN/JaGlSfLKSlKutt/M4d0IK3uj7A50WIUNBIScOS9U8hmhmsBvsOg2gZT xgeLpG+WlM9aOOIKAUHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGay-00000000Abr-0TgE; Tue, 23 Apr 2024 13:54:04 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGav-00000000AZx-1gqu for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 13:54:02 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-51ac9c6599bso5310290e87.1 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=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iqxRItWvTJbOoTJBydlz3fX/6NTjT+yh3cw5bUjUWlQ=; b=VTBH2/NNt76mwjLCu9yEY/jNffGspyfFnlaC2e+r8fMfYIUuYE38d5/dDooY23UYae zxc5dVyZIC5LahlLqK44b1dMsSSsWh8fbZ8MoJkniNobfUyQRT3gJOooRcTBTwz35V+T x4LL38ecHFGN4euK+wmy0LWhtJKL4xxmxYNIFXoT7x6o4oDfjGiTIQ6t6BXMnYdK/VF8 IMYEIclJNBZpannJYFtxSt/CPgg0syvZjBkmZYBdIBvTAIbAjx6/hpnuZZwV2VcBJ7hK Qg0hJez+CEBC2jVFP/BlLatKbss4y8JzR2ZXk2P6oSbZusvkoUwyiU6CClm62yHY+M0A yRpQ== 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=i3xQRy6TsJz61t2LlivtRdoYR9xHLxNgrAOQqpcO/kLR32j1lSxAJ8F1VCURgc0EhR lxw7D5FIzTZK3+OGCe3e/u8SyfsbTJ/RKCU7Navvt9qorZ4TCjFXo6xT/QZICzqhPSnK 8OOZo7nykAJ4JwBC5aoAiCHRlzE8XWaRjBYoNI1WsdHo8ssrAvE40kE7+lkxedTuKNPh GaGE3xtow5xun9AZVoSB/USDcU2PIkLMBXhUeEdsaAbftkxIByhfL0Ddp+FzNT9JBNie N2NoDG9PrxWH8ppO+Gao35mST9IrOH2HiKTSSvjLMj02Bczc2Sf2yB4T0bzGiXdM0gWh dDWg== X-Gm-Message-State: AOJu0YyGrmcWZ5wK1uEvWFtmQAri3y9Nohcrt2hZbxHhuXeizaJ5KJj5 gWGvmGw/fvGvvMWUn8Ij6OSXWfkt1DO3qj2zfTTsj5IxgNLEnABPrRjLdW4vH5I= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_065401_543063_5F81C7DF X-CRM114-Status: GOOD ( 14.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This makes the LEDs on the 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: 13640134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 376B5C4345F for ; Tue, 23 Apr 2024 13:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tmc4lWLEkJ/H9HbO/vWU6ARCk8x7xqQwutmKmAGVXkc=; b=Z09GipmWWHCRaX qgENa8qhdDthJtSIjCscO/X1kjxF6RTTI/4gEYPjYPozB+1MSYzFodXnBKGEwYE5wFD/RqwJS/7dv baxAb4CGdKN3J7F9qdwps20uh8jj7hQPHjcecBCbkAFobTetoSABClI3xFXvpiCOndzlsD6mqOshj mVZul3W+NkqP5DxliDtDUeoZX7Jg88AWBqIkiTSPRjp25GOZFxgFtfBhgIfpQ3AkM0MiRpX+B7qs+ AaS0TlcRFzLZo6DR5GUP/m023tzOOeOy4/QD5LxrRg0ImrFLiydBw8FM39rnjw96o239SB5Xpifj0 Slr0JD3GYkox/JiunR6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGbW-00000000Aq3-27cY; Tue, 23 Apr 2024 13:54:38 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGax-00000000AaE-1hSI for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 13:54:04 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-51967f75763so6738959e87.2 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=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gReuYTpcRssmlbBTeL2oSNhhV9ufTFwwH1vDMi+LMNc=; b=AdGiT0gXtUkUvOe3SLjjwCNCHEf7CM2x3Jkl/X2N0vPjA/pgLmi5qaTrbFJz5xumTt TgREogHKLx0WGFTwgySb98H+Tae7q1iHHuXrRQD1n2C1hCfqWsuljju61AciOU81g3KK PewvTpczYlqGX8ocnO1BAZ3S2ZycIcc1igGZ/v4qYJZEXOk6Ys3EJnL4WiiFKgfCSg/3 khkYKwB0pXC4JJk0dtU5ZTYInQsRktRsnt+lo+GgB808ElYncUrf1lMwyHf9QBx3NftC GXEn6kdKTWZ/RP9iVmj2pctpeQFhOytCaJ7NK+INGP+wiuvEerGYY8SZ5Q2uBksnWy0H 4Bxg== 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=O4/9PdQjJWGCdEmEEWlFDCc4dCNkj4wLoe+N8QBei8ReDzLHVTMsTOXRlsM3M7gxPf 2QJlN9DAHiCOAb7UEhuVHsPopjcolXtTQAO0uOPzodSI9FGBaTBEZIgAYUb7hYpxp2/n 15GsE1gekTJR5HCmA+SJ4/dtsUg0Qp2dDXpkGGAAw12n74KsB4JRcKFO5As7k4P8sUE/ WDY5FvEVoK60ZS84LYfShKY8drO9sEPI84oZw4VPtCoPR/UU74iopOkNCQluruXUc09U 7yaKZqgANo23XESVlPS4PlMWmL2Vo3FkmHdg+r0qWRn16vfk5j67vvg1jMcJzioLv52h zOGw== X-Gm-Message-State: AOJu0YzyZUw6ssIaBVhtGMpAowchfSk3w9EBvF0NTOjli+mHKRf2tpFM hEAUP7VowNbdNpH6iDi1V1pPwvqdSfCcj25hn20KWr0dSc9ShJIFQS56kVkMAWPfRRX06UkiT4F 7 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_065403_645441_F617712F X-CRM114-Status: GOOD ( 14.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This makes the LEDs on the 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: 13640131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A87E8C4345F for ; Tue, 23 Apr 2024 13:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=V/r/zwd3JQ2iNeLira8G9aH1sDCHdLSuzJGC3BSIl9Y=; b=djicAVL1SVJ6j3 2lhQjNgb45l2/0c5TD4GObKBHaepWCRKoKYnWD/Mk5GZEWzSIV+g3S/7WQ3xiEieBS6cW+vr4kDOO VMSC5c4LDSygW2gh55nKE5GIveGnrx74F8Zxb+dBNl0AoY3d4zB/Craq3rsAJrqONpLOncM/yy2s4 /3QkiLZA5dX9C0y4zk+ev6b8KTWNdtjmntZ4wR6iPuIP+hbN/cbJVWhozXmjC7g5BMoGZBN2OitVO NLMoL91h6myJ4X5Djr72XmatQmOx4IsWxBJUjQAxAILPxjNI0hVzIa//6/7u9hZTD0ueC2BEoUaiF Hrl+c8AWL3F43lFWuhEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGbR-00000000AlE-3IxM; Tue, 23 Apr 2024 13:54:33 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGay-00000000Ab3-1f2l for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 13:54:06 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-5196c755e82so8005018e87.0 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=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bED1J92t6L8xqCCoMd53N6tL4C0DTI8s9irWtXqiNYc=; b=ELJjc9DnZ7LjxX7zTHkClaeOF4Hv5DW2hYBloqsuuLrtolGS40WUoGwWU7DIpjCNs1 FCSVBS2BOJVkALXQhHyzy1CS5WK/OW/zwOUImWtg52LC/nLXD4ugODQ/6rIYDcgNIjUD OulaIs77PTHMQjXeXeQpjkHMfH/Lk0mX9ThVx4FJ6/P3pFZNTgAFgx6ymh8KIcHIfZYU bJ0GNLjADMuGYBIOP8uEpLLWDcxv973wxBI9v7AW9P2d/ddwzgNKssAZAo6+M1ittQ+d 1Jj9HCXwPun92/po0dBmh60E7DkG27KUDqZlPJvOHCRN3TmTnNvKproPg/wr+hJU9OnU IXhw== 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=nc9ay0Bzy2WhNkpxV8Rkb3FRNFKjZd7KU8bcHlgn/YH0TWh6jjDhuu1unoK1yhDpo1 TEc2zxk0VitSNlXT18r+vHv/cpF9ohvAMgn2F6NEjOtCeTe+lyrk1HlBZDAS2WFJNc45 eROt88skP8W/vtKwZRZ6pLPqpJylQB8zc8PZyZ8vYyf+4cw7BrLLpRr7yI6yy5YEp/Zx WkolRPpCPKbIHAWrz0tTGJVWjjC9XPtRv6vchfJSdbipEoOcvnzd46Oa9aGAe8S5oNAR IgM+FNIi+fZZoJVe/7mRrTy/LJm5dc/lyQjRbVv5vFfOjrLV2pIWbI/G69UnyGkVCw38 BMSQ== X-Gm-Message-State: AOJu0YxtfUCorMlA1Ay9Eoofx/LXM7E3ZUr7Bja4p020nounWUJh5dne K7kR9s8JCZOR5scLeDSLXQWBYrnlRWwuzWcEDxXRTfH2F5mWlNw5oy+Xs2Gik0s= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_065404_608595_738A4968 X-CRM114-Status: GOOD ( 14.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This makes the LEDs on the 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: 13640133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9610EC04FFE for ; Tue, 23 Apr 2024 13:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jDFZ1RNUus0Ek70toimpmBlln6JecOtyogYQvwKl2kU=; b=Be04BtFhsDRQ/U 8VInEFe7ALJJ51x+K3TgnaCPrHQCb4BpvhV17VFY+RU3OGJatj2sBNbI4BQBvasuuzeApWRVF2Zr6 aiXo15d73jV7U0ouevWTBpCzEBl+7p096TuZztDYSlrIuw/MFecrPsl3YqrvJqrp3H43nnCVo8FHE ACkC+8DiPZxszn7bmqTQEb+sDswoRaSClhNBsJ23fYsIaI1SF/WtMraTTHrGvopraHSGPjkb0FrbS 5hoi8zS/9U1asEfydeOtAjn6yMUtm9BsGjJHIonHbSHlLaL8cOTZ8omyrw8FwrF0ot/Wz7ngnmwC/ byEQsxLo35PvilzoZkeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGbT-00000000AnC-04DL; Tue, 23 Apr 2024 13:54:35 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGaz-00000000AbI-1dlr for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 13:54:06 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-518a3e0d2ecso8550006e87.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=1713880442; x=1714485242; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wEjTI295LgCVV5ERwS4DZP1yxmv81nEiKm3GiKi945M=; b=o3TkgYCH7/FI9c5OK8FPao0EvFq2CgLsxscA+74sfpsZe5Kvs6rY8/++z4PMqBLCGv ksRdH7P0p6kS2GdLRVxdCiBhQFrrnq+QAobdpTrwyCTO7X5ID/nnR4CqptHKJse7wCwe w2XNjaamZ/+A2LotK8bpl76s6qI99scamtUbhlhPi8vfQoSse2Gbno8ogkrJUgA3xjhO aRMlmPkQhFx22gmhLTvGAdsBh4/LJTqcOlmx8rtfoM1Tdi5RrEJlaH5owJ5hcp6ih5nv EKBrIfSqrzj1pU44kL0cG5UItYKGXeghJkhwRbbJUJqO0JmDEUgCLu1qSYw8QJTxgxjl GPWQ== 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=JJDM5WzfJQFo/fETjamvT47ZJfyyPNBHm+4q98deVKxt1you6DNQ87VYXBL86C7zYb dnfO2rhu6HOa8g+n1srTS0k1WZEbKH3yMU5s36GrkoVw3FqnXu1ilDx+QxM+aWJ1wdyG 8WJUo2U1cwL6bBqxD/so0R2o5C4V6v+FWntDwjtv2uX/QCCQE4a5WLUhF/Ev3XzK6Rxf 6ME6S4ZeFANgHXPoV8h8UDi7qIN5xTyuRcJaoH4tS7P9XieUUEEC0r05sWDLDZOF1VbC KCP48dNE22pBeL0ltXQqui3w+e3aJ8oEB+i8NBdPTc+aNhqlymFO/vK+mQYu+CoAl7DA LlYA== X-Gm-Message-State: AOJu0YxzZ+kqSPgKaAuTOJ3dtbhlnewtM1lgo70Lz9BTlPC8lXuJ1ZF+ 71yiPkmTZESiOxDPpfs8sKJbAie+xDk3OMivpbeoE1ryGD9yWZaaWtTGmUqvUk5M4eAGvVgB66c 5 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_065405_592563_C64BCC2D X-CRM114-Status: GOOD ( 13.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This makes the LEDs on the 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: 13640132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63D16C4345F for ; Tue, 23 Apr 2024 13:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qmFwwvuD2YJPHZOzuVAou8qb4bC34iDyEt37e0Un1po=; b=Ck0BSBSmWfVMEq AyVdMHxLW7/vtR62SIHOCCUqFL8JzGKpcV9dYmWByaW9WEAS7l8LagDU3ExW3E4DiZwPJwd9L5/nF VK5brJYAFEU6PxtRu3Y3fUuP4QWOAz/5qb9WK1RNDh1TPoxkZBz8dmdq6oUm6KDACBuxhbKnyudE4 Xr6imS6p/WhPXM5qRoggeRm6JuJ1u/gNNzuhWtCJ7w19ntsJ3tatCJ9PTV40nCNhM2KzIZKEB4vKa oaFfzrCMTNzECskEsz1dxQE0hgqERhE3Q1iBDvGBdctwqdiPOiaQp6brxJxC3Lf00W6EsIl4QZG3s guTs/C1eHWC8xlXE4yjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGbV-00000000Aoy-11pC; Tue, 23 Apr 2024 13:54:37 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGb0-00000000Abt-1Xcc for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 13:54:07 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5193363d255so7582838e87.3 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=1713880443; x=1714485243; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gtSA0+kfCH0DzApn0Z0KwQ9Ybzg48e+TinciXUnlIO0=; b=UsbBBRaoB9d8vtJCLakqjmRcnjDpsTPz6I4pv7W0nkVvc496noU7xN4epGrP0OrPXj pKujER4ojXU1Qi+wE/D08IoFWON5CQBft0a4iTpQAiLpBKht8Quri/1tHDehJ81+eEpo 3/pXSf8/CkeRwgezSjEypVr8hyAmgC2PKo2pb8tWxXI0wJT2eKlyapuaH3nZ7sIA3u1A cxtotJWoyBjG62jnnRAMrsHFbfxXEPONF94nHv7PYpGUoJC4kTXfCjRBOE9IOFe+yd+I WxfTeRW5NDeevnvYziDO+hYe+lL7lUbxLaKg/scjzW5F06ZF6706klZ16sMGwkTSeFE7 anew== 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=UQaSPBJWyDZ3UxVeVY9vRyeYR4qNOhBm1N5r39RW5kYxYkUXu9xu/9PZbysHdVvgtK tznEcwlSEDl+tZWMVTJuh0xotUKjMrbV5DJ8sN9+vQIIXLpq4KFqybqZJI/Gizcoad6J mhKQCKAsg0K7s7YP/qFStq+t4INmnZY9JzY1+q9/D16U51tJ9OpMlWVnBh8ghhLLCpzb 6DTgVamzJOasnFf20mCXou/uhSyzR2piY9bw8+6aO7L+gLR8p9/zu9PF7MPp46grsq8t PFLI0GBlb7hwPEBJhdb2t4b84QeM0IEm1htgAPlTyWfFHxVa87sl/rh5NwKCyriiAZp1 2B0A== X-Gm-Message-State: AOJu0YwyX8JJRqpcifAyaT9rWbagaSimqJmJUbnwqVYUV7aUVCkgFPY8 1+5KEFmHAxhizkGkwB4rfpnaBUhoUQHsaV7vC/ZsRkUakGAZHM+pH07LLF4fDSw= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_065406_463323_C00B0CBF X-CRM114-Status: GOOD ( 14.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This makes the LEDs on the 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 */