From 5b6c28c43dee455b643e13d7f0debd79835a5f50 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Wed, 29 Jun 2016 10:47:22 -0700 Subject: gpio: Add support for translating gpio_t into ACPI pin Add a function for an SOC to define that will allow it to map the SOC-specific gpio_t value into an appropriate ACPI pin. The exact behavior depends on the GPIO implementation in the SOC, but it can be used to provide a pin number that is relative to the community or bank that a GPIO resides in. Change-Id: Icb97ccf7d6a9034877614d49166bc9e4fe659bcf Signed-off-by: Duncan Laurie Reviewed-on: https://review.coreboot.org/15512 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/include/gpio.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/include') diff --git a/src/include/gpio.h b/src/include/gpio.h index 3f462df295..69a0828f58 100644 --- a/src/include/gpio.h +++ b/src/include/gpio.h @@ -40,6 +40,16 @@ int _gpio_base3_value(gpio_t gpio[], int num_gpio, int binary_first); */ const char *gpio_acpi_path(gpio_t gpio); +/* + * This function may be implemented by SoC/board code to provide + * a mapping from the internal representation of a GPIO to the 16bit + * value used in an ACPI GPIO pin table entry. + * + * If not implemented by the SOC the default handler will return 0 + * because the underlying type of gpio_t is unknown. + */ +uint16_t gpio_acpi_pin(gpio_t gpio); + /* * Read the value presented by the set of GPIOs, when each pin is interpreted * as a base-2 digit (LOW = 0, HIGH = 1). -- cgit v1.2.3