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

> From: "Enrico Weigelt, metux IT consult" <i...@metux.net>
>
> Driver for PCengines APUv2 board that supports GPIOs via AMD PCH
> and attached LEDs and keys.
>
> Cc: linux-g...@vger.kernel.org
> Cc: linus.wall...@linaro.org
> Cc: bgolaszew...@baylibre.com
> Cc: dvh...@infradead.org
> Cc: a...@infradead.org
> Cc: platform-driver-...@vger.kernel.org
>
> Signed-off-by: Enrico Weigelt, metux IT consult <i...@metux.net>

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

Reply via email to