Re: [PATCH 2/2] x86: pcengines apuv2 gpio/leds/keys platform driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 8, 2019 at 2:16 AM Enrico Weigelt, metux IT consult
<lkml@xxxxxxxxx> wrote:

> From: "Enrico Weigelt, metux IT consult" <info@xxxxxxxxx>
>
> Driver for PCengines APUv2 board that supports GPIOs via AMD PCH
> and attached LEDs and keys.
>
> Cc: linux-gpio@xxxxxxxxxxxxxxx
> Cc: linus.walleij@xxxxxxxxxx
> Cc: bgolaszewski@xxxxxxxxxxxx
> Cc: dvhart@xxxxxxxxxxxxx
> Cc: andy@xxxxxxxxxxxxx
> Cc: platform-driver-x86@xxxxxxxxxxxxxxx
>
> Signed-off-by: Enrico Weigelt, metux IT consult <info@xxxxxxxxx>

Andy can provide more details on this patch here are some quick
remarks:

> +#define GPIO_BASE              100
> +
> +#define GPIO_LED1              (GPIO_BASE+0)
> +#define GPIO_LED2              (GPIO_BASE+1)
> +#define GPIO_LED3              (GPIO_BASE+2)
> +#define GPIO_MODESW            (GPIO_BASE+3)
> +#define GPIO_SIMSWAP           (GPIO_BASE+4)

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"

Yours,
Linus Walleij



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux