Skip to content

Commit

Permalink
x86/platform/geode: Convert alix LED to GPIO machine descriptor
Browse files Browse the repository at this point in the history
Look up the LED from a GPIO machine descriptor table. The Geode LEDs
should be on the CS5535 companion chip.

Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
  • Loading branch information
linusw authored and suryasaimadhu committed Jan 15, 2021
1 parent ab20fda commit 6043030
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions arch/x86/platform/geode/alix.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/platform_device.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
#include <linux/gpio/machine.h>
#include <linux/dmi.h>

#include <asm/geode.h>
Expand Down Expand Up @@ -69,21 +70,15 @@ static struct platform_device alix_buttons_dev = {
static struct gpio_led alix_leds[] = {
{
.name = "alix:1",
.gpio = 6,
.default_trigger = "default-on",
.active_low = 1,
},
{
.name = "alix:2",
.gpio = 25,
.default_trigger = "default-off",
.active_low = 1,
},
{
.name = "alix:3",
.gpio = 27,
.default_trigger = "default-off",
.active_low = 1,
},
};

Expand All @@ -92,6 +87,17 @@ static struct gpio_led_platform_data alix_leds_data = {
.leds = alix_leds,
};

static struct gpiod_lookup_table alix_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_LOW),
GPIO_LOOKUP_IDX("cs5535-gpio", 25, NULL, 1, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("cs5535-gpio", 27, NULL, 2, GPIO_ACTIVE_LOW),
{ }
},
};

static struct platform_device alix_leds_dev = {
.name = "leds-gpio",
.id = -1,
Expand All @@ -106,6 +112,7 @@ static struct platform_device *alix_devs[] __initdata = {
static void __init register_alix(void)
{
/* Setup LED control through leds-gpio driver */
gpiod_add_lookup_table(&alix_leds_gpio_table);
platform_add_devices(alix_devs, ARRAY_SIZE(alix_devs));
}

Expand Down

0 comments on commit 6043030

Please sign in to comment.