vendorcode/google/chromeos: Get ACPI pin from GPIO library

If the generic GPIO library is enabled the code that generates the
GPIO table in ACPI should attempt to get the GPIO pin value from
the gpio_acpi_pin() function.

BUG=b:120686247
TEST=Tested on Sarien board to ensure that GPIO pin exported by
Chrome OS for the Write Protect signal is correct.

Change-Id: I267694b576009f79bacac6eda5f32bbf51742d78
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://review.coreboot.org/c/30132
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Duncan Laurie 2018-12-10 11:29:36 -08:00 committed by Duncan Laurie
parent 28e8ae5385
commit 6217e9beff
1 changed files with 9 additions and 1 deletions

View File

@ -14,6 +14,9 @@
*/
#include <arch/acpigen.h>
#if IS_ENABLED(CONFIG_GENERIC_GPIO_LIB)
#include <gpio.h>
#endif
#include "chromeos.h"
void chromeos_acpi_gpio_generate(const struct cros_gpio *gpios, size_t num)
@ -28,7 +31,12 @@ void chromeos_acpi_gpio_generate(const struct cros_gpio *gpios, size_t num)
acpigen_write_package(4);
acpigen_write_integer(gpios[i].type);
acpigen_write_integer(gpios[i].polarity);
acpigen_write_integer(gpios[i].gpio_num);
/* Get ACPI pin from GPIO library if available */
#if IS_ENABLED(CONFIG_GENERIC_GPIO_LIB)
acpigen_write_integer(gpio_acpi_pin(gpios[i].gpio_num));
#else
acpigen_write_integer(gpios[i].gpio_num);
#endif
acpigen_write_string(gpios[i].device);
acpigen_pop_len();
}