lkml.org 
[lkml]   [2019]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH 2/2] x86: pcengines apuv2 gpio/leds/keys platform driver
    On Mon, Feb 11, 2019 at 11:39 AM Enrico Weigelt, metux IT consult
    <lkml@metux.net> wrote:

    > 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 ?

    It is a bit tricky.

    For the dev_id you need to be aware of the following from
    <linux/platform_device.h>:
    #define PLATFORM_DEVID_NONE (-1)
    #define PLATFORM_DEVID_AUTO (-2)

    If the platform device has .id set to -1 it will be just "leds-gpio",
    if it is -2 it will be whatever, take a chance on .0 or ideally fix
    it up. Any positive number like .id = 4 becomes "leds-gpio.4".

    So figure out the .id field on the platform device.

    Yours,
    Linus Walleij

    \
     
     \ /
      Last update: 2019-02-13 10:35    [W:3.634 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site