diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-11-03 17:39:41 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-11-04 15:58:24 -0500 |
commit | f028d5242d7ecb0a1bfc80e7bd292201c8612641 (patch) | |
tree | 269609af6e6448736a8e831eb8740c6d60947f29 /include/acpi | |
parent | b26d4e2283b6d9b65bfe14b99c9c3a560e390a00 (diff) |
ACPI / GPIO: Driver GPIO mappings for ACPI GPIOs
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: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r-- | include/acpi/acpi_bus.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index a361f43b1974..7d1ce40e201e 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -345,6 +345,8 @@ struct acpi_device_data { | |||
345 | const union acpi_object *of_compatible; | 345 | const union acpi_object *of_compatible; |
346 | }; | 346 | }; |
347 | 347 | ||
348 | struct acpi_gpio_mapping; | ||
349 | |||
348 | /* Device */ | 350 | /* Device */ |
349 | struct acpi_device { | 351 | struct acpi_device { |
350 | int device_type; | 352 | int device_type; |
@@ -366,6 +368,7 @@ struct acpi_device { | |||
366 | struct acpi_scan_handler *handler; | 368 | struct acpi_scan_handler *handler; |
367 | struct acpi_hotplug_context *hp; | 369 | struct acpi_hotplug_context *hp; |
368 | struct acpi_driver *driver; | 370 | struct acpi_driver *driver; |
371 | const struct acpi_gpio_mapping *driver_gpios; | ||
369 | void *driver_data; | 372 | void *driver_data; |
370 | struct device dev; | 373 | struct device dev; |
371 | unsigned int physical_node_count; | 374 | unsigned int physical_node_count; |