[PATCH RFC v3 2/6] ARM: pxa: Convert Spitz LEDs to GPIO descriptors

Linus Walleij linus.walleij at linaro.org
Fri Sep 29 13:48:04 PDT 2023


Hi Duje,

thanks for your patch!

On Fri, Sep 29, 2023 at 3:15 PM Duje Mihanović <duje.mihanovic at skole.hr> wrote:

> Sharp's Spitz board still uses the legacy GPIO interface for configuring
> its two onboard LEDs.
>
> Convert them to use the GPIO descriptor interface.
>
> Signed-off-by: Duje Mihanović <duje.mihanovic at skole.hr>
(...)
> +       .table = {
> +               GPIO_LOOKUP_IDX("pxa-gpio", SPITZ_GPIO_LED_ORANGE, NULL, 0,
> +                               GPIO_ACTIVE_HIGH),
> +               GPIO_LOOKUP_IDX("pxa-gpio", SPITZ_GPIO_LED_GREEN, NULL, 1,
> +                               GPIO_ACTIVE_HIGH),

This looks right!

> +       gpiod_add_lookup_table(&spitz_led_gpio_table);
> +       spitz_gpio_leds[0].gpiod = gpiod_get_index(&spitz_led_device.dev,
> +                       NULL, 0, GPIOD_ASIS);
> +       spitz_gpio_leds[1].gpiod = gpiod_get_index(&spitz_led_device.dev,
> +                       NULL, 1, GPIOD_ASIS);
>         platform_device_register(&spitz_led_device);

I missed this before, sorry.

This will probably not work. You need to register the spitz_led_device
first, then
you can get the gpiod:s.

The lookup will use the device name to locate the device, and if the device
isn't there it can't be found.

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list