Messages in this thread | | | Subject | Re: [PATCH 2/2] x86: pcengines apuv2 gpio/leds/keys platform driver | From | "Enrico Weigelt, metux IT consult" <> | Date | Mon, 11 Feb 2019 11:38:52 +0100 |
| |
On 08.02.19 15:30, Linus Walleij wrote:
Hi,
> Instead of hardcoding the GPIO base and offsets like this, use: > > #include <linux/gpio/machine.h> > > and define a descriptor table using the name of your gpiochip. > There should be examples of other board quirks doing this. > I have already patched gpio-leds.c to accept LEDs from > descriptor tables, see commit > commit 45d4c6de4e497e5b0026c77044ae5fcddf8fecd8 > "leds: gpio: Try to lookup gpiod from device"
Still trying to understand how that actually works ...
I'm now defining the leds pdata and gpio mapping this way:
static const struct gpio_led apu2_leds[] = { { .name = "apu:green:1" }, { .name = "apu:green:2" }, { .name = "apu:green:3" } };
struct gpiod_lookup_table gpios_led_table[] = { .dev_id = "leds-gpio.0", .table = { GPIO_LOOKUP_IDX("gpio.0", 0, "led", 0, GPIO_ACTIVE_LOW), GPIO_LOOKUP_IDX("gpio.0", 1, "led", 1, GPIO_ACTIVE_LOW), GPIO_LOOKUP_IDX("gpio.0", 2, "led", 2, GPIO_ACTIVE_LOW), } };
But unsure now to determine the correct names for dev_id (the leds-gpio instance ?) and the gpio chip. In the example, these seem to be autogenerated - how can I retrieve them from my actual devices ?
By the way: does that also work with gpio-keys-polled ?
--mtx
-- Enrico Weigelt, metux IT consult Free software and Linux embedded engineering info@metux.net -- +49-151-27565287
| |