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); }