All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: sa1100/assabet: convert LEDs to gpiod APIs
@ 2021-07-17 23:54 Linus Walleij
  2021-07-19 15:36 ` Russell King (Oracle)
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2021-07-17 23:54 UTC (permalink / raw)
  To: Russell King; +Cc: linux-arm-kernel, Linus Walleij, Russell King

Convert the Assabet LEDs to use the gpiod APIs.

Cc: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-sa1100/assabet.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 2012fa8c28cf..9919e0f32c4b 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -84,7 +84,7 @@ void ASSABET_BCR_frob(unsigned int mask, unsigned int val)
 }
 EXPORT_SYMBOL(ASSABET_BCR_frob);
 
-static int __init assabet_init_gpio(void __iomem *reg, u32 def_val)
+static void __init assabet_init_gpio(void __iomem *reg, u32 def_val)
 {
 	struct gpio_chip *gc;
 
@@ -94,11 +94,9 @@ static int __init assabet_init_gpio(void __iomem *reg, u32 def_val)
 			   assabet_names, NULL, NULL);
 
 	if (IS_ERR(gc))
-		return PTR_ERR(gc);
+		return;
 
 	assabet_bcr_gc = gc;
-
-	return gc->base;
 }
 
 /*
@@ -475,16 +473,23 @@ static struct gpiod_lookup_table assabet_cf_vcc_gpio_table = {
 	},
 };
 
+static struct gpiod_lookup_table assabet_leds_gpio_table = {
+	.dev_id = "leds-gpio",
+	.table = {
+		GPIO_LOOKUP("assabet", 13, NULL, GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("assabet", 14, NULL, GPIO_ACTIVE_LOW),
+		{ },
+	},
+};
+
 static struct gpio_led assabet_leds[] __initdata = {
 	{
 		.name = "assabet:red",
 		.default_trigger = "cpu0",
-		.active_low = 1,
 		.default_state = LEDS_GPIO_DEFSTATE_KEEP,
 	}, {
 		.name = "assabet:green",
 		.default_trigger = "heartbeat",
-		.active_low = 1,
 		.default_state = LEDS_GPIO_DEFSTATE_KEEP,
 	},
 };
@@ -603,6 +608,7 @@ static void __init assabet_init(void)
 					  &assabet_keys_pdata,
 					  sizeof(assabet_keys_pdata));
 
+	gpiod_add_lookup_table(&assabet_leds_gpio_table);
 	gpio_led_register_device(-1, &assabet_leds_pdata);
 
 #ifndef ASSABET_PAL_VIDEO
@@ -739,7 +745,6 @@ static void __init assabet_map_io(void)
 
 void __init assabet_init_irq(void)
 {
-	unsigned int assabet_gpio_base;
 	u32 def_val;
 
 	sa1100_init_irq();
@@ -754,10 +759,7 @@ void __init assabet_init_irq(void)
 	 *
 	 * This must precede any driver calls to BCR_set() or BCR_clear().
 	 */
-	assabet_gpio_base = assabet_init_gpio((void *)&ASSABET_BCR, def_val);
-
-	assabet_leds[0].gpio = assabet_gpio_base + 13;
-	assabet_leds[1].gpio = assabet_gpio_base + 14;
+	assabet_init_gpio((void *)&ASSABET_BCR, def_val);
 }
 
 MACHINE_START(ASSABET, "Intel-Assabet")
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: sa1100/assabet: convert LEDs to gpiod APIs
  2021-07-17 23:54 [PATCH] ARM: sa1100/assabet: convert LEDs to gpiod APIs Linus Walleij
@ 2021-07-19 15:36 ` Russell King (Oracle)
  2021-07-20 15:47   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King (Oracle) @ 2021-07-19 15:36 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-arm-kernel

On Sun, Jul 18, 2021 at 01:54:40AM +0200, Linus Walleij wrote:
> Convert the Assabet LEDs to use the gpiod APIs.
> 
> Cc: Russell King <rmk+kernel@armlinux.org.uk>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Looks fine to me. How do you want to merge it?

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: sa1100/assabet: convert LEDs to gpiod APIs
  2021-07-19 15:36 ` Russell King (Oracle)
@ 2021-07-20 15:47   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2021-07-20 15:47 UTC (permalink / raw)
  To: Russell King (Oracle); +Cc: Linux ARM

On Mon, Jul 19, 2021 at 5:36 PM Russell King (Oracle)
<linux@armlinux.org.uk> wrote:
> On Sun, Jul 18, 2021 at 01:54:40AM +0200, Linus Walleij wrote:
> > Convert the Assabet LEDs to use the gpiod APIs.
> >
> > Cc: Russell King <rmk+kernel@armlinux.org.uk>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
> Looks fine to me. How do you want to merge it?

I'll just add it to your patch tracker, it's the usual for SA1100 I think.

Thanks!
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-20 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-17 23:54 [PATCH] ARM: sa1100/assabet: convert LEDs to gpiod APIs Linus Walleij
2021-07-19 15:36 ` Russell King (Oracle)
2021-07-20 15:47   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.