linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ARM: ep93xx: Convert to use descriptors for GPIO LEDs
@ 2022-09-02 22:04 Linus Walleij
  2022-11-30  8:49 ` Alexander Sverdlin
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2022-09-02 22:04 UTC (permalink / raw)
  To: H Hartley Sweeten, Alexander Sverdlin
  Cc: linux-arm-kernel, linux-gpio, Linus Walleij, Nikita Shubin,
	Lukasz Majewski

This converts the EP93xx to use GPIO descriptors for the
LEDs.

Cc: Nikita Shubin <nikita.shubin@maquefel.me>
Cc: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Cc: Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Fix syntax error (doubled left parens)
---
 arch/arm/mach-ep93xx/core.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 2d58e273c96d..318c09ee4723 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -425,10 +425,8 @@ void __init ep93xx_register_spi(struct ep93xx_spi_info *info,
 static const struct gpio_led ep93xx_led_pins[] __initconst = {
 	{
 		.name	= "platform:grled",
-		.gpio	= EP93XX_GPIO_LINE_GRLED,
 	}, {
 		.name	= "platform:rdled",
-		.gpio	= EP93XX_GPIO_LINE_RDLED,
 	},
 };
 
@@ -437,6 +435,16 @@ static const struct gpio_led_platform_data ep93xx_led_data __initconst = {
 	.leds		= ep93xx_led_pins,
 };
 
+static struct gpiod_lookup_table ep93xx_leds_gpio_table = {
+	.dev_id = "leds-gpio",
+	.table = {
+		/* Use local offsets on gpiochip/port "E" */
+		GPIO_LOOKUP_IDX("E", 0, NULL, 0, GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP_IDX("E", 1,	NULL, 1, GPIO_ACTIVE_HIGH),
+		{ }
+	},
+};
+
 /*************************************************************************
  * EP93xx pwm peripheral handling
  *************************************************************************/
@@ -989,6 +997,7 @@ struct device __init *ep93xx_init_devices(void)
 	platform_device_register(&ep93xx_ohci_device);
 	platform_device_register(&ep93xx_wdt_device);
 
+	gpiod_add_lookup_table(&ep93xx_leds_gpio_table);
 	gpio_led_register_device(-1, &ep93xx_led_data);
 
 	return parent;
-- 
2.37.2


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

* Re: [PATCH v2] ARM: ep93xx: Convert to use descriptors for GPIO LEDs
  2022-09-02 22:04 [PATCH v2] ARM: ep93xx: Convert to use descriptors for GPIO LEDs Linus Walleij
@ 2022-11-30  8:49 ` Alexander Sverdlin
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Sverdlin @ 2022-11-30  8:49 UTC (permalink / raw)
  To: Linus Walleij, H Hartley Sweeten
  Cc: linux-arm-kernel, linux-gpio, Nikita Shubin, Lukasz Majewski

Hello Linus!

On Sat, 2022-09-03 at 00:04 +0200, Linus Walleij wrote:
> This converts the EP93xx to use GPIO descriptors for the
> LEDs.
> 
> Cc: Nikita Shubin <nikita.shubin@maquefel.me>
> Cc: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> Cc: Hartley Sweeten <hsweeten@visionengravers.com>
> Cc: Lukasz Majewski <lukma@denx.de>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

I've tested it on EDB9302-similar custom board, both LEDs
work nicely.

Tested-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>

> ---
> ChangeLog v1->v2:
> - Fix syntax error (doubled left parens)
> ---
>  arch/arm/mach-ep93xx/core.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
> index 2d58e273c96d..318c09ee4723 100644
> --- a/arch/arm/mach-ep93xx/core.c
> +++ b/arch/arm/mach-ep93xx/core.c
> @@ -425,10 +425,8 @@ void __init ep93xx_register_spi(struct ep93xx_spi_info *info,
>  static const struct gpio_led ep93xx_led_pins[] __initconst = {
>         {
>                 .name   = "platform:grled",
> -               .gpio   = EP93XX_GPIO_LINE_GRLED,
>         }, {
>                 .name   = "platform:rdled",
> -               .gpio   = EP93XX_GPIO_LINE_RDLED,
>         },
>  };
>  
> @@ -437,6 +435,16 @@ static const struct gpio_led_platform_data ep93xx_led_data __initconst = {
>         .leds           = ep93xx_led_pins,
>  };
>  
> +static struct gpiod_lookup_table ep93xx_leds_gpio_table = {
> +       .dev_id = "leds-gpio",
> +       .table = {
> +               /* Use local offsets on gpiochip/port "E" */
> +               GPIO_LOOKUP_IDX("E", 0, NULL, 0, GPIO_ACTIVE_HIGH),
> +               GPIO_LOOKUP_IDX("E", 1, NULL, 1, GPIO_ACTIVE_HIGH),
> +               { }
> +       },
> +};
> +
>  /*************************************************************************
>   * EP93xx pwm peripheral handling
>   *************************************************************************/
> @@ -989,6 +997,7 @@ struct device __init *ep93xx_init_devices(void)
>         platform_device_register(&ep93xx_ohci_device);
>         platform_device_register(&ep93xx_wdt_device);
>  
> +       gpiod_add_lookup_table(&ep93xx_leds_gpio_table);
>         gpio_led_register_device(-1, &ep93xx_led_data);
>  
>         return parent;

-- 
Alexander Sverdlin.


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

end of thread, other threads:[~2022-11-30  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-02 22:04 [PATCH v2] ARM: ep93xx: Convert to use descriptors for GPIO LEDs Linus Walleij
2022-11-30  8:49 ` Alexander Sverdlin

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).