Duncan Laurie (dlaurie@chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15513
-gerrit
commit 29c3add5742097dac955f9c03b45d1c24326097b Author: Duncan Laurie dlaurie@chromium.org Date: Wed Jun 29 10:47:48 2016 -0700
soc/intel/apollolake: Add function to translate gpio_t into ACPI pin
There are four GPIO communities in this SOC and they are implemented as separate ACPI devices. This means the pin number that is used in an ACPI GPIO declaration needs to be relative to the community that the pin resides in. Also select GENERIC_GPIO_LIB in the SOC Kconfig so this function actually gets used.
This was tested on the reef mainboard by verifiying the output of the SSDT for the Maxim 98357A codec that the assigned GPIO_76 is listed as pin 0x24 which is the value relative to the Northwest community.
Change-Id: Iad2ab8eccf4c91185a075ffce8d41c81f06c1113 --- src/soc/intel/apollolake/Kconfig | 1 + src/soc/intel/apollolake/gpio.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+)
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig index 749c15b..8fd2967 100644 --- a/src/soc/intel/apollolake/Kconfig +++ b/src/soc/intel/apollolake/Kconfig @@ -21,6 +21,7 @@ config CPU_SPECIFIC_OPTIONS select C_ENVIRONMENT_BOOTBLOCK select COLLECT_TIMESTAMPS select COMMON_FADT + select GENERIC_GPIO_LIB select HAVE_INTEL_FIRMWARE select HAVE_SMI_HANDLER select MMCONF_SUPPORT diff --git a/src/soc/intel/apollolake/gpio.c b/src/soc/intel/apollolake/gpio.c index d0ef648..8a61eb7 100644 --- a/src/soc/intel/apollolake/gpio.c +++ b/src/soc/intel/apollolake/gpio.c @@ -115,6 +115,24 @@ void gpio_set(gpio_t gpio_num, int value) iosf_write(comm->port, config_offset, reg); }
+uint16_t gpio_acpi_pin(gpio_t gpio_num) +{ + const struct pad_community *comm = gpio_get_community(gpio_num); + + switch (comm->port) { + case GPIO_NORTH: + return PAD_N(gpio_num); + case GPIO_NORTHWEST: + return PAD_NW(gpio_num); + case GPIO_WEST: + return PAD_W(gpio_num); + case GPIO_SOUTHWEST: + return PAD_SW(gpio_num); + } + + return gpio_num; +} + const char *gpio_acpi_path(gpio_t gpio_num) { const struct pad_community *comm = gpio_get_community(gpio_num);