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: 791319 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JeQUBtei" 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: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: 791318 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kfVPArjx" 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: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: 791317 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gL+PxhQt" 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 */