• Rafael J. Wysocki's avatar
    ACPI / GPIO: Driver GPIO mappings for ACPI GPIOs · f028d524
    Rafael J. Wysocki authored
    Provide a way for device drivers using GPIOs described by ACPI
    GpioIo resources in _CRS to tell the GPIO subsystem what names
    (connection IDs) to associate with specific GPIO pins defined
    in there.
    
    To do that, a driver needs to define a mapping table as a
    NULL-terminated array of struct acpi_gpio_mapping objects
    that each contain a name, a pointer to an array of line data
    (struct acpi_gpio_params) objects and the size of that array.
    
    Each struct acpi_gpio_params object consists of three fields,
    crs_entry_index, line_index, active_low, representing the index of
    the target GpioIo()/GpioInt() resource in _CRS starting from zero,
    the index of the target line in that resource starting from zero,
    and the active-low flag for that line, respectively.
    
    Next, the mapping table needs to be passed as the second
    argument to acpi_dev_add_driver_gpios() that will register it with
    the ACPI device object pointed to by its first argument.  That
    should be done in the driver's .probe() routine.
    
    On removal, the driver should unregister its GPIO mapping table
    by calling acpi_dev_remove_driver_gpios() on the ACPI device
    object where that table was previously registered.
    
    Included are fixes from Mika Westerberg.
    Acked-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
    Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    f028d524
gpiolib-acpi.c 15.9 KB