From: Linus Walleij <linus.walleij@linaro.org>
To: Andrew Lunn <andrew@lunn.ch>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Gregory Clement <gregory.clement@bootlin.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 4/5] ARM: orion5x: Convert Net2big board to GPIO descriptors for LEDs
Date: Tue, 23 Apr 2024 15:54:00 +0200 [thread overview]
Message-ID: <20240423-gpio-leds-v1-4-799c2f6bc61c@linaro.org> (raw)
In-Reply-To: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.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 <linus.walleij@linaro.org>
---
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 <linux/i2c.h>
#include <linux/ata_platform.h>
#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
#include <linux/delay.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -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);
}
--
2.44.0
next prev parent reply other threads:[~2024-04-23 13:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 13:53 [PATCH 0/5] Decrease the usage of global GPIO numbers for LEDs Linus Walleij
2024-04-23 13:53 ` [PATCH 1/5] ARM: orion5x: Convert D2Net board to GPIO descriptors " Linus Walleij
2024-04-23 13:53 ` [PATCH 2/5] ARM: orion5x: Convert DNS323 " Linus Walleij
2024-04-23 13:53 ` [PATCH 3/5] ARM: orion5x: Convert MV2120 " Linus Walleij
2024-04-23 13:54 ` Linus Walleij [this message]
2024-04-23 13:54 ` [PATCH 5/5] ARM: orion5x: Convert TS409 " Linus Walleij
2024-05-05 16:19 ` [PATCH 0/5] Decrease the usage of global GPIO numbers " Gregory CLEMENT
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240423-gpio-leds-v1-4-799c2f6bc61c@linaro.org \
--to=linus.walleij@linaro.org \
--cc=andrew@lunn.ch \
--cc=gregory.clement@bootlin.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).