* [PATCH] x86/platform/geode: Convert LED to GPIO machine descriptor
@ 2020-07-27 8:00 Linus Walleij
2020-07-27 10:45 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2020-07-27 8:00 UTC (permalink / raw)
To: Darren Hart, Andy Shevchenko
Cc: platform-driver-x86, Linus Walleij, linux-gpio, Andres Salomon,
linux-geode
This makes the machine look up the LED from a GPIO machine
descriptor table. The Geode LEDs should be on the CS5535
companion chip.
Cc: linux-gpio@vger.kernel.org
Cc: Andres Salomon <dilinger@queued.net>
Cc: linux-geode@lists.infradead.org
Cc: Andy Shevchenko <andy@infradead.org>
Cc: Darren Hart <dvhart@infradead.org>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/x86/platform/geode/net5501.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/geode/net5501.c b/arch/x86/platform/geode/net5501.c
index 163e1b545517..d4e6c57b9c87 100644
--- a/arch/x86/platform/geode/net5501.c
+++ b/arch/x86/platform/geode/net5501.c
@@ -20,6 +20,7 @@
#include <linux/platform_device.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
+#include <linux/gpio/machine.h>
#include <asm/geode.h>
@@ -55,9 +56,7 @@ static struct platform_device net5501_buttons_dev = {
static struct gpio_led net5501_leds[] = {
{
.name = "net5501:1",
- .gpio = 6,
.default_trigger = "default-on",
- .active_low = 0,
},
};
@@ -66,6 +65,15 @@ static struct gpio_led_platform_data net5501_leds_data = {
.leds = net5501_leds,
};
+static struct gpiod_lookup_table net5501_leds_gpio_table = {
+ .dev_id = "leds-gpio",
+ .table = {
+ /* The Geode GPIOs should be on the CS5535 companion chip */
+ GPIO_LOOKUP_IDX("cs5535-gpio", 6, NULL, 0, GPIO_ACTIVE_HIGH),
+ { },
+ },
+};
+
static struct platform_device net5501_leds_dev = {
.name = "leds-gpio",
.id = -1,
@@ -80,6 +88,7 @@ static struct platform_device *net5501_devs[] __initdata = {
static void __init register_net5501(void)
{
/* Setup LED control through leds-gpio driver */
+ gpiod_add_lookup_table(&net5501_leds_gpio_table);
platform_add_devices(net5501_devs, ARRAY_SIZE(net5501_devs));
}
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/platform/geode: Convert LED to GPIO machine descriptor
2020-07-27 8:00 [PATCH] x86/platform/geode: Convert LED to GPIO machine descriptor Linus Walleij
@ 2020-07-27 10:45 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2020-07-27 10:45 UTC (permalink / raw)
To: Linus Walleij
Cc: Darren Hart, Andy Shevchenko, Platform Driver,
open list:GPIO SUBSYSTEM, Andres Salomon, linux-geode
On Mon, Jul 27, 2020 at 11:02 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> This makes the machine look up the LED from a GPIO machine
> descriptor table. The Geode LEDs should be on the CS5535
> companion chip.
Comments (rather nit-picks) below for all three.
In any case this version is okay
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
I'm not sure the prefix shouldn't be .../geode: for all of them
followed by mentioning the name in the subject line.
> Cc: linux-gpio@vger.kernel.org
> Cc: Andres Salomon <dilinger@queued.net>
> Cc: linux-geode@lists.infradead.org
> Cc: Andy Shevchenko <andy@infradead.org>
> Cc: Darren Hart <dvhart@infradead.org>
> Cc: platform-driver-x86@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> arch/x86/platform/geode/net5501.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/platform/geode/net5501.c b/arch/x86/platform/geode/net5501.c
> index 163e1b545517..d4e6c57b9c87 100644
> --- a/arch/x86/platform/geode/net5501.c
> +++ b/arch/x86/platform/geode/net5501.c
> @@ -20,6 +20,7 @@
> #include <linux/platform_device.h>
> #include <linux/input.h>
> #include <linux/gpio_keys.h>
> +#include <linux/gpio/machine.h>
>
> #include <asm/geode.h>
>
> @@ -55,9 +56,7 @@ static struct platform_device net5501_buttons_dev = {
> static struct gpio_led net5501_leds[] = {
> {
> .name = "net5501:1",
> - .gpio = 6,
> .default_trigger = "default-on",
> - .active_low = 0,
> },
> };
>
> @@ -66,6 +65,15 @@ static struct gpio_led_platform_data net5501_leds_data = {
> .leds = net5501_leds,
> };
>
> +static struct gpiod_lookup_table net5501_leds_gpio_table = {
> + .dev_id = "leds-gpio",
> + .table = {
> + /* The Geode GPIOs should be on the CS5535 companion chip */
> + GPIO_LOOKUP_IDX("cs5535-gpio", 6, NULL, 0, GPIO_ACTIVE_HIGH),
> + { },
It will be good if we don't put commas in the terminator line (to
avoid copy'n'paste practice of this).
> + },
> +};
...
> static void __init register_net5501(void)
> {
> /* Setup LED control through leds-gpio driver */
> + gpiod_add_lookup_table(&net5501_leds_gpio_table);
> platform_add_devices(net5501_devs, ARRAY_SIZE(net5501_devs));
> }
The cleanest way is also to provide an __exitcall function, but I
guess it may be too much.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-27 10:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 8:00 [PATCH] x86/platform/geode: Convert LED to GPIO machine descriptor Linus Walleij
2020-07-27 10:45 ` Andy Shevchenko
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).